1 #ifndef __MFS_CONST_H__
2 #define __MFS_CONST_H__
5 #define V1_NR_DZONES 7 /* # direct zone numbers in a V1 inode */
6 #define V1_NR_TZONES 9 /* total # zone numbers in a V1 inode */
7 #define V2_NR_DZONES 7 /* # direct zone numbers in a V2 inode */
8 #define V2_NR_TZONES 10 /* total # zone numbers in a V2 inode */
10 #define NR_INODES 256 /* # slots in "in core" inode table */
11 #define GETDENTS_BUFSIZ 257
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)
18 /* The type of sizeof may be (unsigned) long. Use the following macro for
19 * taking the sizes of small objects so that there are no surprises like
20 * (small) long constants being passed to routines expecting an int.
22 #define usizeof(t) ((unsigned) sizeof(t))
24 /* File system types. */
25 #define SUPER_MAGIC 0x137F /* magic number contained in super-block */
26 #define SUPER_REV 0x7F13 /* magic # when 68000 disk read on PC or vv */
27 #define SUPER_V2 0x2468 /* magic # for V2 file systems */
28 #define SUPER_V2_REV 0x6824 /* V2 magic written on PC, read on 68K or vv */
29 #define SUPER_V3 0x4d5a /* magic # for V3 file systems */
31 #define V1 1 /* version number of V1 file systems */
32 #define V2 2 /* version number of V2 file systems */
33 #define V3 3 /* version number of V3 file systems */
35 /* Miscellaneous constants */
36 #define SU_UID ((uid_t) 0) /* super_user's uid_t */
37 #define NORMAL 0 /* forces get_block to do disk read */
38 #define NO_READ 1 /* prevents get_block from doing disk read */
39 #define PREFETCH 2 /* tells get_block not to read or mark dev */
41 #define NO_BIT ((bit_t) 0) /* returned by alloc_bit() to signal failure */
43 #define LOOK_UP 0 /* tells search_dir to lookup string */
44 #define ENTER 1 /* tells search_dir to make dir entry */
45 #define DELETE 2 /* tells search_dir to delete entry */
46 #define IS_EMPTY 3 /* tells search_dir to ret. OK or ENOTEMPTY */
48 /* write_map() args */
49 #define WMAP_FREE (1 << 0)
54 #define CLEAN 0 /* disk and memory copies identical */
55 #define DIRTY 1 /* disk and memory copies differ */
56 #define ATIME 002 /* set if atime field needs updating */
57 #define CTIME 004 /* set if ctime field needs updating */
58 #define MTIME 010 /* set if mtime field needs updating */
60 #define BYTE_SWAP 0 /* tells conv2/conv4 to swap bytes */
62 #define END_OF_FILE (-104) /* eof detected */
64 #define ROOT_INODE ((ino_t) 1) /* inode number for root directory */
65 #define BOOT_BLOCK ((block_t) 0) /* block number of boot block */
66 #define SUPER_BLOCK_BYTES (1024) /* bytes offset */
67 #define START_BLOCK ((block_t) 2) /* first block of FS (not counting SB) */
69 #define DIR_ENTRY_SIZE usizeof (struct direct) /* # bytes/dir entry */
70 #define NR_DIR_ENTRIES(b) ((b)/DIR_ENTRY_SIZE) /* # dir entries/blk */
71 #define SUPER_SIZE usizeof (struct super_block) /* super_block size */
73 #define FS_BITMAP_CHUNKS(b) ((b)/usizeof (bitchunk_t))/* # map chunks/blk */
74 #define FS_BITCHUNK_BITS (usizeof(bitchunk_t) * CHAR_BIT)
75 #define FS_BITS_PER_BLOCK(b) (FS_BITMAP_CHUNKS(b) * FS_BITCHUNK_BITS)
77 /* Derived sizes pertaining to the V1 file system. */
78 #define V1_ZONE_NUM_SIZE usizeof (zone1_t) /* # bytes in V1 zone */
79 #define V1_INODE_SIZE usizeof (d1_inode) /* bytes in V1 dsk ino */
81 /* # zones/indir block */
82 #define V1_INDIRECTS (_STATIC_BLOCK_SIZE/V1_ZONE_NUM_SIZE)
84 /* # V1 dsk inodes/blk */
85 #define V1_INODES_PER_BLOCK (_STATIC_BLOCK_SIZE/V1_INODE_SIZE)
87 /* Derived sizes pertaining to the V2 file system. */
88 #define V2_ZONE_NUM_SIZE usizeof (zone_t) /* # bytes in V2 zone */
89 #define V2_INODE_SIZE usizeof (d2_inode) /* bytes in V2 dsk ino */
90 #define V2_INDIRECTS(b) ((b)/V2_ZONE_NUM_SIZE) /* # zones/indir block */
91 #define V2_INODES_PER_BLOCK(b) ((b)/V2_INODE_SIZE)/* # V2 dsk inodes/blk */
93 #define NUL(str,l,m) mfs_nul_f(__FILE__,__LINE__,(str), (l), (m))
95 /* Args to dev_bio/dev_io */
96 #define MFS_DEV_READ 10001
97 #define MFS_DEV_WRITE 10002
98 #define MFS_DEV_SCATTER 10003
99 #define MFS_DEV_GATHER 10004