1 #ifndef __MFS_CONST_H__ 2 #define __MFS_CONST_H__ 3 4 /* Tables sizes */ 5 #define V2_NR_DZONES 7 /* # direct zone numbers in a V2 inode */ 6 #define V2_NR_TZONES 10 /* total # zone numbers in a V2 inode */ 7 8 #define NR_INODES 512 /* # slots in "in core" inode table, 9 * should be more or less the same as 10 * NR_VNODES in vfs 11 */ 12 13 #define INODE_HASH_LOG2 7 /* 2 based logarithm of the inode hash size */ 14 #define INODE_HASH_SIZE ((unsigned long)1<<INODE_HASH_LOG2) 15 #define INODE_HASH_MASK (((unsigned long)1<<INODE_HASH_LOG2)-1) 16 17 /* Max. filename length */ 18 #define MFS_NAME_MAX MFS_DIRSIZ 19 20 21 /* The type of sizeof may be (unsigned) long. Use the following macro for 22 * taking the sizes of small objects so that there are no surprises like 23 * (small) long constants being passed to routines expecting an int. 24 */ 25 #define usizeof(t) ((unsigned) sizeof(t)) 26 27 /* File system types. */ 28 #define SUPER_MAGIC 0x137F /* magic number contained in super-block */ 29 #define SUPER_REV 0x7F13 /* magic # when 68000 disk read on PC or vv */ 30 #define SUPER_V2 0x2468 /* magic # for V2 file systems */ 31 #define SUPER_V2_REV 0x6824 /* V2 magic written on PC, read on 68K or vv */ 32 #define SUPER_V3 0x4d5a /* magic # for V3 file systems */ 33 34 #define V2 2 /* version number of V2 file systems */ 35 #define V3 3 /* version number of V3 file systems */ 36 37 /* Miscellaneous constants */ 38 #define SU_UID ((uid_t) 0) /* super_user's uid_t */ 39 40 #define NO_BIT ((bit_t) 0) /* returned by alloc_bit() to signal failure */ 41 42 #define LOOK_UP 0 /* tells search_dir to lookup string */ 43 #define ENTER 1 /* tells search_dir to make dir entry */ 44 #define DELETE 2 /* tells search_dir to delete entry */ 45 #define IS_EMPTY 3 /* tells search_dir to ret. OK or ENOTEMPTY */ 46 47 /* write_map() args */ 48 #define WMAP_FREE (1 << 0) 49 50 #define IGN_PERM 0 51 #define CHK_PERM 1 52 53 #define IN_CLEAN 0 /* in-block inode and memory copies identical */ 54 #define IN_DIRTY 1 /* in-block inode and memory copies differ */ 55 #define ATIME 002 /* set if atime field needs updating */ 56 #define CTIME 004 /* set if ctime field needs updating */ 57 #define MTIME 010 /* set if mtime field needs updating */ 58 59 #define BYTE_SWAP 0 /* tells conv2/conv4 to swap bytes */ 60 61 #define END_OF_FILE (-104) /* eof detected */ 62 63 #define ROOT_INODE ((ino_t) 1) /* inode number for root directory */ 64 #define BOOT_BLOCK ((block_t) 0) /* block number of boot block */ 65 #define SUPER_BLOCK_BYTES (1024) /* bytes offset */ 66 #define START_BLOCK ((block_t) 2) /* first block of FS (not counting SB) */ 67 68 #define DIR_ENTRY_SIZE usizeof (struct direct) /* # bytes/dir entry */ 69 #define NR_DIR_ENTRIES(b) ((b)/DIR_ENTRY_SIZE) /* # dir entries/blk */ 70 #define SUPER_SIZE usizeof (struct super_block) /* super_block size */ 71 72 #define FS_BITMAP_CHUNKS(b) ((b)/usizeof (bitchunk_t))/* # map chunks/blk */ 73 #define FS_BITCHUNK_BITS (usizeof(bitchunk_t) * CHAR_BIT) 74 #define FS_BITS_PER_BLOCK(b) (FS_BITMAP_CHUNKS(b) * FS_BITCHUNK_BITS) 75 76 /* Derived sizes pertaining to the V2 file system. */ 77 #define V2_ZONE_NUM_SIZE usizeof (zone_t) /* # bytes in V2 zone */ 78 #define V2_INODE_SIZE usizeof (d2_inode) /* bytes in V2 dsk ino */ 79 #define V2_INDIRECTS(b) ((b)/V2_ZONE_NUM_SIZE) /* # zones/indir block */ 80 #define V2_INODES_PER_BLOCK(b) ((b)/V2_INODE_SIZE)/* # V2 dsk inodes/blk */ 81 82 #define NUL(str,l,m) mfs_nul_f(__FILE__,__LINE__,(str), (l), (m)) 83 84 #endif 85 86