Final Year Project: Using Linux Filesystems Under Windows   Chris Bryden BEng. Electronics and Software Engineering    School of Computer Science   University of Birmingham 50 The elements of this structure hold the following values: · =ulInodes - The total number of inodes in the filesystem · =ulBlocks - The total number of blocks in the filesystem · =ulFreeInodes - The number of free inodes in the filesystem. · =ulFreeBlocks - The number of free blocks in the filesystem. · =ulBlockSize - The block size in bytes. · =sMountTime - A string giving the last time the filesystem was mounted read/write · =usState - The curren state of the filesystem. This can take one of two values: · =EXT2_VALID_FS 0x0001 - Valid Filesystem · =EXT2_ERROR_FS 0x0002 - The filesystem may contain errors The function sets the current path inode, ulCurDir to EXT2_ROOT_INO, curently 2, and the current path, sCurPath to “/” then returns the MOUNTINFO structure. 5.23  Layer 2: The ext2_cd Function This   function   is   used   to   change   the   current   directory.   It   takes   one argument, the path of the directory to change to. The supplied pathname has to be  added  to  the  end  of  the  current  path  to  give  the  complete  pathname.  The function first performs some checking on the supplied path to ensure that there is only  one  directory  separator,  ‘/’,  separating  the  current  path  and  the  supplied path when they are joined.   The  tasks shown in the diagram below then need to be performed by the function. They basically consist of setting the new current directory inode value, ulCurDir  and  setting  the  current  path  name  variavble,  sCuPath.  The  first  two entries of any ext2fs directory are ‘.’ and ‘..’ which point to the current directory and  the  previous  directory,  respectively.  If  the  calling  application  has  called ext2_cd with either of these directories as an argument, the current path variable typedef struct mountinfo { unsigned long ulInodes; unsigned long ulBlocks; unsigned long ulFreeInodes; unsigned long ulFreeBlocks; unsigned long ulBlockSize; char sMountTime[26]; unsigned short usState; } MOUNTINFO;