Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
45
null terminated. Any function in a calling application that has to read the directory
must use the rec_len values to read the directory.
5.17 Layer 1: The PathToInode Function
This is a very important function, as it performs the process of path to
inode resolution. This is the process of locating the inode number of a file or
directory given as a path. The steps for this process form part of the mini case
study in section <SECTON>. The process is represented here in diagram format.
To perform this operation the path has to be parsed. This is done by
searching through the path for the ext2fs directory separator, /, using the
_fmemccpy function, and then recording an offset in the pathname for the
beginning of a new file or directory name.
Determine the inode of the root directory. This is defined
as EXT2_ROOT_INO is ext2_fs.h, and is currently inode 2.
Read the root directory by calling the 'ReadDir' function
Search Through directory entries for an entry with the
name the same as the first part of the path name.
Read this directory into memory by calling the 'ReadDir'
function
Search this directory directory for an entry with the name
the same as the first part of the path name.
Is name
found?
is this the
last entry in
the path
name.
Use the inode number of the
last found directory name to
call ReadDir to read the
directory into memory
Return the inode number of
the last name
YES
NO
YES
Return 'Path Not Found'
NO