ufs_fs.h 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010
  1. /*
  2. * linux/include/linux/ufs_fs.h
  3. *
  4. * Copyright (C) 1996
  5. * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu)
  6. * Laboratory for Computer Science Research Computing Facility
  7. * Rutgers, The State University of New Jersey
  8. *
  9. * Clean swab support by Fare <fare@tunes.org>
  10. * just hope no one is using NNUUXXI on __?64 structure elements
  11. * 64-bit clean thanks to Maciej W. Rozycki <macro@ds2.pg.gda.pl>
  12. *
  13. * 4.4BSD (FreeBSD) support added on February 1st 1998 by
  14. * Niels Kristian Bech Jensen <nkbj@image.dk> partially based
  15. * on code by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>.
  16. *
  17. * NeXTstep support added on February 5th 1998 by
  18. * Niels Kristian Bech Jensen <nkbj@image.dk>.
  19. *
  20. * Write support by Daniel Pirkl <daniel.pirkl@email.cz>
  21. *
  22. * HP/UX hfs filesystem support added by
  23. * Martin K. Petersen <mkp@mkp.net>, August 1999
  24. *
  25. * UFS2 (of FreeBSD 5.x) support added by
  26. * Niraj Kumar <niraj17@iitbombay.org> , Jan 2004
  27. *
  28. */
  29. #ifndef __LINUX_UFS_FS_H
  30. #define __LINUX_UFS_FS_H
  31. #include <linux/types.h>
  32. #include <linux/kernel.h>
  33. #include <linux/stat.h>
  34. #include <linux/fs.h>
  35. #ifndef __KERNEL__
  36. typedef __u64 __fs64;
  37. typedef __u32 __fs32;
  38. typedef __u16 __fs16;
  39. #else
  40. typedef __u64 __bitwise __fs64;
  41. typedef __u32 __bitwise __fs32;
  42. typedef __u16 __bitwise __fs16;
  43. #endif
  44. #include <linux/ufs_fs_i.h>
  45. #include <linux/ufs_fs_sb.h>
  46. #define UFS_BBLOCK 0
  47. #define UFS_BBSIZE 8192
  48. #define UFS_SBLOCK 8192
  49. #define UFS_SBSIZE 8192
  50. #define UFS_SECTOR_SIZE 512
  51. #define UFS_SECTOR_BITS 9
  52. #define UFS_MAGIC 0x00011954
  53. #define UFS2_MAGIC 0x19540119
  54. #define UFS_CIGAM 0x54190100 /* byteswapped MAGIC */
  55. /* Copied from FreeBSD */
  56. /*
  57. * Each disk drive contains some number of filesystems.
  58. * A filesystem consists of a number of cylinder groups.
  59. * Each cylinder group has inodes and data.
  60. *
  61. * A filesystem is described by its super-block, which in turn
  62. * describes the cylinder groups. The super-block is critical
  63. * data and is replicated in each cylinder group to protect against
  64. * catastrophic loss. This is done at `newfs' time and the critical
  65. * super-block data does not change, so the copies need not be
  66. * referenced further unless disaster strikes.
  67. *
  68. * For filesystem fs, the offsets of the various blocks of interest
  69. * are given in the super block as:
  70. * [fs->fs_sblkno] Super-block
  71. * [fs->fs_cblkno] Cylinder group block
  72. * [fs->fs_iblkno] Inode blocks
  73. * [fs->fs_dblkno] Data blocks
  74. * The beginning of cylinder group cg in fs, is given by
  75. * the ``cgbase(fs, cg)'' macro.
  76. *
  77. * Depending on the architecture and the media, the superblock may
  78. * reside in any one of four places. For tiny media where every block
  79. * counts, it is placed at the very front of the partition. Historically,
  80. * UFS1 placed it 8K from the front to leave room for the disk label and
  81. * a small bootstrap. For UFS2 it got moved to 64K from the front to leave
  82. * room for the disk label and a bigger bootstrap, and for really piggy
  83. * systems we check at 256K from the front if the first three fail. In
  84. * all cases the size of the superblock will be SBLOCKSIZE. All values are
  85. * given in byte-offset form, so they do not imply a sector size. The
  86. * SBLOCKSEARCH specifies the order in which the locations should be searched.
  87. */
  88. #define SBLOCK_FLOPPY 0
  89. #define SBLOCK_UFS1 8192
  90. #define SBLOCK_UFS2 65536
  91. #define SBLOCK_PIGGY 262144
  92. #define SBLOCKSIZE 8192
  93. #define SBLOCKSEARCH \
  94. { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }
  95. /* HP specific MAGIC values */
  96. #define UFS_MAGIC_LFN 0x00095014 /* fs supports filenames > 14 chars */
  97. #define UFS_CIGAM_LFN 0x14500900 /* srahc 41 < semanelif stroppus sf */
  98. #define UFS_MAGIC_SEC 0x00612195 /* B1 security fs */
  99. #define UFS_CIGAM_SEC 0x95216100
  100. #define UFS_MAGIC_FEA 0x00195612 /* fs_featurebits supported */
  101. #define UFS_CIGAM_FEA 0x12561900
  102. #define UFS_MAGIC_4GB 0x05231994 /* fs > 4 GB && fs_featurebits */
  103. #define UFS_CIGAM_4GB 0x94192305
  104. /* Seems somebody at HP goofed here. B1 and lfs are both 0x2 !?! */
  105. #define UFS_FSF_LFN 0x00000001 /* long file names */
  106. #define UFS_FSF_B1 0x00000002 /* B1 security */
  107. #define UFS_FSF_LFS 0x00000002 /* large files */
  108. #define UFS_FSF_LUID 0x00000004 /* large UIDs */
  109. /* End of HP stuff */
  110. #define UFS_BSIZE 8192
  111. #define UFS_MINBSIZE 4096
  112. #define UFS_FSIZE 1024
  113. #define UFS_MAXFRAG (UFS_BSIZE / UFS_FSIZE)
  114. #define UFS_NDADDR 12
  115. #define UFS_NINDIR 3
  116. #define UFS_IND_BLOCK (UFS_NDADDR + 0)
  117. #define UFS_DIND_BLOCK (UFS_NDADDR + 1)
  118. #define UFS_TIND_BLOCK (UFS_NDADDR + 2)
  119. #define UFS_NDIR_FRAGMENT (UFS_NDADDR << uspi->s_fpbshift)
  120. #define UFS_IND_FRAGMENT (UFS_IND_BLOCK << uspi->s_fpbshift)
  121. #define UFS_DIND_FRAGMENT (UFS_DIND_BLOCK << uspi->s_fpbshift)
  122. #define UFS_TIND_FRAGMENT (UFS_TIND_BLOCK << uspi->s_fpbshift)
  123. #define UFS_ROOTINO 2
  124. #define UFS_FIRST_INO (UFS_ROOTINO + 1)
  125. #define UFS_USEEFT ((__u16)65535)
  126. #define UFS_FSOK 0x7c269d38
  127. #define UFS_FSACTIVE ((__s8)0x00)
  128. #define UFS_FSCLEAN ((__s8)0x01)
  129. #define UFS_FSSTABLE ((__s8)0x02)
  130. #define UFS_FSOSF1 ((__s8)0x03) /* is this correct for DEC OSF/1? */
  131. #define UFS_FSBAD ((__s8)0xff)
  132. /* From here to next blank line, s_flags for ufs_sb_info */
  133. /* directory entry encoding */
  134. #define UFS_DE_MASK 0x00000010 /* mask for the following */
  135. #define UFS_DE_OLD 0x00000000
  136. #define UFS_DE_44BSD 0x00000010
  137. /* uid encoding */
  138. #define UFS_UID_MASK 0x00000060 /* mask for the following */
  139. #define UFS_UID_OLD 0x00000000
  140. #define UFS_UID_44BSD 0x00000020
  141. #define UFS_UID_EFT 0x00000040
  142. /* superblock state encoding */
  143. #define UFS_ST_MASK 0x00000700 /* mask for the following */
  144. #define UFS_ST_OLD 0x00000000
  145. #define UFS_ST_44BSD 0x00000100
  146. #define UFS_ST_SUN 0x00000200
  147. #define UFS_ST_SUNx86 0x00000400
  148. /*cylinder group encoding */
  149. #define UFS_CG_MASK 0x00003000 /* mask for the following */
  150. #define UFS_CG_OLD 0x00000000
  151. #define UFS_CG_44BSD 0x00002000
  152. #define UFS_CG_SUN 0x00001000
  153. /* filesystem type encoding */
  154. #define UFS_TYPE_MASK 0x00010000 /* mask for the following */
  155. #define UFS_TYPE_UFS1 0x00000000
  156. #define UFS_TYPE_UFS2 0x00010000
  157. /* fs_inodefmt options */
  158. #define UFS_42INODEFMT -1
  159. #define UFS_44INODEFMT 2
  160. /* mount options */
  161. #define UFS_MOUNT_ONERROR 0x0000000F
  162. #define UFS_MOUNT_ONERROR_PANIC 0x00000001
  163. #define UFS_MOUNT_ONERROR_LOCK 0x00000002
  164. #define UFS_MOUNT_ONERROR_UMOUNT 0x00000004
  165. #define UFS_MOUNT_ONERROR_REPAIR 0x00000008
  166. #define UFS_MOUNT_UFSTYPE 0x0000FFF0
  167. #define UFS_MOUNT_UFSTYPE_OLD 0x00000010
  168. #define UFS_MOUNT_UFSTYPE_44BSD 0x00000020
  169. #define UFS_MOUNT_UFSTYPE_SUN 0x00000040
  170. #define UFS_MOUNT_UFSTYPE_NEXTSTEP 0x00000080
  171. #define UFS_MOUNT_UFSTYPE_NEXTSTEP_CD 0x00000100
  172. #define UFS_MOUNT_UFSTYPE_OPENSTEP 0x00000200
  173. #define UFS_MOUNT_UFSTYPE_SUNx86 0x00000400
  174. #define UFS_MOUNT_UFSTYPE_HP 0x00000800
  175. #define UFS_MOUNT_UFSTYPE_UFS2 0x00001000
  176. #define ufs_clear_opt(o,opt) o &= ~UFS_MOUNT_##opt
  177. #define ufs_set_opt(o,opt) o |= UFS_MOUNT_##opt
  178. #define ufs_test_opt(o,opt) ((o) & UFS_MOUNT_##opt)
  179. /*
  180. * MINFREE gives the minimum acceptable percentage of file system
  181. * blocks which may be free. If the freelist drops below this level
  182. * only the superuser may continue to allocate blocks. This may
  183. * be set to 0 if no reserve of free blocks is deemed necessary,
  184. * however throughput drops by fifty percent if the file system
  185. * is run at between 95% and 100% full; thus the minimum default
  186. * value of fs_minfree is 5%. However, to get good clustering
  187. * performance, 10% is a better choice. hence we use 10% as our
  188. * default value. With 10% free space, fragmentation is not a
  189. * problem, so we choose to optimize for time.
  190. */
  191. #define UFS_MINFREE 5
  192. #define UFS_DEFAULTOPT UFS_OPTTIME
  193. /*
  194. * Debug code
  195. */
  196. #ifdef CONFIG_UFS_DEBUG
  197. # define UFSD(f, a...) { \
  198. printk ("UFSD (%s, %d): %s:", \
  199. __FILE__, __LINE__, __FUNCTION__); \
  200. printk (f, ## a); \
  201. }
  202. #else
  203. # define UFSD(f, a...) /**/
  204. #endif
  205. /*
  206. * Turn file system block numbers into disk block addresses.
  207. * This maps file system blocks to device size blocks.
  208. */
  209. #define ufs_fsbtodb(uspi, b) ((b) << (uspi)->s_fsbtodb)
  210. #define ufs_dbtofsb(uspi, b) ((b) >> (uspi)->s_fsbtodb)
  211. /*
  212. * Cylinder group macros to locate things in cylinder groups.
  213. * They calc file system addresses of cylinder group data structures.
  214. */
  215. #define ufs_cgbase(c) (uspi->s_fpg * (c))
  216. #define ufs_cgstart(c) ((uspi)->fs_magic == UFS2_MAGIC ? ufs_cgbase(c) : \
  217. (ufs_cgbase(c) + uspi->s_cgoffset * ((c) & ~uspi->s_cgmask)))
  218. #define ufs_cgsblock(c) (ufs_cgstart(c) + uspi->s_sblkno) /* super blk */
  219. #define ufs_cgcmin(c) (ufs_cgstart(c) + uspi->s_cblkno) /* cg block */
  220. #define ufs_cgimin(c) (ufs_cgstart(c) + uspi->s_iblkno) /* inode blk */
  221. #define ufs_cgdmin(c) (ufs_cgstart(c) + uspi->s_dblkno) /* 1st data */
  222. /*
  223. * Macros for handling inode numbers:
  224. * inode number to file system block offset.
  225. * inode number to cylinder group number.
  226. * inode number to file system block address.
  227. */
  228. #define ufs_inotocg(x) ((x) / uspi->s_ipg)
  229. #define ufs_inotocgoff(x) ((x) % uspi->s_ipg)
  230. #define ufs_inotofsba(x) (ufs_cgimin(ufs_inotocg(x)) + ufs_inotocgoff(x) / uspi->s_inopf)
  231. #define ufs_inotofsbo(x) ((x) % uspi->s_inopf)
  232. /*
  233. * Give cylinder group number for a file system block.
  234. * Give cylinder group block number for a file system block.
  235. */
  236. #define ufs_dtog(d) ((d) / uspi->s_fpg)
  237. #define ufs_dtogd(d) ((d) % uspi->s_fpg)
  238. /*
  239. * Compute the cylinder and rotational position of a cyl block addr.
  240. */
  241. #define ufs_cbtocylno(bno) \
  242. ((bno) * uspi->s_nspf / uspi->s_spc)
  243. #define ufs_cbtorpos(bno) \
  244. ((((bno) * uspi->s_nspf % uspi->s_spc / uspi->s_nsect \
  245. * uspi->s_trackskew + (bno) * uspi->s_nspf % uspi->s_spc \
  246. % uspi->s_nsect * uspi->s_interleave) % uspi->s_nsect \
  247. * uspi->s_nrpos) / uspi->s_npsect)
  248. /*
  249. * The following macros optimize certain frequently calculated
  250. * quantities by using shifts and masks in place of divisions
  251. * modulos and multiplications.
  252. */
  253. #define ufs_blkoff(loc) ((loc) & uspi->s_qbmask)
  254. #define ufs_fragoff(loc) ((loc) & uspi->s_qfmask)
  255. #define ufs_lblktosize(blk) ((blk) << uspi->s_bshift)
  256. #define ufs_lblkno(loc) ((loc) >> uspi->s_bshift)
  257. #define ufs_numfrags(loc) ((loc) >> uspi->s_fshift)
  258. #define ufs_blkroundup(size) (((size) + uspi->s_qbmask) & uspi->s_bmask)
  259. #define ufs_fragroundup(size) (((size) + uspi->s_qfmask) & uspi->s_fmask)
  260. #define ufs_fragstoblks(frags) ((frags) >> uspi->s_fpbshift)
  261. #define ufs_blkstofrags(blks) ((blks) << uspi->s_fpbshift)
  262. #define ufs_fragnum(fsb) ((fsb) & uspi->s_fpbmask)
  263. #define ufs_blknum(fsb) ((fsb) & ~uspi->s_fpbmask)
  264. #define UFS_MAXNAMLEN 255
  265. #define UFS_MAXMNTLEN 512
  266. #define UFS2_MAXMNTLEN 468
  267. #define UFS2_MAXVOLLEN 32
  268. /* #define UFS_MAXCSBUFS 31 */
  269. #define UFS_LINK_MAX 32000
  270. /*
  271. #define UFS2_NOCSPTRS ((128 / sizeof(void *)) - 4)
  272. */
  273. #define UFS2_NOCSPTRS 28
  274. /*
  275. * UFS_DIR_PAD defines the directory entries boundaries
  276. * (must be a multiple of 4)
  277. */
  278. #define UFS_DIR_PAD 4
  279. #define UFS_DIR_ROUND (UFS_DIR_PAD - 1)
  280. #define UFS_DIR_REC_LEN(name_len) (((name_len) + 1 + 8 + UFS_DIR_ROUND) & ~UFS_DIR_ROUND)
  281. struct ufs_timeval {
  282. __fs32 tv_sec;
  283. __fs32 tv_usec;
  284. };
  285. struct ufs_dir_entry {
  286. __fs32 d_ino; /* inode number of this entry */
  287. __fs16 d_reclen; /* length of this entry */
  288. union {
  289. __fs16 d_namlen; /* actual length of d_name */
  290. struct {
  291. __u8 d_type; /* file type */
  292. __u8 d_namlen; /* length of string in d_name */
  293. } d_44;
  294. } d_u;
  295. __u8 d_name[UFS_MAXNAMLEN + 1]; /* file name */
  296. };
  297. struct ufs_csum {
  298. __fs32 cs_ndir; /* number of directories */
  299. __fs32 cs_nbfree; /* number of free blocks */
  300. __fs32 cs_nifree; /* number of free inodes */
  301. __fs32 cs_nffree; /* number of free frags */
  302. };
  303. struct ufs2_csum_total {
  304. __fs64 cs_ndir; /* number of directories */
  305. __fs64 cs_nbfree; /* number of free blocks */
  306. __fs64 cs_nifree; /* number of free inodes */
  307. __fs64 cs_nffree; /* number of free frags */
  308. __fs64 cs_numclusters; /* number of free clusters */
  309. __fs64 cs_spare[3]; /* future expansion */
  310. };
  311. /*
  312. * File system flags
  313. */
  314. #define UFS_UNCLEAN 0x01 /* file system not clean at mount (unused) */
  315. #define UFS_DOSOFTDEP 0x02 /* file system using soft dependencies */
  316. #define UFS_NEEDSFSCK 0x04 /* needs sync fsck (FreeBSD compat, unused) */
  317. #define UFS_INDEXDIRS 0x08 /* kernel supports indexed directories */
  318. #define UFS_ACLS 0x10 /* file system has ACLs enabled */
  319. #define UFS_MULTILABEL 0x20 /* file system is MAC multi-label */
  320. #define UFS_FLAGS_UPDATED 0x80 /* flags have been moved to new location */
  321. #if 0
  322. /*
  323. * This is the actual superblock, as it is laid out on the disk.
  324. * Do NOT use this structure, because of sizeof(ufs_super_block) > 512 and
  325. * it may occupy several blocks, use
  326. * struct ufs_super_block_(first,second,third) instead.
  327. */
  328. struct ufs_super_block {
  329. __fs32 fs_link; /* UNUSED */
  330. __fs32 fs_rlink; /* UNUSED */
  331. __fs32 fs_sblkno; /* addr of super-block in filesys */
  332. __fs32 fs_cblkno; /* offset of cyl-block in filesys */
  333. __fs32 fs_iblkno; /* offset of inode-blocks in filesys */
  334. __fs32 fs_dblkno; /* offset of first data after cg */
  335. __fs32 fs_cgoffset; /* cylinder group offset in cylinder */
  336. __fs32 fs_cgmask; /* used to calc mod fs_ntrak */
  337. __fs32 fs_time; /* last time written -- time_t */
  338. __fs32 fs_size; /* number of blocks in fs */
  339. __fs32 fs_dsize; /* number of data blocks in fs */
  340. __fs32 fs_ncg; /* number of cylinder groups */
  341. __fs32 fs_bsize; /* size of basic blocks in fs */
  342. __fs32 fs_fsize; /* size of frag blocks in fs */
  343. __fs32 fs_frag; /* number of frags in a block in fs */
  344. /* these are configuration parameters */
  345. __fs32 fs_minfree; /* minimum percentage of free blocks */
  346. __fs32 fs_rotdelay; /* num of ms for optimal next block */
  347. __fs32 fs_rps; /* disk revolutions per second */
  348. /* these fields can be computed from the others */
  349. __fs32 fs_bmask; /* ``blkoff'' calc of blk offsets */
  350. __fs32 fs_fmask; /* ``fragoff'' calc of frag offsets */
  351. __fs32 fs_bshift; /* ``lblkno'' calc of logical blkno */
  352. __fs32 fs_fshift; /* ``numfrags'' calc number of frags */
  353. /* these are configuration parameters */
  354. __fs32 fs_maxcontig; /* max number of contiguous blks */
  355. __fs32 fs_maxbpg; /* max number of blks per cyl group */
  356. /* these fields can be computed from the others */
  357. __fs32 fs_fragshift; /* block to frag shift */
  358. __fs32 fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */
  359. __fs32 fs_sbsize; /* actual size of super block */
  360. __fs32 fs_csmask; /* csum block offset */
  361. __fs32 fs_csshift; /* csum block number */
  362. __fs32 fs_nindir; /* value of NINDIR */
  363. __fs32 fs_inopb; /* value of INOPB */
  364. __fs32 fs_nspf; /* value of NSPF */
  365. /* yet another configuration parameter */
  366. __fs32 fs_optim; /* optimization preference, see below */
  367. /* these fields are derived from the hardware */
  368. union {
  369. struct {
  370. __fs32 fs_npsect; /* # sectors/track including spares */
  371. } fs_sun;
  372. struct {
  373. __fs32 fs_state; /* file system state time stamp */
  374. } fs_sunx86;
  375. } fs_u1;
  376. __fs32 fs_interleave; /* hardware sector interleave */
  377. __fs32 fs_trackskew; /* sector 0 skew, per track */
  378. /* a unique id for this filesystem (currently unused and unmaintained) */
  379. /* In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek */
  380. /* Neither of those fields is used in the Tahoe code right now but */
  381. /* there could be problems if they are. */
  382. __fs32 fs_id[2]; /* file system id */
  383. /* sizes determined by number of cylinder groups and their sizes */
  384. __fs32 fs_csaddr; /* blk addr of cyl grp summary area */
  385. __fs32 fs_cssize; /* size of cyl grp summary area */
  386. __fs32 fs_cgsize; /* cylinder group size */
  387. /* these fields are derived from the hardware */
  388. __fs32 fs_ntrak; /* tracks per cylinder */
  389. __fs32 fs_nsect; /* sectors per track */
  390. __fs32 fs_spc; /* sectors per cylinder */
  391. /* this comes from the disk driver partitioning */
  392. __fs32 fs_ncyl; /* cylinders in file system */
  393. /* these fields can be computed from the others */
  394. __fs32 fs_cpg; /* cylinders per group */
  395. __fs32 fs_ipg; /* inodes per cylinder group */
  396. __fs32 fs_fpg; /* blocks per group * fs_frag */
  397. /* this data must be re-computed after crashes */
  398. struct ufs_csum fs_cstotal; /* cylinder summary information */
  399. /* these fields are cleared at mount time */
  400. __s8 fs_fmod; /* super block modified flag */
  401. __s8 fs_clean; /* file system is clean flag */
  402. __s8 fs_ronly; /* mounted read-only flag */
  403. __s8 fs_flags;
  404. union {
  405. struct {
  406. __s8 fs_fsmnt[UFS_MAXMNTLEN];/* name mounted on */
  407. __fs32 fs_cgrotor; /* last cg searched */
  408. __fs32 fs_csp[UFS_MAXCSBUFS];/*list of fs_cs info buffers */
  409. __fs32 fs_maxcluster;
  410. __fs32 fs_cpc; /* cyl per cycle in postbl */
  411. __fs16 fs_opostbl[16][8]; /* old rotation block list head */
  412. } fs_u1;
  413. struct {
  414. __s8 fs_fsmnt[UFS2_MAXMNTLEN]; /* name mounted on */
  415. __u8 fs_volname[UFS2_MAXVOLLEN]; /* volume name */
  416. __fs64 fs_swuid; /* system-wide uid */
  417. __fs32 fs_pad; /* due to alignment of fs_swuid */
  418. __fs32 fs_cgrotor; /* last cg searched */
  419. __fs32 fs_ocsp[UFS2_NOCSPTRS]; /*list of fs_cs info buffers */
  420. __fs32 fs_contigdirs;/*# of contiguously allocated dirs */
  421. __fs32 fs_csp; /* cg summary info buffer for fs_cs */
  422. __fs32 fs_maxcluster;
  423. __fs32 fs_active;/* used by snapshots to track fs */
  424. __fs32 fs_old_cpc; /* cyl per cycle in postbl */
  425. __fs32 fs_maxbsize;/*maximum blocking factor permitted */
  426. __fs64 fs_sparecon64[17];/*old rotation block list head */
  427. __fs64 fs_sblockloc; /* byte offset of standard superblock */
  428. struct ufs2_csum_total fs_cstotal;/*cylinder summary information*/
  429. struct ufs_timeval fs_time; /* last time written */
  430. __fs64 fs_size; /* number of blocks in fs */
  431. __fs64 fs_dsize; /* number of data blocks in fs */
  432. __fs64 fs_csaddr; /* blk addr of cyl grp summary area */
  433. __fs64 fs_pendingblocks;/* blocks in process of being freed */
  434. __fs32 fs_pendinginodes;/*inodes in process of being freed */
  435. } fs_u2;
  436. } fs_u11;
  437. union {
  438. struct {
  439. __fs32 fs_sparecon[53];/* reserved for future constants */
  440. __fs32 fs_reclaim;
  441. __fs32 fs_sparecon2[1];
  442. __fs32 fs_state; /* file system state time stamp */
  443. __fs32 fs_qbmask[2]; /* ~usb_bmask */
  444. __fs32 fs_qfmask[2]; /* ~usb_fmask */
  445. } fs_sun;
  446. struct {
  447. __fs32 fs_sparecon[53];/* reserved for future constants */
  448. __fs32 fs_reclaim;
  449. __fs32 fs_sparecon2[1];
  450. __fs32 fs_npsect; /* # sectors/track including spares */
  451. __fs32 fs_qbmask[2]; /* ~usb_bmask */
  452. __fs32 fs_qfmask[2]; /* ~usb_fmask */
  453. } fs_sunx86;
  454. struct {
  455. __fs32 fs_sparecon[50];/* reserved for future constants */
  456. __fs32 fs_contigsumsize;/* size of cluster summary array */
  457. __fs32 fs_maxsymlinklen;/* max length of an internal symlink */
  458. __fs32 fs_inodefmt; /* format of on-disk inodes */
  459. __fs32 fs_maxfilesize[2]; /* max representable file size */
  460. __fs32 fs_qbmask[2]; /* ~usb_bmask */
  461. __fs32 fs_qfmask[2]; /* ~usb_fmask */
  462. __fs32 fs_state; /* file system state time stamp */
  463. } fs_44;
  464. } fs_u2;
  465. __fs32 fs_postblformat; /* format of positional layout tables */
  466. __fs32 fs_nrpos; /* number of rotational positions */
  467. __fs32 fs_postbloff; /* (__s16) rotation block list head */
  468. __fs32 fs_rotbloff; /* (__u8) blocks for each rotation */
  469. __fs32 fs_magic; /* magic number */
  470. __u8 fs_space[1]; /* list of blocks for each rotation */
  471. };
  472. #endif/*struct ufs_super_block*/
  473. /*
  474. * Preference for optimization.
  475. */
  476. #define UFS_OPTTIME 0 /* minimize allocation time */
  477. #define UFS_OPTSPACE 1 /* minimize disk fragmentation */
  478. /*
  479. * Rotational layout table format types
  480. */
  481. #define UFS_42POSTBLFMT -1 /* 4.2BSD rotational table format */
  482. #define UFS_DYNAMICPOSTBLFMT 1 /* dynamic rotational table format */
  483. /*
  484. * Convert cylinder group to base address of its global summary info.
  485. */
  486. #define fs_cs(indx) s_csp[(indx)]
  487. /*
  488. * Cylinder group block for a file system.
  489. *
  490. * Writable fields in the cylinder group are protected by the associated
  491. * super block lock fs->fs_lock.
  492. */
  493. #define CG_MAGIC 0x090255
  494. #define ufs_cg_chkmagic(sb, ucg) \
  495. (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC)
  496. /*
  497. * size of this structure is 172 B
  498. */
  499. struct ufs_cylinder_group {
  500. __fs32 cg_link; /* linked list of cyl groups */
  501. __fs32 cg_magic; /* magic number */
  502. __fs32 cg_time; /* time last written */
  503. __fs32 cg_cgx; /* we are the cgx'th cylinder group */
  504. __fs16 cg_ncyl; /* number of cyl's this cg */
  505. __fs16 cg_niblk; /* number of inode blocks this cg */
  506. __fs32 cg_ndblk; /* number of data blocks this cg */
  507. struct ufs_csum cg_cs; /* cylinder summary information */
  508. __fs32 cg_rotor; /* position of last used block */
  509. __fs32 cg_frotor; /* position of last used frag */
  510. __fs32 cg_irotor; /* position of last used inode */
  511. __fs32 cg_frsum[UFS_MAXFRAG]; /* counts of available frags */
  512. __fs32 cg_btotoff; /* (__u32) block totals per cylinder */
  513. __fs32 cg_boff; /* (short) free block positions */
  514. __fs32 cg_iusedoff; /* (char) used inode map */
  515. __fs32 cg_freeoff; /* (u_char) free block map */
  516. __fs32 cg_nextfreeoff; /* (u_char) next available space */
  517. union {
  518. struct {
  519. __fs32 cg_clustersumoff; /* (u_int32) counts of avail clusters */
  520. __fs32 cg_clusteroff; /* (u_int8) free cluster map */
  521. __fs32 cg_nclusterblks; /* number of clusters this cg */
  522. __fs32 cg_sparecon[13]; /* reserved for future use */
  523. } cg_44;
  524. struct {
  525. __fs32 cg_clustersumoff;/* (u_int32) counts of avail clusters */
  526. __fs32 cg_clusteroff; /* (u_int8) free cluster map */
  527. __fs32 cg_nclusterblks;/* number of clusters this cg */
  528. __fs32 cg_niblk; /* number of inode blocks this cg */
  529. __fs32 cg_initediblk; /* last initialized inode */
  530. __fs32 cg_sparecon32[3];/* reserved for future use */
  531. __fs64 cg_time; /* time last written */
  532. __fs64 cg_sparecon[3]; /* reserved for future use */
  533. } cg_u2;
  534. __fs32 cg_sparecon[16]; /* reserved for future use */
  535. } cg_u;
  536. __u8 cg_space[1]; /* space for cylinder group maps */
  537. /* actually longer */
  538. };
  539. /*
  540. * structure of an on-disk inode
  541. */
  542. struct ufs_inode {
  543. __fs16 ui_mode; /* 0x0 */
  544. __fs16 ui_nlink; /* 0x2 */
  545. union {
  546. struct {
  547. __fs16 ui_suid; /* 0x4 */
  548. __fs16 ui_sgid; /* 0x6 */
  549. } oldids;
  550. __fs32 ui_inumber; /* 0x4 lsf: inode number */
  551. __fs32 ui_author; /* 0x4 GNU HURD: author */
  552. } ui_u1;
  553. __fs64 ui_size; /* 0x8 */
  554. struct ufs_timeval ui_atime; /* 0x10 access */
  555. struct ufs_timeval ui_mtime; /* 0x18 modification */
  556. struct ufs_timeval ui_ctime; /* 0x20 creation */
  557. union {
  558. struct {
  559. __fs32 ui_db[UFS_NDADDR];/* 0x28 data blocks */
  560. __fs32 ui_ib[UFS_NINDIR];/* 0x58 indirect blocks */
  561. } ui_addr;
  562. __u8 ui_symlink[4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */
  563. } ui_u2;
  564. __fs32 ui_flags; /* 0x64 immutable, append-only... */
  565. __fs32 ui_blocks; /* 0x68 blocks in use */
  566. __fs32 ui_gen; /* 0x6c like ext2 i_version, for NFS support */
  567. union {
  568. struct {
  569. __fs32 ui_shadow; /* 0x70 shadow inode with security data */
  570. __fs32 ui_uid; /* 0x74 long EFT version of uid */
  571. __fs32 ui_gid; /* 0x78 long EFT version of gid */
  572. __fs32 ui_oeftflag; /* 0x7c reserved */
  573. } ui_sun;
  574. struct {
  575. __fs32 ui_uid; /* 0x70 File owner */
  576. __fs32 ui_gid; /* 0x74 File group */
  577. __fs32 ui_spare[2]; /* 0x78 reserved */
  578. } ui_44;
  579. struct {
  580. __fs32 ui_uid; /* 0x70 */
  581. __fs32 ui_gid; /* 0x74 */
  582. __fs16 ui_modeh; /* 0x78 mode high bits */
  583. __fs16 ui_spare; /* 0x7A unused */
  584. __fs32 ui_trans; /* 0x7c filesystem translator */
  585. } ui_hurd;
  586. } ui_u3;
  587. };
  588. #define UFS_NXADDR 2 /* External addresses in inode. */
  589. struct ufs2_inode {
  590. __fs16 ui_mode; /* 0: IFMT, permissions; see below. */
  591. __fs16 ui_nlink; /* 2: File link count. */
  592. __fs32 ui_uid; /* 4: File owner. */
  593. __fs32 ui_gid; /* 8: File group. */
  594. __fs32 ui_blksize; /* 12: Inode blocksize. */
  595. __fs64 ui_size; /* 16: File byte count. */
  596. __fs64 ui_blocks; /* 24: Bytes actually held. */
  597. struct ufs_timeval ui_atime; /* 32: Last access time. */
  598. struct ufs_timeval ui_mtime; /* 40: Last modified time. */
  599. struct ufs_timeval ui_ctime; /* 48: Last inode change time. */
  600. struct ufs_timeval ui_birthtime; /* 56: Inode creation time. */
  601. __fs32 ui_mtimensec; /* 64: Last modified time. */
  602. __fs32 ui_atimensec; /* 68: Last access time. */
  603. __fs32 ui_ctimensec; /* 72: Last inode change time. */
  604. __fs32 ui_birthnsec; /* 76: Inode creation time. */
  605. __fs32 ui_gen; /* 80: Generation number. */
  606. __fs32 ui_kernflags; /* 84: Kernel flags. */
  607. __fs32 ui_flags; /* 88: Status flags (chflags). */
  608. __fs32 ui_extsize; /* 92: External attributes block. */
  609. __fs64 ui_extb[UFS_NXADDR];/* 96: External attributes block. */
  610. union {
  611. struct {
  612. __fs64 ui_db[UFS_NDADDR]; /* 112: Direct disk blocks. */
  613. __fs64 ui_ib[UFS_NINDIR];/* 208: Indirect disk blocks.*/
  614. } ui_addr;
  615. __u8 ui_symlink[2*4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */
  616. } ui_u2;
  617. __fs64 ui_spare[3]; /* 232: Reserved; currently unused */
  618. };
  619. /* FreeBSD has these in sys/stat.h */
  620. /* ui_flags that can be set by a file owner */
  621. #define UFS_UF_SETTABLE 0x0000ffff
  622. #define UFS_UF_NODUMP 0x00000001 /* do not dump */
  623. #define UFS_UF_IMMUTABLE 0x00000002 /* immutable (can't "change") */
  624. #define UFS_UF_APPEND 0x00000004 /* append-only */
  625. #define UFS_UF_OPAQUE 0x00000008 /* directory is opaque (unionfs) */
  626. #define UFS_UF_NOUNLINK 0x00000010 /* can't be removed or renamed */
  627. /* ui_flags that only root can set */
  628. #define UFS_SF_SETTABLE 0xffff0000
  629. #define UFS_SF_ARCHIVED 0x00010000 /* archived */
  630. #define UFS_SF_IMMUTABLE 0x00020000 /* immutable (can't "change") */
  631. #define UFS_SF_APPEND 0x00040000 /* append-only */
  632. #define UFS_SF_NOUNLINK 0x00100000 /* can't be removed or renamed */
  633. /*
  634. * This structure is used for reading disk structures larger
  635. * than the size of fragment.
  636. */
  637. struct ufs_buffer_head {
  638. __u64 fragment; /* first fragment */
  639. __u64 count; /* number of fragments */
  640. struct buffer_head * bh[UFS_MAXFRAG]; /* buffers */
  641. };
  642. struct ufs_cg_private_info {
  643. struct ufs_buffer_head c_ubh;
  644. __u32 c_cgx; /* number of cylidner group */
  645. __u16 c_ncyl; /* number of cyl's this cg */
  646. __u16 c_niblk; /* number of inode blocks this cg */
  647. __u32 c_ndblk; /* number of data blocks this cg */
  648. __u32 c_rotor; /* position of last used block */
  649. __u32 c_frotor; /* position of last used frag */
  650. __u32 c_irotor; /* position of last used inode */
  651. __u32 c_btotoff; /* (__u32) block totals per cylinder */
  652. __u32 c_boff; /* (short) free block positions */
  653. __u32 c_iusedoff; /* (char) used inode map */
  654. __u32 c_freeoff; /* (u_char) free block map */
  655. __u32 c_nextfreeoff; /* (u_char) next available space */
  656. __u32 c_clustersumoff;/* (u_int32) counts of avail clusters */
  657. __u32 c_clusteroff; /* (u_int8) free cluster map */
  658. __u32 c_nclusterblks; /* number of clusters this cg */
  659. };
  660. struct ufs_sb_private_info {
  661. struct ufs_buffer_head s_ubh; /* buffer containing super block */
  662. struct ufs2_csum_total cs_total;
  663. __u32 s_sblkno; /* offset of super-blocks in filesys */
  664. __u32 s_cblkno; /* offset of cg-block in filesys */
  665. __u32 s_iblkno; /* offset of inode-blocks in filesys */
  666. __u32 s_dblkno; /* offset of first data after cg */
  667. __u32 s_cgoffset; /* cylinder group offset in cylinder */
  668. __u32 s_cgmask; /* used to calc mod fs_ntrak */
  669. __u32 s_size; /* number of blocks (fragments) in fs */
  670. __u32 s_dsize; /* number of data blocks in fs */
  671. __u64 s_u2_size; /* ufs2: number of blocks (fragments) in fs */
  672. __u64 s_u2_dsize; /*ufs2: number of data blocks in fs */
  673. __u32 s_ncg; /* number of cylinder groups */
  674. __u32 s_bsize; /* size of basic blocks */
  675. __u32 s_fsize; /* size of fragments */
  676. __u32 s_fpb; /* fragments per block */
  677. __u32 s_minfree; /* minimum percentage of free blocks */
  678. __u32 s_bmask; /* `blkoff'' calc of blk offsets */
  679. __u32 s_fmask; /* s_fsize mask */
  680. __u32 s_bshift; /* `lblkno'' calc of logical blkno */
  681. __u32 s_fshift; /* s_fsize shift */
  682. __u32 s_fpbshift; /* fragments per block shift */
  683. __u32 s_fsbtodb; /* fsbtodb and dbtofsb shift constant */
  684. __u32 s_sbsize; /* actual size of super block */
  685. __u32 s_csmask; /* csum block offset */
  686. __u32 s_csshift; /* csum block number */
  687. __u32 s_nindir; /* value of NINDIR */
  688. __u32 s_inopb; /* value of INOPB */
  689. __u32 s_nspf; /* value of NSPF */
  690. __u32 s_npsect; /* # sectors/track including spares */
  691. __u32 s_interleave; /* hardware sector interleave */
  692. __u32 s_trackskew; /* sector 0 skew, per track */
  693. __u32 s_csaddr; /* blk addr of cyl grp summary area */
  694. __u32 s_cssize; /* size of cyl grp summary area */
  695. __u32 s_cgsize; /* cylinder group size */
  696. __u32 s_ntrak; /* tracks per cylinder */
  697. __u32 s_nsect; /* sectors per track */
  698. __u32 s_spc; /* sectors per cylinder */
  699. __u32 s_ipg; /* inodes per cylinder group */
  700. __u32 s_fpg; /* fragments per group */
  701. __u32 s_cpc; /* cyl per cycle in postbl */
  702. __s32 s_contigsumsize;/* size of cluster summary array, 44bsd */
  703. __s64 s_qbmask; /* ~usb_bmask */
  704. __s64 s_qfmask; /* ~usb_fmask */
  705. __s32 s_postblformat; /* format of positional layout tables */
  706. __s32 s_nrpos; /* number of rotational positions */
  707. __s32 s_postbloff; /* (__s16) rotation block list head */
  708. __s32 s_rotbloff; /* (__u8) blocks for each rotation */
  709. __u32 s_fpbmask; /* fragments per block mask */
  710. __u32 s_apb; /* address per block */
  711. __u32 s_2apb; /* address per block^2 */
  712. __u32 s_3apb; /* address per block^3 */
  713. __u32 s_apbmask; /* address per block mask */
  714. __u32 s_apbshift; /* address per block shift */
  715. __u32 s_2apbshift; /* address per block shift * 2 */
  716. __u32 s_3apbshift; /* address per block shift * 3 */
  717. __u32 s_nspfshift; /* number of sector per fragment shift */
  718. __u32 s_nspb; /* number of sector per block */
  719. __u32 s_inopf; /* inodes per fragment */
  720. __u32 s_sbbase; /* offset of NeXTstep superblock */
  721. __u32 s_bpf; /* bits per fragment */
  722. __u32 s_bpfshift; /* bits per fragment shift*/
  723. __u32 s_bpfmask; /* bits per fragment mask */
  724. __u32 s_maxsymlinklen;/* upper limit on fast symlinks' size */
  725. __s32 fs_magic; /* filesystem magic */
  726. };
  727. /*
  728. * Sizes of this structures are:
  729. * ufs_super_block_first 512
  730. * ufs_super_block_second 512
  731. * ufs_super_block_third 356
  732. */
  733. struct ufs_super_block_first {
  734. __fs32 fs_link;
  735. __fs32 fs_rlink;
  736. __fs32 fs_sblkno;
  737. __fs32 fs_cblkno;
  738. __fs32 fs_iblkno;
  739. __fs32 fs_dblkno;
  740. __fs32 fs_cgoffset;
  741. __fs32 fs_cgmask;
  742. __fs32 fs_time;
  743. __fs32 fs_size;
  744. __fs32 fs_dsize;
  745. __fs32 fs_ncg;
  746. __fs32 fs_bsize;
  747. __fs32 fs_fsize;
  748. __fs32 fs_frag;
  749. __fs32 fs_minfree;
  750. __fs32 fs_rotdelay;
  751. __fs32 fs_rps;
  752. __fs32 fs_bmask;
  753. __fs32 fs_fmask;
  754. __fs32 fs_bshift;
  755. __fs32 fs_fshift;
  756. __fs32 fs_maxcontig;
  757. __fs32 fs_maxbpg;
  758. __fs32 fs_fragshift;
  759. __fs32 fs_fsbtodb;
  760. __fs32 fs_sbsize;
  761. __fs32 fs_csmask;
  762. __fs32 fs_csshift;
  763. __fs32 fs_nindir;
  764. __fs32 fs_inopb;
  765. __fs32 fs_nspf;
  766. __fs32 fs_optim;
  767. union {
  768. struct {
  769. __fs32 fs_npsect;
  770. } fs_sun;
  771. struct {
  772. __fs32 fs_state;
  773. } fs_sunx86;
  774. } fs_u1;
  775. __fs32 fs_interleave;
  776. __fs32 fs_trackskew;
  777. __fs32 fs_id[2];
  778. __fs32 fs_csaddr;
  779. __fs32 fs_cssize;
  780. __fs32 fs_cgsize;
  781. __fs32 fs_ntrak;
  782. __fs32 fs_nsect;
  783. __fs32 fs_spc;
  784. __fs32 fs_ncyl;
  785. __fs32 fs_cpg;
  786. __fs32 fs_ipg;
  787. __fs32 fs_fpg;
  788. struct ufs_csum fs_cstotal;
  789. __s8 fs_fmod;
  790. __s8 fs_clean;
  791. __s8 fs_ronly;
  792. __s8 fs_flags;
  793. __s8 fs_fsmnt[UFS_MAXMNTLEN - 212];
  794. };
  795. struct ufs_super_block_second {
  796. union {
  797. struct {
  798. __s8 fs_fsmnt[212];
  799. __fs32 fs_cgrotor;
  800. __fs32 fs_csp[UFS_MAXCSBUFS];
  801. __fs32 fs_maxcluster;
  802. __fs32 fs_cpc;
  803. __fs16 fs_opostbl[82];
  804. } fs_u1;
  805. struct {
  806. __s8 fs_fsmnt[UFS2_MAXMNTLEN - UFS_MAXMNTLEN + 212];
  807. __u8 fs_volname[UFS2_MAXVOLLEN];
  808. __fs64 fs_swuid;
  809. __fs32 fs_pad;
  810. __fs32 fs_cgrotor;
  811. __fs32 fs_ocsp[UFS2_NOCSPTRS];
  812. __fs32 fs_contigdirs;
  813. __fs32 fs_csp;
  814. __fs32 fs_maxcluster;
  815. __fs32 fs_active;
  816. __fs32 fs_old_cpc;
  817. __fs32 fs_maxbsize;
  818. __fs64 fs_sparecon64[17];
  819. __fs64 fs_sblockloc;
  820. __fs64 cs_ndir;
  821. __fs64 cs_nbfree;
  822. } fs_u2;
  823. } fs_un;
  824. };
  825. struct ufs_super_block_third {
  826. union {
  827. struct {
  828. __fs16 fs_opostbl[46];
  829. } fs_u1;
  830. struct {
  831. __fs64 cs_nifree; /* number of free inodes */
  832. __fs64 cs_nffree; /* number of free frags */
  833. __fs64 cs_numclusters; /* number of free clusters */
  834. __fs64 cs_spare[3]; /* future expansion */
  835. struct ufs_timeval fs_time; /* last time written */
  836. __fs64 fs_size; /* number of blocks in fs */
  837. __fs64 fs_dsize; /* number of data blocks in fs */
  838. __fs64 fs_csaddr; /* blk addr of cyl grp summary area */
  839. __fs64 fs_pendingblocks;/* blocks in process of being freed */
  840. __fs32 fs_pendinginodes;/*inodes in process of being freed */
  841. } fs_u2;
  842. } fs_un1;
  843. union {
  844. struct {
  845. __fs32 fs_sparecon[53];/* reserved for future constants */
  846. __fs32 fs_reclaim;
  847. __fs32 fs_sparecon2[1];
  848. __fs32 fs_state; /* file system state time stamp */
  849. __fs32 fs_qbmask[2]; /* ~usb_bmask */
  850. __fs32 fs_qfmask[2]; /* ~usb_fmask */
  851. } fs_sun;
  852. struct {
  853. __fs32 fs_sparecon[53];/* reserved for future constants */
  854. __fs32 fs_reclaim;
  855. __fs32 fs_sparecon2[1];
  856. __fs32 fs_npsect; /* # sectors/track including spares */
  857. __fs32 fs_qbmask[2]; /* ~usb_bmask */
  858. __fs32 fs_qfmask[2]; /* ~usb_fmask */
  859. } fs_sunx86;
  860. struct {
  861. __fs32 fs_sparecon[50];/* reserved for future constants */
  862. __fs32 fs_contigsumsize;/* size of cluster summary array */
  863. __fs32 fs_maxsymlinklen;/* max length of an internal symlink */
  864. __fs32 fs_inodefmt; /* format of on-disk inodes */
  865. __fs32 fs_maxfilesize[2]; /* max representable file size */
  866. __fs32 fs_qbmask[2]; /* ~usb_bmask */
  867. __fs32 fs_qfmask[2]; /* ~usb_fmask */
  868. __fs32 fs_state; /* file system state time stamp */
  869. } fs_44;
  870. } fs_un2;
  871. __fs32 fs_postblformat;
  872. __fs32 fs_nrpos;
  873. __fs32 fs_postbloff;
  874. __fs32 fs_rotbloff;
  875. __fs32 fs_magic;
  876. __u8 fs_space[1];
  877. };
  878. #ifdef __KERNEL__
  879. /* balloc.c */
  880. extern void ufs_free_fragments (struct inode *, unsigned, unsigned);
  881. extern void ufs_free_blocks (struct inode *, unsigned, unsigned);
  882. extern unsigned ufs_new_fragments(struct inode *, __fs32 *, unsigned, unsigned,
  883. unsigned, int *, struct page *);
  884. /* cylinder.c */
  885. extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
  886. extern void ufs_put_cylinder (struct super_block *, unsigned);
  887. /* dir.c */
  888. extern struct inode_operations ufs_dir_inode_operations;
  889. extern int ufs_add_link (struct dentry *, struct inode *);
  890. extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
  891. extern int ufs_make_empty(struct inode *, struct inode *);
  892. extern struct ufs_dir_entry *ufs_find_entry(struct inode *, struct dentry *, struct page **);
  893. extern int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *);
  894. extern int ufs_empty_dir (struct inode *);
  895. extern struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **);
  896. extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
  897. struct page *page, struct inode *inode);
  898. /* file.c */
  899. extern struct inode_operations ufs_file_inode_operations;
  900. extern const struct file_operations ufs_file_operations;
  901. extern const struct address_space_operations ufs_aops;
  902. /* ialloc.c */
  903. extern void ufs_free_inode (struct inode *inode);
  904. extern struct inode * ufs_new_inode (struct inode *, int);
  905. /* inode.c */
  906. extern void ufs_read_inode (struct inode *);
  907. extern void ufs_put_inode (struct inode *);
  908. extern int ufs_write_inode (struct inode *, int);
  909. extern int ufs_sync_inode (struct inode *);
  910. extern void ufs_delete_inode (struct inode *);
  911. extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
  912. extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
  913. /* namei.c */
  914. extern const struct file_operations ufs_dir_operations;
  915. /* super.c */
  916. extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
  917. extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
  918. extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
  919. /* symlink.c */
  920. extern struct inode_operations ufs_fast_symlink_inode_operations;
  921. /* truncate.c */
  922. extern int ufs_truncate (struct inode *, loff_t);
  923. static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
  924. {
  925. return sb->s_fs_info;
  926. }
  927. static inline struct ufs_inode_info *UFS_I(struct inode *inode)
  928. {
  929. return container_of(inode, struct ufs_inode_info, vfs_inode);
  930. }
  931. #endif /* __KERNEL__ */
  932. #endif /* __LINUX_UFS_FS_H */