Welcome to lread/ldir!

This program was written for an Operating Systems class at Willamette
University in Salem, Oregon, USA.  It is a DOS program (though it has
been shown to work under Linux) which reads the Linux ext2 filesystem.


USAGE

The usage is as follows:

ldir /any/Linux/path
          and
lread /any/Linux/path[/filename] [savefile]

where bracketed items are optional.

Ldir will printout something akin to a "ls -l" for the given directory.  It
always outputs to stdout.  Lread will print actual files.  It will print to
stdout unless a savefile is given in which case it will save that file on
the DOS filesystem.  If lread is given a directory name instead of a file
name, it will display or save a dump of the directory.  We consider the
capability to both "dir" and "read" a directory a feature.


LDIR/LREAD DIFFERENCES

As you can tell by viewing the code, the only difference between ldir and
lread is the filename.  The program does a quick check of argv[0] and reacts
based on the name of the called program.  Under Linux you can simply link
ldir to lread, but under DOS you must make a full copy of the file.  So 
compile the code to be either lread or ldir and copy the other.


COMPILING TIPS

When you compile the code under DOS be sure to use the Compact memory model
or larger.  64K of data space is not enough for parsing large directories. 
Super-large directories still cause problems under DOS.


PROGRAM OPERATION

The program works by first reading the data about the hard drive in the
partition table.  It finds the first Linux partition on the first hard drive
(if you have more than one, change the code... we're graduating and done
with this at least for a while!).  It uses the drive specifications it finds
in the table to enable DOS to use BIOS calls to read outside the DOS
partition.

Using this capability, the program finds the inode of the first parameter
(kind of like performing a mini "stat" under DOS).  It chases down the path
piece by piece to find the inode of the last part.  It begins at the rood
directory (inode 2), loads that directory, and then scans it for the inode
corresponding to the next piece of the path.  It stops when it has resolved
the full path or hits a softlink or filename in the middle of the path.  (If
you care to allow it to follow softlinks, be my guest.  Please see my email
address below as a contact point.)

With this inode the program can follow the file block by block--through the
single indirect, double indirect, and triple indirect pointers.  After
reading each block it either displays it or writes it to a file.

When everything has finished the program reports any errors encountered or
the fact that no errors were found.  On ldir it only reports problems.

There is a list of problems and things to work on in main.c.  If you have
skills and interest, feel free to tackle some code modifications.  For at
least the near future work is keeping me too busy to continue working on
this.  Please report bugs and comments to the addresses below.


THE GOOD-BYE

Keep in touch on email!

jhunter@willamette.edu
jhunter@engr.sgi.com
dlutz@willamette.edu

Jason and Dave
