const.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef __MFS_CONST_H__
  2. #define __MFS_CONST_H__
  3. /* Tables sizes */
  4. #define V2_NR_DZONES 7 /* # direct zone numbers in a V2 inode */
  5. #define V2_NR_TZONES 10 /* total # zone numbers in a V2 inode */
  6. #define NR_INODES 512 /* # slots in "in core" inode table,
  7. * should be more or less the same as
  8. * NR_VNODES in vfs
  9. */
  10. #define INODE_HASH_LOG2 7 /* 2 based logarithm of the inode hash size */
  11. #define INODE_HASH_SIZE ((unsigned long)1<<INODE_HASH_LOG2)
  12. #define INODE_HASH_MASK (((unsigned long)1<<INODE_HASH_LOG2)-1)
  13. /* Max. filename length */
  14. #define MFS_NAME_MAX MFS_DIRSIZ
  15. /* File system types. */
  16. #define SUPER_MAGIC 0x137F /* magic number contained in super-block */
  17. #define SUPER_REV 0x7F13 /* magic # when 68000 disk read on PC or vv */
  18. #define SUPER_V2 0x2468 /* magic # for V2 file systems */
  19. #define SUPER_V2_REV 0x6824 /* V2 magic written on PC, read on 68K or vv */
  20. #define SUPER_V3 0x4d5a /* magic # for V3 file systems */
  21. #define V2 2 /* version number of V2 file systems */
  22. #define V3 3 /* version number of V3 file systems */
  23. /* Miscellaneous constants */
  24. #define NO_BIT ((bit_t) 0) /* returned by alloc_bit() to signal failure */
  25. #define LOOK_UP 0 /* tells search_dir to lookup string */
  26. #define ENTER 1 /* tells search_dir to make dir entry */
  27. #define DELETE 2 /* tells search_dir to delete entry */
  28. #define IS_EMPTY 3 /* tells search_dir to ret. OK or ENOTEMPTY */
  29. /* write_map() args */
  30. #define WMAP_FREE (1 << 0)
  31. #define IN_CLEAN 0 /* in-block inode and memory copies identical */
  32. #define IN_DIRTY 1 /* in-block inode and memory copies differ */
  33. #define ATIME 002 /* set if atime field needs updating */
  34. #define CTIME 004 /* set if ctime field needs updating */
  35. #define MTIME 010 /* set if mtime field needs updating */
  36. #define ROOT_INODE ((ino_t) 1) /* inode number for root directory */
  37. #define BOOT_BLOCK ((block_t) 0) /* block number of boot block */
  38. #define SUPER_BLOCK_BYTES (1024) /* bytes offset */
  39. #define START_BLOCK ((block_t) 2) /* first block of FS (not counting SB) */
  40. #define DIR_ENTRY_SIZE sizeof (struct direct) /* # bytes/dir entry */
  41. #define NR_DIR_ENTRIES(b) ((b)/DIR_ENTRY_SIZE) /* # dir entries/blk */
  42. #define SUPER_SIZE sizeof (struct super_block) /* super_block size */
  43. #define FS_BITMAP_CHUNKS(b) ((b)/sizeof (bitchunk_t))/* # map chunks/blk */
  44. #define FS_BITCHUNK_BITS (sizeof(bitchunk_t) * CHAR_BIT)
  45. #define FS_BITS_PER_BLOCK(b) (FS_BITMAP_CHUNKS(b) * FS_BITCHUNK_BITS)
  46. /* Derived sizes pertaining to the V2 file system. */
  47. #define V2_ZONE_NUM_SIZE sizeof (zone_t) /* # bytes in V2 zone */
  48. #define V2_INODE_SIZE sizeof (d2_inode) /* bytes in V2 dsk ino */
  49. #define V2_INDIRECTS(b) ((b)/V2_ZONE_NUM_SIZE) /* # zones/indir block */
  50. #define V2_INODES_PER_BLOCK(b) ((b)/V2_INODE_SIZE)/* # V2 dsk inodes/blk */
  51. #endif