Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
29
5. Ext2lib Implementation
This section gives a detailed description of how the features outlined in
the design section are implemented in the ext2lib library. The aim of this section
is not to give a line-by-line account of the code, but to highlight important
sections and describe these in detail.
5.1 The Structure of the Source Code
The source code is structured by layer and by task. The source file names
are prefixed with either L0, L1 or L2 representing source for layer 0, 1 and 2
respectively. The rest of the filename indicates the task carried out by the
functions within that file. Each c source file (.c) has an accompanying header (.h)
file. A brief description of each is shown below:
·
=L0-dskio.c - Low level disk access routines
·
=L0-part.c - Routines for handling the partition tables
·
=L0-logic.c - The logical sector reading routine
·
=L1-sblk.c - Routines to handle the superblock
·
=L1-gpdes.c - Routines for handling the group descriptors
·
=L1-inode.c - Routines for reading and handling inodes
·
=L1-dir.c - Routines to read a directory listing and handle path to inode
conversion
·
=L1-copy.c - Routine to copy a file from the ext2 filesystem to the DOS
filesystem
·
=L1-funcs.c - Routines used by numerous L1 functions, including the
ReadBlock function
·
=L2-mount.c - The mount and part command routines
·
=L2-cd.c - The cd command routine.
·
=L2-ls.c - The ls command routine.
·
=L2-cp.c - The cp command routine.
·
=Libmain.c - The libmain initialisation function.
·
=Layer_0.h - The data types, prototypes and definitions that are exported from
layer 0 to layer 1
·
=Layer_1.h - The data types, prototypes and definitions that are exported from
layer 1 to layer 2
·
=Ext2lib.h - The data types, prototypes and definitions that are exported to the
calling application from the ext2lib library
·
=Ext2_fs.h - The definitions and data structures for the ext2 filesystem.
Some of the types and macro definitions from windows.h are used.
None of the header files from a given layer are allowed to be included by
source files from another layer to maintain the integrity of the three layer