Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
70
19. Appendix E:
20. Programmers Implementation Guide
20.1 Introduction
This guide is intended to provide an outline for programmers wishing to
use the ext2lib library to incorporate ext2 file reading capabilities into an
application. It provides an outline of how to implement each of the exported
functions in a target application, and example code in C is given.
Included with the ext2lib library are two header files that contain
definitions, data structures and types and function prototypes for the library.
These are:
·
=Ext2lib.h - Header information for the ext2lib library
·
=Ext2_fs.h - Linux source file containing header information for the ext2
filesystem. © Remy Card
Also an import library ext2lib.lib is included. Some of the types defined in
windows.h are used in the example code.
The library provides two commands that are used in the process of
mounting a filesystem. The first is get_part_info, which is used to return partition
information for the disks connected to the PC. This is used to inform the user of
the moutable partitions. The next function used ion the process is the actual
ext2_mount_fs function. This is used to actually mount the partition.
Once the partition has been mounted, four functions control the manipulation of
the filesystem. These are the commands ext2_ls, ext2_cd and ext2_cp which
perform the functions that would be expected of the ls, cd and cp commands at a
command line. A function called ext2_get_inode is also included. This is used to
retrieve the inode for a specified file.
20.2 Implementing the get_part_info Function
PARTINFO FAR PASCAL get_part_info(void);
This function accepts no arguments, and returns a small structure with the
type, PARTINFO. This is defined in ext2lib.h: