Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
75
20.5 Implementing the ext2_cd Function
char far* FAR PASCAL ext2_cd(char PathName[MAX_PATH_LEN]);
This function accepts one argument, the address of a string containing the
path to the directory to change the current directory to. On successfully changing
the current directory, the function returns the path of the new current directory.
This function is extremely simple to implement, as shown in the example code
below:
20.6 Implementing the ext2_cp Function
BYTE FAR PASCAL ext2_cp(char sSrcPath[MAX_PATH_LEN],
char sDestPath[MAX_PATH_LEN],
BOOL fOWrite, double *Spd);
This function accepts four arguments, the meaning of each is described
below:
·
=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 destination path has to be specified in full, in the format:
<drive>:/<dir>/<subdir>/<destination filename>
This means that any command line completion has to be performed by the
calling application. The function returns an error code, defined in ext2lib.h:
Error Code
Value
No Error
0
INODE_NOT_FOUND
1
void ChangeDirectory(char PathName[MAX_PATH_LEN])
{
if(ext2_cd(&PathName) == NULL)
/*INVALID DIRECTORY*/
else
/*SUCCESS*/
return;
}