1*433d6423SLionel Sambuc #ifndef __MFS_SUPER_H__ 2*433d6423SLionel Sambuc #define __MFS_SUPER_H__ 3*433d6423SLionel Sambuc 4*433d6423SLionel Sambuc /* Super block table. The root file system and every mounted file system 5*433d6423SLionel Sambuc * has an entry here. The entry holds information about the sizes of the bit 6*433d6423SLionel Sambuc * maps and inodes. The s_ninodes field gives the number of inodes available 7*433d6423SLionel Sambuc * for files and directories, including the root directory. Inode 0 is 8*433d6423SLionel Sambuc * on the disk, but not used. Thus s_ninodes = 4 means that 5 bits will be 9*433d6423SLionel Sambuc * used in the bit map, bit 0, which is always 1 and not used, and bits 1-4 10*433d6423SLionel Sambuc * for files and directories. The disk layout is: 11*433d6423SLionel Sambuc * 12*433d6423SLionel Sambuc * Item # blocks 13*433d6423SLionel Sambuc * boot block 1 14*433d6423SLionel Sambuc * super block 1 (offset 1kB) 15*433d6423SLionel Sambuc * inode map s_imap_blocks 16*433d6423SLionel Sambuc * zone map s_zmap_blocks 17*433d6423SLionel Sambuc * inodes (s_ninodes + 'inodes per block' - 1)/'inodes per block' 18*433d6423SLionel Sambuc * unused whatever is needed to fill out the current zone 19*433d6423SLionel Sambuc * data zones (s_zones - s_firstdatazone) << s_log_zone_size 20*433d6423SLionel Sambuc * 21*433d6423SLionel Sambuc * A super_block slot is free if s_dev == NO_DEV. 22*433d6423SLionel Sambuc */ 23*433d6423SLionel Sambuc 24*433d6423SLionel Sambuc EXTERN struct super_block { 25*433d6423SLionel Sambuc u32_t s_ninodes; /* # usable inodes on the minor device */ 26*433d6423SLionel Sambuc zone1_t s_nzones; /* total device size, including bit maps etc */ 27*433d6423SLionel Sambuc short s_imap_blocks; /* # of blocks used by inode bit map */ 28*433d6423SLionel Sambuc short s_zmap_blocks; /* # of blocks used by zone bit map */ 29*433d6423SLionel Sambuc zone1_t s_firstdatazone_old; /* number of first data zone (small) */ 30*433d6423SLionel Sambuc short s_log_zone_size; /* log2 of blocks/zone */ 31*433d6423SLionel Sambuc unsigned short s_flags; /* FS state flags */ 32*433d6423SLionel Sambuc i32_t s_max_size; /* maximum file size on this device */ 33*433d6423SLionel Sambuc zone_t s_zones; /* number of zones (replaces s_nzones in V2) */ 34*433d6423SLionel Sambuc short s_magic; /* magic number to recognize super-blocks */ 35*433d6423SLionel Sambuc 36*433d6423SLionel Sambuc /* The following items are valid on disk only for V3 and above */ 37*433d6423SLionel Sambuc 38*433d6423SLionel Sambuc short s_pad2; /* try to avoid compiler-dependent padding */ 39*433d6423SLionel Sambuc unsigned short s_block_size; /* block size in bytes. */ 40*433d6423SLionel Sambuc char s_disk_version; /* filesystem format sub-version */ 41*433d6423SLionel Sambuc 42*433d6423SLionel Sambuc /* The following items are only used when the super_block is in memory. 43*433d6423SLionel Sambuc * If this ever changes, i.e. more fields after s_disk_version has to go to 44*433d6423SLionel Sambuc * disk, update LAST_ONDISK_FIELD in super.c as that controls which part of the 45*433d6423SLionel Sambuc * struct is copied to and from disk. 46*433d6423SLionel Sambuc */ 47*433d6423SLionel Sambuc 48*433d6423SLionel Sambuc /*struct inode *s_isup;*/ /* inode for root dir of mounted file sys */ 49*433d6423SLionel Sambuc /*struct inode *s_imount;*/ /* inode mounted on */ 50*433d6423SLionel Sambuc unsigned s_inodes_per_block; /* precalculated from magic number */ 51*433d6423SLionel Sambuc zone_t s_firstdatazone; /* number of first data zone (big) */ 52*433d6423SLionel Sambuc dev_t s_dev; /* whose super block is this? */ 53*433d6423SLionel Sambuc int s_rd_only; /* set to 1 iff file sys mounted read only */ 54*433d6423SLionel Sambuc int s_native; /* set to 1 iff not byte swapped file system */ 55*433d6423SLionel Sambuc int s_version; /* file system version, zero means bad magic */ 56*433d6423SLionel Sambuc int s_ndzones; /* # direct zones in an inode */ 57*433d6423SLionel Sambuc int s_nindirs; /* # indirect zones per indirect block */ 58*433d6423SLionel Sambuc bit_t s_isearch; /* inodes below this bit number are in use */ 59*433d6423SLionel Sambuc bit_t s_zsearch; /* all zones below this bit number are in use*/ 60*433d6423SLionel Sambuc } superblock; 61*433d6423SLionel Sambuc 62*433d6423SLionel Sambuc #define IMAP 0 /* operating on the inode bit map */ 63*433d6423SLionel Sambuc #define ZMAP 1 /* operating on the zone bit map */ 64*433d6423SLionel Sambuc 65*433d6423SLionel Sambuc /* s_flags contents; undefined flags are guaranteed to be zero on disk 66*433d6423SLionel Sambuc * (not counting future versions of mfs setting them!) 67*433d6423SLionel Sambuc */ 68*433d6423SLionel Sambuc #define MFSFLAG_CLEAN (1L << 0) /* 0: dirty; 1: FS was unmounted cleanly */ 69*433d6423SLionel Sambuc 70*433d6423SLionel Sambuc /* Future compatability (or at least, graceful failure): 71*433d6423SLionel Sambuc * if any of these bits are on, and the MFS or fsck 72*433d6423SLionel Sambuc * implementation doesn't understand them, do not mount/fsck 73*433d6423SLionel Sambuc * the FS. 74*433d6423SLionel Sambuc */ 75*433d6423SLionel Sambuc #define MFSFLAG_MANDATORY_MASK 0xff00 76*433d6423SLionel Sambuc 77*433d6423SLionel Sambuc #endif 78*433d6423SLionel Sambuc 79