xref: /minix/minix/usr.sbin/mkfs.mfs/v3/const.h (revision 83133719)
1 #ifndef _MKFS_MFS_CONST_H__
2 #define _MKFS_MFS_CONST_H__
3 
4 /* Tables sizes */
5 #define NR_DZONES       7	/* # direct zone numbers in a V2 inode */
6 #define NR_TZONES      10	/* total # zone numbers in a V2 inode */
7 
8 #define MIN_BLOCK_SIZE		1024
9 #define DEFAULT_BLOCK_SIZE	4096
10 
11 /* The type of sizeof may be (unsigned) long.  Use the following macro for
12  * taking the sizes of small objects so that there are no surprises like
13  * (small) long constants being passed to routines expecting an int.
14  */
15 #define usizeof(t) ((unsigned) sizeof(t))
16 
17 /* File system types: magic number contained in super-block. */
18 #define SUPER_V3      0x4d5a	/* magic # for V3 file systems */
19 #define SUPER_MAGIC	SUPER_V3
20 
21 /* Miscellaneous constants */
22 #define SU_UID		 ((uid_t) 0)	/* super_user's uid_t */
23 #define SECTOR_SIZE	512
24 
25 #define ROOT_INODE	((ino_t) 1)	/* inode number for root directory */
26 
27 #define BOOT_BLOCK	((blkcnt_t) 0)	/* block number of boot block */
28 #define SUPER_BLOCK_BYTES  (1024)	/* bytes offset */
29 #define START_BLOCK	((blkcnt_t) 2)	/* first block of FS (not counting SB) */
30 
31 #define FS_BITMAP_CHUNKS(b)	((b)/usizeof(bitchunk_t)) /*# map chunks/blk*/
32 #define FS_BITCHUNK_BITS	(usizeof(bitchunk_t) * CHAR_BIT)
33 #define FS_BITS_PER_BLOCK(b)	(FS_BITMAP_CHUNKS(b) * FS_BITCHUNK_BITS)
34 
35 /* Derived sizes pertaining to the file system. */
36 #define ZONE_NUM_SIZE		usizeof (zone_t)  /* # bytes in zone */
37 #define INODE_SIZE		usizeof (struct inode)  /* bytes in dsk ino */
38 #define INDIRECTS(b)		((b)/ZONE_NUM_SIZE)  /* # zones/indir block */
39 #define INODES_PER_BLOCK(b)	((b)/INODE_SIZE)  /* # V2 dsk inodes/blk */
40 
41 #define DIR_ENTRY_SIZE		usizeof(struct direct) /* # bytes/dir entry */
42 #define NR_DIR_ENTRIES(b)	((b)/DIR_ENTRY_SIZE)  /* # dir entries/blk  */
43 #endif
44