|
|
1.1 ! root 1: /* ! 2: * minimal definitions of 4BSD `fast file system' format ! 3: * just enough to read a disk volume ! 4: */ ! 5: ! 6: #define SBLOCK 8192 /* byte offset to (first) super-block */ ! 7: #define SBSIZE 8192 /* size of super-block */ ! 8: ! 9: /* ! 10: * contents of super-block ! 11: */ ! 12: ! 13: struct fs ! 14: { ! 15: struct fs *fs_link; /* linked list of file systems */ ! 16: struct fs *fs_rlink; /* used for incore super blocks */ ! 17: long fs_sblkno; /* addr of super-block in filesys */ ! 18: long fs_cblkno; /* offset of cyl-block in filesys */ ! 19: long fs_iblkno; /* offset of inode-blocks in filesys */ ! 20: long fs_dblkno; /* offset of first data after cg */ ! 21: long fs_cgoffset; /* cylinder group offset in cylinder */ ! 22: long fs_cgmask; /* used to calc mod fs_ntrak */ ! 23: long fs_time; /* last time written */ ! 24: long fs_size; /* number of blocks in fs */ ! 25: long fs_dsize; /* number of data blocks in fs */ ! 26: long fs_ncg; /* number of cylinder groups */ ! 27: long fs_bsize; /* size of basic blocks in fs */ ! 28: long fs_fsize; /* size of frag blocks in fs */ ! 29: long fs_frag; /* number of frags in a block in fs */ ! 30: /* these are configuration parameters */ ! 31: long fs_minfree; /* minimum percentage of free blocks */ ! 32: long fs_rotdelay; /* num of ms for optimal next block */ ! 33: long fs_rps; /* disk revolutions per second */ ! 34: /* these fields can be computed from the others */ ! 35: long fs_bmask; /* ``blkoff'' calc of blk offsets */ ! 36: long fs_fmask; /* ``fragoff'' calc of frag offsets */ ! 37: long fs_bshift; /* ``lblkno'' calc of logical blkno */ ! 38: long fs_fshift; /* ``numfrags'' calc number of frags */ ! 39: /* these are configuration parameters */ ! 40: long fs_maxcontig; /* max number of contiguous blks */ ! 41: long fs_maxbpg; /* max number of blks per cyl group */ ! 42: /* these fields can be computed from the others */ ! 43: long fs_fragshift; /* block to frag shift */ ! 44: long fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ ! 45: long fs_sbsize; /* actual size of super block */ ! 46: long fs_csmask; /* csum block offset */ ! 47: long fs_csshift; /* csum block number */ ! 48: long fs_nindir; /* value of NINDIR */ ! 49: long fs_inopb; /* value of INOPB */ ! 50: long fs_nspf; /* value of NSPF */ ! 51: long fs_optim; /* optimization preference, see below */ ! 52: long fs_sparecon[5]; /* reserved for future constants */ ! 53: /* sizes determined by number of cylinder groups and their sizes */ ! 54: long fs_csaddr; /* blk addr of cyl grp summary area */ ! 55: long fs_cssize; /* size of cyl grp summary area */ ! 56: long fs_cgsize; /* cylinder group size */ ! 57: /* these fields should be derived from the hardware */ ! 58: long fs_ntrak; /* tracks per cylinder */ ! 59: long fs_nsect; /* sectors per track */ ! 60: long fs_spc; /* sectors per cylinder */ ! 61: /* this comes from the disk driver partitioning */ ! 62: long fs_ncyl; /* cylinders in file system */ ! 63: /* these fields can be computed from the others */ ! 64: long fs_cpg; /* cylinders per group */ ! 65: long fs_ipg; /* inodes per group */ ! 66: long fs_fpg; /* blocks per group * fs_frag */ ! 67: #if NOTDEF /* what follows isn't interesting */ ! 68: /* this data must be re-computed after crashes */ ! 69: struct csum fs_cstotal; /* cylinder summary information */ ! 70: /* these fields are cleared at mount time */ ! 71: char fs_fmod; /* super block modified flag */ ! 72: char fs_clean; /* file system is clean flag */ ! 73: char fs_ronly; /* mounted read-only flag */ ! 74: char fs_flags; /* currently unused flag */ ! 75: char fs_fsmnt[MAXMNTLEN]; /* name mounted on */ ! 76: /* these fields retain the current block allocation info */ ! 77: long fs_cgrotor; /* last cg searched */ ! 78: struct csum *fs_csp[MAXCSBUFS];/* list of fs_cs info buffers */ ! 79: long fs_cpc; /* cyl per cycle in postbl */ ! 80: short fs_postbl[MAXCPG][NRPOS];/* head of blocks for each rotation */ ! 81: long fs_magic; /* magic number */ ! 82: u_char fs_rotbl[1]; /* list of blocks for each rotation */ ! 83: /* actually longer */ ! 84: #endif ! 85: }; ! 86: ! 87: #define INOSIZE 128 /* length of inode on disk */ ! 88: ! 89: #define NDADDR 12 ! 90: #define NIADDR 3 ! 91: ! 92: /* ! 93: * inode on disk ! 94: */ ! 95: ! 96: struct icommon ! 97: { ! 98: short i_mode; /* 0: mode and type of file */ ! 99: short i_nlink; /* 2: number of links to file */ ! 100: short i_uid; /* 4: owner's user id */ ! 101: short i_gid; /* 6: owner's group id */ ! 102: long i_size; /* 8: number of bytes in file */ ! 103: long i_hisize; /* 12: high part of 64-byte size */ ! 104: long i_atime; /* 16: time last accessed */ ! 105: long i_atspare; ! 106: long i_mtime; /* 24: time last modified */ ! 107: long i_mtspare; ! 108: long i_ctime; /* 32: last time inode changed */ ! 109: long i_ctspare; ! 110: long i_db[NDADDR]; /* 40: disk block addresses */ ! 111: long i_ib[NIADDR]; /* 88: indirect blocks */ ! 112: long i_flags; /* 100: status, currently unused */ ! 113: long i_blocks; /* 104: blocks actually held */ ! 114: long i_spare[5]; /* 108: reserved, currently unused */ ! 115: }; ! 116: ! 117: #define ROOTINO 2 ! 118: ! 119: /* ! 120: * directory format ! 121: */ ! 122: ! 123: #define MAXNAMLEN 255 ! 124: ! 125: struct direct { ! 126: long d_ino; /* inode number of entry */ ! 127: unsigned short d_reclen; /* length of this record */ ! 128: unsigned short d_namlen; /* length of string in d_name */ ! 129: char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */ ! 130: }; ! 131: ! 132: #define DIRSIZ(dp) \ ! 133: ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.