Listing 7
#
# ----- S51K FILESYSTEM STRUCTURE TRANSLATION -------------------------------
# Copyright 1992, Chris Hare
#
# AT&T S51K Superblock
#
# NOTES:
# ushort unsigned short
# daddr_t long
# time_t long
# ushort s_isize; /* size in blocks of i-list */
# daddr_t s_fsize; /* size in blocks of entire volume */
# short s_nfree; /* number of addresses in s_free */
# daddr_t s_free[NICFREE];/* free block list */
# short s_ninode; /* number of i-nodes in s_inode */
# ushort s_inode[NICINOD];/* free i-node list */
# char s_flock; /* lock during free list manipulation */
# char s_ilock; /* lock during i-list manipulation */
# char s_fmod; /* super block modified flag */
# char s_ronly; /* mounted read-only flag */
# time_t s_time; /* last super block update */
# short s_dinfo[4]; /* device information */
# daddr_t s_tfree; /* total free blocks*/
# ushort s_tinode; /* total free inodes */
# char s_fname[6]; /* file system name */
# char s_fpack[6]; /* file system pack name */
# long s_fill[14]; /* adjust to make sizeof filsys be 512 */
# long s_state; /* file system state */
# long s_magic; /* magic number to indicate new file system */
# long s_type; /* type of new file system */
#
$NICFREE = 50;
$NICINOD = 100;
#
# There are four bytes in a long ...
#
$A_NICFREE = $NICFREE * 4;
#
# and two bytes in a short ...
#
$A_NICINOD = $NICINOD * 2;
#
# This is the actual translation of the S51K filesystem structure
# (there was a lot of pain in the translation ...)
#
$S51K = "S l s A$A_NICFREE s A$A_NICINOD c c c c l A8 l S a6 a6 A56 l l l";
#
# and these structures will unpack the Free Block List, and the Free Inode
# List
# ( some pain in these too ...)
#
$S51K_s_free = "l$NICFREE";
$S51K_s_inode = "S$NICINOD";
1;
|