Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
26
4.4 Layer 2 - The Application Interface Layer
This layer is designed to provide an interface for application programs to
navigate the filesystem as if at a command line. It was decided to implement the
application interface in this way because this removes the need for the calling
application program (or programmer) to have to consider the internal workings of
the ext2 filesystem. It simply provides a well known set of commands that can be
used to navigate the filesystem. In order to achieve this layer 2 has to implement
the following functions:
·
=A part command to display partition information for all the hard disks
connected to the PC.
·
=A mount command to mount an ext2 filesystem
·
=An ls command that returns a directory listing.
·
=A cd command to change the current directory
·
=A cp command to copy a file from a location on the ext2 filesystem to
one on the DOS filesystem.
·
=A get inode command to return the inode information for a particular
file or directory
Each of the above commands is to function in a similar way to those found
on the command line. The library keeps a record of the disk drive and partition
numbers of currently mounted filesystem and also the current directory.
All the commands return information to the calling application, this is
achieved by writing the information to a location in memory and passing a pointer
to that location to the calling application.
4.4.1 The part command
This command has one simple function. It displays the partition
information for all hard disks connected to the PC. That is, it returns the partition
number, type and size. These are then used by the calling application to prompt
the user as to which partition is to be mounted. This function simply calls a
function supplied in layer 1, which, in turn, reads the partition information that
was loaded into the memory buffer by layer 0. This information is then passed
back to the calling application.
4.4.2 The mount command
This command is used by the calling application to mount an ext2
filesystem. This function calls the layer 1 functions to read the superblock into
memory and to read the group descriptors into memory. It performs checks on
the validity of the filesystem and returns information to the calling application