UNIX Filesystem

Invariant base class for (almost?) all UNIX filesystems

Subclasses must provide three basic functions to read the superblock, an inode or a block.

Directory parseing may need overridden (ie: FFS)

Convenience functions provided for reading on disk structures (XXX: Should be made generic)

The Superblock must provide the following fields:

.fs_imax Highest inode number .fs_bmax Highest block number

Inodes must provide the following fields:

.di_db List of direct block-numbers .di_ib List of indirect, 2indir and 3indir block-numbers .di_mode for S_IFDIR and S_IFREG (using S_ISFMT mask)

Inodes can provide the following fields:

di_nlink Link count di_uid Owner user id di_gid Owner group id di_mtime Modification time (POSIX time_t)

FindUnixFs()

This class attempts to find any UNIX filesystems

The strategy is:

  1. Locate potential root inodes

  2. Eliminate non-sensical block-no byte orders

  3. Eliminate block-sizes which do not lead to credible root directory content.