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 512 /* # slots in "in core" inode table,
11 * should be more or less the same as
14 #define GETDENTS_BUFSIZ 257
16 #define INODE_HASH_LOG2 7 /* 2 based logarithm of the inode hash size */
17 #define INODE_HASH_SIZE ((unsigned long)1<<INODE_HASH_LOG2)
18 #define INODE_HASH_MASK (((unsigned long)1<<INODE_HASH_LOG2)-1)
20 /* Max. filename length */
21 #define MFS_NAME_MAX MFS_DIRSIZ
24 /* The type of sizeof may be (unsigned) long. Use the following macro for
25 * taking the sizes of small objects so that there are no surprises like
26 * (small) long constants being passed to routines expecting an int.
28 #define usizeof(t) ((unsigned) sizeof(t))
30 /* File system types. */
31 #define SUPER_MAGIC 0x137F /* magic number contained in super-block */
32 #define SUPER_REV 0x7F13 /* magic # when 68000 disk read on PC or vv */
33 #define SUPER_V2 0x2468 /* magic # for V2 file systems */
34 #define SUPER_V2_REV 0x6824 /* V2 magic written on PC, read on 68K or vv */
35 #define SUPER_V3 0x4d5a /* magic # for V3 file systems */
37 #define V1 1 /* version number of V1 file systems */
38 #define V2 2 /* version number of V2 file systems */
39 #define V3 3 /* version number of V3 file systems */
41 /* Miscellaneous constants */
42 #define SU_UID ((uid_t) 0) /* super_user's uid_t */
43 #define NORMAL 0 /* forces get_block to do disk read */
44 #define NO_READ 1 /* prevents get_block from doing disk read */
45 #define PREFETCH 2 /* tells get_block not to read or mark dev */
47 #define NO_BIT ((uint32_t) 0) /* returned by alloc_bit() to signal failure */
49 #define LOOK_UP 0 /* tells search_dir to lookup string */
50 #define ENTER 1 /* tells search_dir to make dir entry */
51 #define DELETE 2 /* tells search_dir to delete entry */
52 #define IS_EMPTY 3 /* tells search_dir to ret. OK or ENOTEMPTY */
54 /* write_map() args */
55 #define WMAP_FREE (1 << 0)
60 #define BP_CLEAN 0 /* on-disk block and memory copies identical */
61 #define BP_DIRTY 1 /* on-disk block and memory copies differ */
62 #define IN_CLEAN 0 /* in-block inode and memory copies identical */
63 #define IN_DIRTY 1 /* in-block inode and memory copies differ */
64 #define ATIME 002 /* set if atime field needs updating */
65 #define CTIME 004 /* set if ctime field needs updating */
66 #define MTIME 010 /* set if mtime field needs updating */
68 #define BYTE_SWAP 0 /* tells conv2/conv4 to swap bytes */
70 #define END_OF_FILE (-104) /* eof detected */
72 #define ROOT_INODE ((ino_t) 1) /* inode number for root directory */
73 #define BOOT_BLOCK ((blkcnt_t) 0) /* block number of boot block */
74 #define SUPER_BLOCK_BYTES (1024) /* bytes offset */
75 #define START_BLOCK ((blkcnt_t) 2) /* first block of FS (not counting SB) */
77 #define DIR_ENTRY_SIZE usizeof (struct direct) /* # bytes/dir entry */
78 #define NR_DIR_ENTRIES(b) ((b)/DIR_ENTRY_SIZE) /* # dir entries/blk */
79 #define SUPER_SIZE usizeof (struct super_block) /* super_block size */
81 #define FS_BITMAP_CHUNKS(b) ((b)/usizeof (uint32_t))/* # map chunks/blk */
82 #define FS_BITCHUNK_BITS (usizeof(uint32_t) * CHAR_BIT)
83 #define FS_BITS_PER_BLOCK(b) (FS_BITMAP_CHUNKS(b) * FS_BITCHUNK_BITS)
85 /* Derived sizes pertaining to the V1 file system. */
86 #define V1_ZONE_NUM_SIZE usizeof (uint16_t) /* # bytes in V1 zone */
87 #define V1_INODE_SIZE usizeof (d1_inode) /* bytes in V1 dsk ino */
89 /* # zones/indir block */
90 #define V1_INDIRECTS (_STATIC_BLOCK_SIZE/V1_ZONE_NUM_SIZE)
92 /* # V1 dsk inodes/blk */
93 #define V1_INODES_PER_BLOCK (_STATIC_BLOCK_SIZE/V1_INODE_SIZE)
95 /* Derived sizes pertaining to the V2 file system. */
96 #define V2_ZONE_NUM_SIZE usizeof (uint32_t) /* # bytes in V2 zone */
97 #define V2_INODE_SIZE usizeof (d2_inode) /* bytes in V2 dsk ino */
98 #define V2_INDIRECTS(b) ((b)/V2_ZONE_NUM_SIZE) /* # zones/indir block */
99 #define V2_INODES_PER_BLOCK(b) ((b)/V2_INODE_SIZE)/* # V2 dsk inodes/blk */
101 #define NUL(str,l,m) mfs_nul_f(__FILE__,__LINE__,(str), (l), (m))
103 #define _STATIC_BLOCK_SIZE 1024
104 #define _MIN_BLOCK_SIZE 1024
105 #define _MAX_BLOCK_SIZE 4096