Final Year Project: Using Linux Filesystems Under Windows   Chris Bryden BEng. Electronics and Software Engineering    School of Computer Science   University of Birmingham 52 path  to  ensure  that  there  is  only  one  directory  separator,  ‘/’,  separating  the current  path  and  the  supplied  path  when  they  are  joined.  If  no  pathname  is specified as an argument, the durrent directory is listed.   The  function  then  simply  performs  two  calls  to  the  layer  1  PathToINode and ReadDir functions to resolve the inode number for the directory and to read the directory, respectively. The  DIRECTORY structure returned by the ReadDir function    is  then  returned  on  to  the  calling  application.  For  information  on  the DIRECTORY  structure  and  the  structure  of  the  directory  listing,  please  see section 5.16, entitled  ‘Layer 1: The ReadDir Function’.   5.25  Layer 2: The ext2_get_inode Function This function is used by the calling application to obtain the inode pointed to by the inode nu,mber, ulINode, passed to the function. The calling application may  wish  to  use  this  function  to  obtain  information  (type,  date,  etc.)  about  a particular file or directory. The function simply calls the layer 1 function GetInode which  returns  the  inode  (type  INODE).  This  is  then  returned  to  the  calling application.  For  information  on  the  structure  of  the  inode,  please  see  section 3.3.5 5.26  Layer 2: The ext2_cp Function The  calling  application  uses  this  function  to  copy  a  file  from  the  ext2 filesystem to a DOS filesystem. The function accepts four arguments: · =sSrcPath - The path of the source file. · =sDestPath - The path of the destination file. · =fOWrite - Overwrite Flag (TRUE = force overwrite, FALSE = do not overwrite) · =Spd  -  A  pointer  to  a  double  precision  variable  to  store  the  average  transfer speed for the operation. The function first performs a similar operation on the source path name as the ext2_ls and ext2_cp function, joining the current path, etc. It then makes a call to PathToInode to resolve the inode number of the source file. Once this has been  done  the  layer  1  function  CopyFile  is  called,  which  performs  the  file transfer.   The average transfer speed of the file is calculated, so that performance can be monitored. This is achieved by using ftime to record the exact time before the call to CopyFile, and the time when execution returns to the ext2_cp function. The ftime function fills a small structure, timeb, defined in timeb.h: