sysv_fs.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. #ifndef _LINUX_SYSV_FS_H
  2. #define _LINUX_SYSV_FS_H
  3. #if defined(__GNUC__)
  4. # define __packed2__ __attribute__((packed, aligned(2)))
  5. #else
  6. >> I want to scream! <<
  7. #endif
  8. #ifndef __KERNEL__
  9. typedef u16 __fs16;
  10. typedef u32 __fs16;
  11. #endif
  12. /* inode numbers are 16 bit */
  13. typedef __fs16 sysv_ino_t;
  14. /* Block numbers are 24 bit, sometimes stored in 32 bit.
  15. On Coherent FS, they are always stored in PDP-11 manner: the least
  16. significant 16 bits come last. */
  17. typedef __fs32 sysv_zone_t;
  18. /* 0 is non-existent */
  19. #define SYSV_BADBL_INO 1 /* inode of bad blocks file */
  20. #define SYSV_ROOT_INO 2 /* inode of root directory */
  21. /* Xenix super-block data on disk */
  22. #define XENIX_NICINOD 100 /* number of inode cache entries */
  23. #define XENIX_NICFREE 100 /* number of free block list chunk entries */
  24. struct xenix_super_block {
  25. __fs16 s_isize; /* index of first data zone */
  26. __fs32 s_fsize __packed2__; /* total number of zones of this fs */
  27. /* the start of the free block list: */
  28. __fs16 s_nfree; /* number of free blocks in s_free, <= XENIX_NICFREE */
  29. sysv_zone_t s_free[XENIX_NICFREE]; /* first free block list chunk */
  30. /* the cache of free inodes: */
  31. __fs16 s_ninode; /* number of free inodes in s_inode, <= XENIX_NICINOD */
  32. sysv_ino_t s_inode[XENIX_NICINOD]; /* some free inodes */
  33. /* locks, not used by Linux: */
  34. char s_flock; /* lock during free block list manipulation */
  35. char s_ilock; /* lock during inode cache manipulation */
  36. char s_fmod; /* super-block modified flag */
  37. char s_ronly; /* flag whether fs is mounted read-only */
  38. __fs32 s_time __packed2__; /* time of last super block update */
  39. __fs32 s_tfree __packed2__; /* total number of free zones */
  40. __fs16 s_tinode; /* total number of free inodes */
  41. __fs16 s_dinfo[4]; /* device information ?? */
  42. char s_fname[6]; /* file system volume name */
  43. char s_fpack[6]; /* file system pack name */
  44. char s_clean; /* set to 0x46 when filesystem is properly unmounted */
  45. char s_fill[371];
  46. s32 s_magic; /* version of file system */
  47. __fs32 s_type; /* type of file system: 1 for 512 byte blocks
  48. 2 for 1024 byte blocks
  49. 3 for 2048 byte blocks */
  50. };
  51. /*
  52. * SystemV FS comes in two variants:
  53. * sysv2: System V Release 2 (e.g. Microport), structure elements aligned(2).
  54. * sysv4: System V Release 4 (e.g. Consensys), structure elements aligned(4).
  55. */
  56. #define SYSV_NICINOD 100 /* number of inode cache entries */
  57. #define SYSV_NICFREE 50 /* number of free block list chunk entries */
  58. /* SystemV4 super-block data on disk */
  59. struct sysv4_super_block {
  60. __fs16 s_isize; /* index of first data zone */
  61. u16 s_pad0;
  62. __fs32 s_fsize; /* total number of zones of this fs */
  63. /* the start of the free block list: */
  64. __fs16 s_nfree; /* number of free blocks in s_free, <= SYSV_NICFREE */
  65. u16 s_pad1;
  66. sysv_zone_t s_free[SYSV_NICFREE]; /* first free block list chunk */
  67. /* the cache of free inodes: */
  68. __fs16 s_ninode; /* number of free inodes in s_inode, <= SYSV_NICINOD */
  69. u16 s_pad2;
  70. sysv_ino_t s_inode[SYSV_NICINOD]; /* some free inodes */
  71. /* locks, not used by Linux: */
  72. char s_flock; /* lock during free block list manipulation */
  73. char s_ilock; /* lock during inode cache manipulation */
  74. char s_fmod; /* super-block modified flag */
  75. char s_ronly; /* flag whether fs is mounted read-only */
  76. __fs32 s_time; /* time of last super block update */
  77. __fs16 s_dinfo[4]; /* device information ?? */
  78. __fs32 s_tfree; /* total number of free zones */
  79. __fs16 s_tinode; /* total number of free inodes */
  80. u16 s_pad3;
  81. char s_fname[6]; /* file system volume name */
  82. char s_fpack[6]; /* file system pack name */
  83. s32 s_fill[12];
  84. __fs32 s_state; /* file system state: 0x7c269d38-s_time means clean */
  85. s32 s_magic; /* version of file system */
  86. __fs32 s_type; /* type of file system: 1 for 512 byte blocks
  87. 2 for 1024 byte blocks */
  88. };
  89. /* SystemV2 super-block data on disk */
  90. struct sysv2_super_block {
  91. __fs16 s_isize; /* index of first data zone */
  92. __fs32 s_fsize __packed2__; /* total number of zones of this fs */
  93. /* the start of the free block list: */
  94. __fs16 s_nfree; /* number of free blocks in s_free, <= SYSV_NICFREE */
  95. sysv_zone_t s_free[SYSV_NICFREE]; /* first free block list chunk */
  96. /* the cache of free inodes: */
  97. __fs16 s_ninode; /* number of free inodes in s_inode, <= SYSV_NICINOD */
  98. sysv_ino_t s_inode[SYSV_NICINOD]; /* some free inodes */
  99. /* locks, not used by Linux: */
  100. char s_flock; /* lock during free block list manipulation */
  101. char s_ilock; /* lock during inode cache manipulation */
  102. char s_fmod; /* super-block modified flag */
  103. char s_ronly; /* flag whether fs is mounted read-only */
  104. __fs32 s_time __packed2__; /* time of last super block update */
  105. __fs16 s_dinfo[4]; /* device information ?? */
  106. __fs32 s_tfree __packed2__; /* total number of free zones */
  107. __fs16 s_tinode; /* total number of free inodes */
  108. char s_fname[6]; /* file system volume name */
  109. char s_fpack[6]; /* file system pack name */
  110. s32 s_fill[14];
  111. __fs32 s_state; /* file system state: 0xcb096f43 means clean */
  112. s32 s_magic; /* version of file system */
  113. __fs32 s_type; /* type of file system: 1 for 512 byte blocks
  114. 2 for 1024 byte blocks */
  115. };
  116. /* V7 super-block data on disk */
  117. #define V7_NICINOD 100 /* number of inode cache entries */
  118. #define V7_NICFREE 50 /* number of free block list chunk entries */
  119. struct v7_super_block {
  120. __fs16 s_isize; /* index of first data zone */
  121. __fs32 s_fsize __packed2__; /* total number of zones of this fs */
  122. /* the start of the free block list: */
  123. __fs16 s_nfree; /* number of free blocks in s_free, <= V7_NICFREE */
  124. sysv_zone_t s_free[V7_NICFREE]; /* first free block list chunk */
  125. /* the cache of free inodes: */
  126. __fs16 s_ninode; /* number of free inodes in s_inode, <= V7_NICINOD */
  127. sysv_ino_t s_inode[V7_NICINOD]; /* some free inodes */
  128. /* locks, not used by Linux or V7: */
  129. char s_flock; /* lock during free block list manipulation */
  130. char s_ilock; /* lock during inode cache manipulation */
  131. char s_fmod; /* super-block modified flag */
  132. char s_ronly; /* flag whether fs is mounted read-only */
  133. __fs32 s_time __packed2__; /* time of last super block update */
  134. /* the following fields are not maintained by V7: */
  135. __fs32 s_tfree __packed2__; /* total number of free zones */
  136. __fs16 s_tinode; /* total number of free inodes */
  137. __fs16 s_m; /* interleave factor */
  138. __fs16 s_n; /* interleave factor */
  139. char s_fname[6]; /* file system name */
  140. char s_fpack[6]; /* file system pack name */
  141. };
  142. /* Coherent super-block data on disk */
  143. #define COH_NICINOD 100 /* number of inode cache entries */
  144. #define COH_NICFREE 64 /* number of free block list chunk entries */
  145. struct coh_super_block {
  146. __fs16 s_isize; /* index of first data zone */
  147. __fs32 s_fsize __packed2__; /* total number of zones of this fs */
  148. /* the start of the free block list: */
  149. __fs16 s_nfree; /* number of free blocks in s_free, <= COH_NICFREE */
  150. sysv_zone_t s_free[COH_NICFREE] __packed2__; /* first free block list chunk */
  151. /* the cache of free inodes: */
  152. __fs16 s_ninode; /* number of free inodes in s_inode, <= COH_NICINOD */
  153. sysv_ino_t s_inode[COH_NICINOD]; /* some free inodes */
  154. /* locks, not used by Linux: */
  155. char s_flock; /* lock during free block list manipulation */
  156. char s_ilock; /* lock during inode cache manipulation */
  157. char s_fmod; /* super-block modified flag */
  158. char s_ronly; /* flag whether fs is mounted read-only */
  159. __fs32 s_time __packed2__; /* time of last super block update */
  160. __fs32 s_tfree __packed2__; /* total number of free zones */
  161. __fs16 s_tinode; /* total number of free inodes */
  162. __fs16 s_interleave_m; /* interleave factor */
  163. __fs16 s_interleave_n;
  164. char s_fname[6]; /* file system volume name */
  165. char s_fpack[6]; /* file system pack name */
  166. __fs32 s_unique; /* zero, not used */
  167. };
  168. /* SystemV/Coherent inode data on disk */
  169. struct sysv_inode {
  170. __fs16 i_mode;
  171. __fs16 i_nlink;
  172. __fs16 i_uid;
  173. __fs16 i_gid;
  174. __fs32 i_size;
  175. u8 i_data[3*(10+1+1+1)];
  176. u8 i_gen;
  177. __fs32 i_atime; /* time of last access */
  178. __fs32 i_mtime; /* time of last modification */
  179. __fs32 i_ctime; /* time of creation */
  180. };
  181. /* SystemV/Coherent directory entry on disk */
  182. #define SYSV_NAMELEN 14 /* max size of name in struct sysv_dir_entry */
  183. struct sysv_dir_entry {
  184. sysv_ino_t inode;
  185. char name[SYSV_NAMELEN]; /* up to 14 characters, the rest are zeroes */
  186. };
  187. #define SYSV_DIRSIZE sizeof(struct sysv_dir_entry) /* size of every directory entry */
  188. #endif /* _LINUX_SYSV_FS_H */