Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
49
5.20 Layer 2: Notes
The layer 2 functions have access to two global variables that keep track
of the current state of the filesystem:
·
=ulCurDir - This holds the inode number of the current directory.
·
=sCurPath - This is a string that holds the current path.
All the functions in this layer are exported from the library by specifying
the __export keyword in their function definitions. They make up the interface
between the ext2lib DLL and the calling application.
5.21 Layer 2: The get_part_info Function
This function is used by the calling application to return information
regarding the partitions found on all the hard disks connected to the PC. It
simply calls the layer 1 function GetPartInfoNice and returns the returned
PARTINFO structure to the calling application. For more details on the
PARTINFO structure, please refer to the Layer 1: The GetPartInfoNice Function
section, above.
5.22 Layer 2: The ext2_mount_fs Function
This function is used by the calling application to mount an ext2
filesystem. It accepts two arguments, the hard disk number and the partition
number of the filesystem to be mounted. The function performs the following
tasks:
1. Check for sensible drive and partition numbers
2. Check that the specified partition is a Linux partition (type 0x82)
3. Call the ReadSuperBlock function to read the superblock into memory.
4. Call the ReadGroupDesc function to read the group descriptors into memory
The function returns a structure giving information on the partition that has
just been mounted. This information is calculated from information located in the
duperblock, so the GetSuperBlock function is called to retrieve this information
from the memory buffer. The structure of the returned MOUNTINFO type is
shown below: