ufs_fs.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944
  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. * Turn file system block numbers into disk block addresses.
  195. * This maps file system blocks to device size blocks.
  196. */
  197. #define ufs_fsbtodb(uspi, b) ((b) << (uspi)->s_fsbtodb)
  198. #define ufs_dbtofsb(uspi, b) ((b) >> (uspi)->s_fsbtodb)
  199. /*
  200. * Cylinder group macros to locate things in cylinder groups.
  201. * They calc file system addresses of cylinder group data structures.
  202. */
  203. #define ufs_cgbase(c) (uspi->s_fpg * (c))
  204. #define ufs_cgstart(c) ((uspi)->fs_magic == UFS2_MAGIC ? ufs_cgbase(c) : \
  205. (ufs_cgbase(c) + uspi->s_cgoffset * ((c) & ~uspi->s_cgmask)))
  206. #define ufs_cgsblock(c) (ufs_cgstart(c) + uspi->s_sblkno) /* super blk */
  207. #define ufs_cgcmin(c) (ufs_cgstart(c) + uspi->s_cblkno) /* cg block */
  208. #define ufs_cgimin(c) (ufs_cgstart(c) + uspi->s_iblkno) /* inode blk */
  209. #define ufs_cgdmin(c) (ufs_cgstart(c) + uspi->s_dblkno) /* 1st data */
  210. /*
  211. * Macros for handling inode numbers:
  212. * inode number to file system block offset.
  213. * inode number to cylinder group number.
  214. * inode number to file system block address.
  215. */
  216. #define ufs_inotocg(x) ((x) / uspi->s_ipg)
  217. #define ufs_inotocgoff(x) ((x) % uspi->s_ipg)
  218. #define ufs_inotofsba(x) (ufs_cgimin(ufs_inotocg(x)) + ufs_inotocgoff(x) / uspi->s_inopf)
  219. #define ufs_inotofsbo(x) ((x) % uspi->s_inopf)
  220. /*
  221. * Give cylinder group number for a file system block.
  222. * Give cylinder group block number for a file system block.
  223. */
  224. #define ufs_dtog(d) ((d) / uspi->s_fpg)
  225. #define ufs_dtogd(d) ((d) % uspi->s_fpg)
  226. /*
  227. * Compute the cylinder and rotational position of a cyl block addr.
  228. */
  229. #define ufs_cbtocylno(bno) \
  230. ((bno) * uspi->s_nspf / uspi->s_spc)
  231. #define ufs_cbtorpos(bno) \
  232. ((((bno) * uspi->s_nspf % uspi->s_spc / uspi->s_nsect \
  233. * uspi->s_trackskew + (bno) * uspi->s_nspf % uspi->s_spc \
  234. % uspi->s_nsect * uspi->s_interleave) % uspi->s_nsect \
  235. * uspi->s_nrpos) / uspi->s_npsect)
  236. /*
  237. * The following macros optimize certain frequently calculated
  238. * quantities by using shifts and masks in place of divisions
  239. * modulos and multiplications.
  240. */
  241. #define ufs_blkoff(loc) ((loc) & uspi->s_qbmask)
  242. #define ufs_fragoff(loc) ((loc) & uspi->s_qfmask)
  243. #define ufs_lblktosize(blk) ((blk) << uspi->s_bshift)
  244. #define ufs_lblkno(loc) ((loc) >> uspi->s_bshift)
  245. #define ufs_numfrags(loc) ((loc) >> uspi->s_fshift)
  246. #define ufs_blkroundup(size) (((size) + uspi->s_qbmask) & uspi->s_bmask)
  247. #define ufs_fragroundup(size) (((size) + uspi->s_qfmask) & uspi->s_fmask)
  248. #define ufs_fragstoblks(frags) ((frags) >> uspi->s_fpbshift)
  249. #define ufs_blkstofrags(blks) ((blks) << uspi->s_fpbshift)
  250. #define ufs_fragnum(fsb) ((fsb) & uspi->s_fpbmask)
  251. #define ufs_blknum(fsb) ((fsb) & ~uspi->s_fpbmask)
  252. #define UFS_MAXNAMLEN 255
  253. #define UFS_MAXMNTLEN 512
  254. #define UFS2_MAXMNTLEN 468
  255. #define UFS2_MAXVOLLEN 32
  256. /* #define UFS_MAXCSBUFS 31 */
  257. #define UFS_LINK_MAX 32000
  258. /*
  259. #define UFS2_NOCSPTRS ((128 / sizeof(void *)) - 4)
  260. */
  261. #define UFS2_NOCSPTRS 28
  262. /*
  263. * UFS_DIR_PAD defines the directory entries boundaries
  264. * (must be a multiple of 4)
  265. */
  266. #define UFS_DIR_PAD 4
  267. #define UFS_DIR_ROUND (UFS_DIR_PAD - 1)
  268. #define UFS_DIR_REC_LEN(name_len) (((name_len) + 1 + 8 + UFS_DIR_ROUND) & ~UFS_DIR_ROUND)
  269. struct ufs_timeval {
  270. __fs32 tv_sec;
  271. __fs32 tv_usec;
  272. };
  273. struct ufs_dir_entry {
  274. __fs32 d_ino; /* inode number of this entry */
  275. __fs16 d_reclen; /* length of this entry */
  276. union {
  277. __fs16 d_namlen; /* actual length of d_name */
  278. struct {
  279. __u8 d_type; /* file type */
  280. __u8 d_namlen; /* length of string in d_name */
  281. } d_44;
  282. } d_u;
  283. __u8 d_name[UFS_MAXNAMLEN + 1]; /* file name */
  284. };
  285. struct ufs_csum {
  286. __fs32 cs_ndir; /* number of directories */
  287. __fs32 cs_nbfree; /* number of free blocks */
  288. __fs32 cs_nifree; /* number of free inodes */
  289. __fs32 cs_nffree; /* number of free frags */
  290. };
  291. struct ufs2_csum_total {
  292. __fs64 cs_ndir; /* number of directories */
  293. __fs64 cs_nbfree; /* number of free blocks */
  294. __fs64 cs_nifree; /* number of free inodes */
  295. __fs64 cs_nffree; /* number of free frags */
  296. __fs64 cs_numclusters; /* number of free clusters */
  297. __fs64 cs_spare[3]; /* future expansion */
  298. };
  299. /*
  300. * This is the actual superblock, as it is laid out on the disk.
  301. */
  302. struct ufs_super_block {
  303. __fs32 fs_link; /* UNUSED */
  304. __fs32 fs_rlink; /* UNUSED */
  305. __fs32 fs_sblkno; /* addr of super-block in filesys */
  306. __fs32 fs_cblkno; /* offset of cyl-block in filesys */
  307. __fs32 fs_iblkno; /* offset of inode-blocks in filesys */
  308. __fs32 fs_dblkno; /* offset of first data after cg */
  309. __fs32 fs_cgoffset; /* cylinder group offset in cylinder */
  310. __fs32 fs_cgmask; /* used to calc mod fs_ntrak */
  311. __fs32 fs_time; /* last time written -- time_t */
  312. __fs32 fs_size; /* number of blocks in fs */
  313. __fs32 fs_dsize; /* number of data blocks in fs */
  314. __fs32 fs_ncg; /* number of cylinder groups */
  315. __fs32 fs_bsize; /* size of basic blocks in fs */
  316. __fs32 fs_fsize; /* size of frag blocks in fs */
  317. __fs32 fs_frag; /* number of frags in a block in fs */
  318. /* these are configuration parameters */
  319. __fs32 fs_minfree; /* minimum percentage of free blocks */
  320. __fs32 fs_rotdelay; /* num of ms for optimal next block */
  321. __fs32 fs_rps; /* disk revolutions per second */
  322. /* these fields can be computed from the others */
  323. __fs32 fs_bmask; /* ``blkoff'' calc of blk offsets */
  324. __fs32 fs_fmask; /* ``fragoff'' calc of frag offsets */
  325. __fs32 fs_bshift; /* ``lblkno'' calc of logical blkno */
  326. __fs32 fs_fshift; /* ``numfrags'' calc number of frags */
  327. /* these are configuration parameters */
  328. __fs32 fs_maxcontig; /* max number of contiguous blks */
  329. __fs32 fs_maxbpg; /* max number of blks per cyl group */
  330. /* these fields can be computed from the others */
  331. __fs32 fs_fragshift; /* block to frag shift */
  332. __fs32 fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */
  333. __fs32 fs_sbsize; /* actual size of super block */
  334. __fs32 fs_csmask; /* csum block offset */
  335. __fs32 fs_csshift; /* csum block number */
  336. __fs32 fs_nindir; /* value of NINDIR */
  337. __fs32 fs_inopb; /* value of INOPB */
  338. __fs32 fs_nspf; /* value of NSPF */
  339. /* yet another configuration parameter */
  340. __fs32 fs_optim; /* optimization preference, see below */
  341. /* these fields are derived from the hardware */
  342. union {
  343. struct {
  344. __fs32 fs_npsect; /* # sectors/track including spares */
  345. } fs_sun;
  346. struct {
  347. __fs32 fs_state; /* file system state time stamp */
  348. } fs_sunx86;
  349. } fs_u1;
  350. __fs32 fs_interleave; /* hardware sector interleave */
  351. __fs32 fs_trackskew; /* sector 0 skew, per track */
  352. /* a unique id for this filesystem (currently unused and unmaintained) */
  353. /* In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek */
  354. /* Neither of those fields is used in the Tahoe code right now but */
  355. /* there could be problems if they are. */
  356. __fs32 fs_id[2]; /* file system id */
  357. /* sizes determined by number of cylinder groups and their sizes */
  358. __fs32 fs_csaddr; /* blk addr of cyl grp summary area */
  359. __fs32 fs_cssize; /* size of cyl grp summary area */
  360. __fs32 fs_cgsize; /* cylinder group size */
  361. /* these fields are derived from the hardware */
  362. __fs32 fs_ntrak; /* tracks per cylinder */
  363. __fs32 fs_nsect; /* sectors per track */
  364. __fs32 fs_spc; /* sectors per cylinder */
  365. /* this comes from the disk driver partitioning */
  366. __fs32 fs_ncyl; /* cylinders in file system */
  367. /* these fields can be computed from the others */
  368. __fs32 fs_cpg; /* cylinders per group */
  369. __fs32 fs_ipg; /* inodes per cylinder group */
  370. __fs32 fs_fpg; /* blocks per group * fs_frag */
  371. /* this data must be re-computed after crashes */
  372. struct ufs_csum fs_cstotal; /* cylinder summary information */
  373. /* these fields are cleared at mount time */
  374. __s8 fs_fmod; /* super block modified flag */
  375. __s8 fs_clean; /* file system is clean flag */
  376. __s8 fs_ronly; /* mounted read-only flag */
  377. __s8 fs_flags; /* currently unused flag */
  378. union {
  379. struct {
  380. __s8 fs_fsmnt[UFS_MAXMNTLEN];/* name mounted on */
  381. __fs32 fs_cgrotor; /* last cg searched */
  382. __fs32 fs_csp[UFS_MAXCSBUFS];/*list of fs_cs info buffers */
  383. __fs32 fs_maxcluster;
  384. __fs32 fs_cpc; /* cyl per cycle in postbl */
  385. __fs16 fs_opostbl[16][8]; /* old rotation block list head */
  386. } fs_u1;
  387. struct {
  388. __s8 fs_fsmnt[UFS2_MAXMNTLEN]; /* name mounted on */
  389. __u8 fs_volname[UFS2_MAXVOLLEN]; /* volume name */
  390. __fs64 fs_swuid; /* system-wide uid */
  391. __fs32 fs_pad; /* due to alignment of fs_swuid */
  392. __fs32 fs_cgrotor; /* last cg searched */
  393. __fs32 fs_ocsp[UFS2_NOCSPTRS]; /*list of fs_cs info buffers */
  394. __fs32 fs_contigdirs;/*# of contiguously allocated dirs */
  395. __fs32 fs_csp; /* cg summary info buffer for fs_cs */
  396. __fs32 fs_maxcluster;
  397. __fs32 fs_active;/* used by snapshots to track fs */
  398. __fs32 fs_old_cpc; /* cyl per cycle in postbl */
  399. __fs32 fs_maxbsize;/*maximum blocking factor permitted */
  400. __fs64 fs_sparecon64[17];/*old rotation block list head */
  401. __fs64 fs_sblockloc; /* byte offset of standard superblock */
  402. struct ufs2_csum_total fs_cstotal;/*cylinder summary information*/
  403. struct ufs_timeval fs_time; /* last time written */
  404. __fs64 fs_size; /* number of blocks in fs */
  405. __fs64 fs_dsize; /* number of data blocks in fs */
  406. __fs64 fs_csaddr; /* blk addr of cyl grp summary area */
  407. __fs64 fs_pendingblocks;/* blocks in process of being freed */
  408. __fs32 fs_pendinginodes;/*inodes in process of being freed */
  409. } fs_u2;
  410. } fs_u11;
  411. union {
  412. struct {
  413. __fs32 fs_sparecon[53];/* reserved for future constants */
  414. __fs32 fs_reclaim;
  415. __fs32 fs_sparecon2[1];
  416. __fs32 fs_state; /* file system state time stamp */
  417. __fs32 fs_qbmask[2]; /* ~usb_bmask */
  418. __fs32 fs_qfmask[2]; /* ~usb_fmask */
  419. } fs_sun;
  420. struct {
  421. __fs32 fs_sparecon[53];/* reserved for future constants */
  422. __fs32 fs_reclaim;
  423. __fs32 fs_sparecon2[1];
  424. __fs32 fs_npsect; /* # sectors/track including spares */
  425. __fs32 fs_qbmask[2]; /* ~usb_bmask */
  426. __fs32 fs_qfmask[2]; /* ~usb_fmask */
  427. } fs_sunx86;
  428. struct {
  429. __fs32 fs_sparecon[50];/* reserved for future constants */
  430. __fs32 fs_contigsumsize;/* size of cluster summary array */
  431. __fs32 fs_maxsymlinklen;/* max length of an internal symlink */
  432. __fs32 fs_inodefmt; /* format of on-disk inodes */
  433. __fs32 fs_maxfilesize[2]; /* max representable file size */
  434. __fs32 fs_qbmask[2]; /* ~usb_bmask */
  435. __fs32 fs_qfmask[2]; /* ~usb_fmask */
  436. __fs32 fs_state; /* file system state time stamp */
  437. } fs_44;
  438. } fs_u2;
  439. __fs32 fs_postblformat; /* format of positional layout tables */
  440. __fs32 fs_nrpos; /* number of rotational positions */
  441. __fs32 fs_postbloff; /* (__s16) rotation block list head */
  442. __fs32 fs_rotbloff; /* (__u8) blocks for each rotation */
  443. __fs32 fs_magic; /* magic number */
  444. __u8 fs_space[1]; /* list of blocks for each rotation */
  445. };
  446. /*
  447. * Preference for optimization.
  448. */
  449. #define UFS_OPTTIME 0 /* minimize allocation time */
  450. #define UFS_OPTSPACE 1 /* minimize disk fragmentation */
  451. /*
  452. * Rotational layout table format types
  453. */
  454. #define UFS_42POSTBLFMT -1 /* 4.2BSD rotational table format */
  455. #define UFS_DYNAMICPOSTBLFMT 1 /* dynamic rotational table format */
  456. /*
  457. * Convert cylinder group to base address of its global summary info.
  458. */
  459. #define fs_cs(indx) s_csp[(indx)]
  460. /*
  461. * Cylinder group block for a file system.
  462. *
  463. * Writable fields in the cylinder group are protected by the associated
  464. * super block lock fs->fs_lock.
  465. */
  466. #define CG_MAGIC 0x090255
  467. #define ufs_cg_chkmagic(sb, ucg) \
  468. (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC)
  469. /*
  470. * size of this structure is 172 B
  471. */
  472. struct ufs_cylinder_group {
  473. __fs32 cg_link; /* linked list of cyl groups */
  474. __fs32 cg_magic; /* magic number */
  475. __fs32 cg_time; /* time last written */
  476. __fs32 cg_cgx; /* we are the cgx'th cylinder group */
  477. __fs16 cg_ncyl; /* number of cyl's this cg */
  478. __fs16 cg_niblk; /* number of inode blocks this cg */
  479. __fs32 cg_ndblk; /* number of data blocks this cg */
  480. struct ufs_csum cg_cs; /* cylinder summary information */
  481. __fs32 cg_rotor; /* position of last used block */
  482. __fs32 cg_frotor; /* position of last used frag */
  483. __fs32 cg_irotor; /* position of last used inode */
  484. __fs32 cg_frsum[UFS_MAXFRAG]; /* counts of available frags */
  485. __fs32 cg_btotoff; /* (__u32) block totals per cylinder */
  486. __fs32 cg_boff; /* (short) free block positions */
  487. __fs32 cg_iusedoff; /* (char) used inode map */
  488. __fs32 cg_freeoff; /* (u_char) free block map */
  489. __fs32 cg_nextfreeoff; /* (u_char) next available space */
  490. union {
  491. struct {
  492. __fs32 cg_clustersumoff; /* (u_int32) counts of avail clusters */
  493. __fs32 cg_clusteroff; /* (u_int8) free cluster map */
  494. __fs32 cg_nclusterblks; /* number of clusters this cg */
  495. __fs32 cg_sparecon[13]; /* reserved for future use */
  496. } cg_44;
  497. struct {
  498. __fs32 cg_clustersumoff;/* (u_int32) counts of avail clusters */
  499. __fs32 cg_clusteroff; /* (u_int8) free cluster map */
  500. __fs32 cg_nclusterblks;/* number of clusters this cg */
  501. __fs32 cg_niblk; /* number of inode blocks this cg */
  502. __fs32 cg_initediblk; /* last initialized inode */
  503. __fs32 cg_sparecon32[3];/* reserved for future use */
  504. __fs64 cg_time; /* time last written */
  505. __fs64 cg_sparecon[3]; /* reserved for future use */
  506. } cg_u2;
  507. __fs32 cg_sparecon[16]; /* reserved for future use */
  508. } cg_u;
  509. __u8 cg_space[1]; /* space for cylinder group maps */
  510. /* actually longer */
  511. };
  512. /*
  513. * structure of an on-disk inode
  514. */
  515. struct ufs_inode {
  516. __fs16 ui_mode; /* 0x0 */
  517. __fs16 ui_nlink; /* 0x2 */
  518. union {
  519. struct {
  520. __fs16 ui_suid; /* 0x4 */
  521. __fs16 ui_sgid; /* 0x6 */
  522. } oldids;
  523. __fs32 ui_inumber; /* 0x4 lsf: inode number */
  524. __fs32 ui_author; /* 0x4 GNU HURD: author */
  525. } ui_u1;
  526. __fs64 ui_size; /* 0x8 */
  527. struct ufs_timeval ui_atime; /* 0x10 access */
  528. struct ufs_timeval ui_mtime; /* 0x18 modification */
  529. struct ufs_timeval ui_ctime; /* 0x20 creation */
  530. union {
  531. struct {
  532. __fs32 ui_db[UFS_NDADDR];/* 0x28 data blocks */
  533. __fs32 ui_ib[UFS_NINDIR];/* 0x58 indirect blocks */
  534. } ui_addr;
  535. __u8 ui_symlink[4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */
  536. } ui_u2;
  537. __fs32 ui_flags; /* 0x64 immutable, append-only... */
  538. __fs32 ui_blocks; /* 0x68 blocks in use */
  539. __fs32 ui_gen; /* 0x6c like ext2 i_version, for NFS support */
  540. union {
  541. struct {
  542. __fs32 ui_shadow; /* 0x70 shadow inode with security data */
  543. __fs32 ui_uid; /* 0x74 long EFT version of uid */
  544. __fs32 ui_gid; /* 0x78 long EFT version of gid */
  545. __fs32 ui_oeftflag; /* 0x7c reserved */
  546. } ui_sun;
  547. struct {
  548. __fs32 ui_uid; /* 0x70 File owner */
  549. __fs32 ui_gid; /* 0x74 File group */
  550. __fs32 ui_spare[2]; /* 0x78 reserved */
  551. } ui_44;
  552. struct {
  553. __fs32 ui_uid; /* 0x70 */
  554. __fs32 ui_gid; /* 0x74 */
  555. __fs16 ui_modeh; /* 0x78 mode high bits */
  556. __fs16 ui_spare; /* 0x7A unused */
  557. __fs32 ui_trans; /* 0x7c filesystem translator */
  558. } ui_hurd;
  559. } ui_u3;
  560. };
  561. #define UFS_NXADDR 2 /* External addresses in inode. */
  562. struct ufs2_inode {
  563. __fs16 ui_mode; /* 0: IFMT, permissions; see below. */
  564. __fs16 ui_nlink; /* 2: File link count. */
  565. __fs32 ui_uid; /* 4: File owner. */
  566. __fs32 ui_gid; /* 8: File group. */
  567. __fs32 ui_blksize; /* 12: Inode blocksize. */
  568. __fs64 ui_size; /* 16: File byte count. */
  569. __fs64 ui_blocks; /* 24: Bytes actually held. */
  570. struct ufs_timeval ui_atime; /* 32: Last access time. */
  571. struct ufs_timeval ui_mtime; /* 40: Last modified time. */
  572. struct ufs_timeval ui_ctime; /* 48: Last inode change time. */
  573. struct ufs_timeval ui_birthtime; /* 56: Inode creation time. */
  574. __fs32 ui_mtimensec; /* 64: Last modified time. */
  575. __fs32 ui_atimensec; /* 68: Last access time. */
  576. __fs32 ui_ctimensec; /* 72: Last inode change time. */
  577. __fs32 ui_birthnsec; /* 76: Inode creation time. */
  578. __fs32 ui_gen; /* 80: Generation number. */
  579. __fs32 ui_kernflags; /* 84: Kernel flags. */
  580. __fs32 ui_flags; /* 88: Status flags (chflags). */
  581. __fs32 ui_extsize; /* 92: External attributes block. */
  582. __fs64 ui_extb[UFS_NXADDR];/* 96: External attributes block. */
  583. union {
  584. struct {
  585. __fs64 ui_db[UFS_NDADDR]; /* 112: Direct disk blocks. */
  586. __fs64 ui_ib[UFS_NINDIR];/* 208: Indirect disk blocks.*/
  587. } ui_addr;
  588. __u8 ui_symlink[2*4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */
  589. } ui_u2;
  590. __fs64 ui_spare[3]; /* 232: Reserved; currently unused */
  591. };
  592. /* FreeBSD has these in sys/stat.h */
  593. /* ui_flags that can be set by a file owner */
  594. #define UFS_UF_SETTABLE 0x0000ffff
  595. #define UFS_UF_NODUMP 0x00000001 /* do not dump */
  596. #define UFS_UF_IMMUTABLE 0x00000002 /* immutable (can't "change") */
  597. #define UFS_UF_APPEND 0x00000004 /* append-only */
  598. #define UFS_UF_OPAQUE 0x00000008 /* directory is opaque (unionfs) */
  599. #define UFS_UF_NOUNLINK 0x00000010 /* can't be removed or renamed */
  600. /* ui_flags that only root can set */
  601. #define UFS_SF_SETTABLE 0xffff0000
  602. #define UFS_SF_ARCHIVED 0x00010000 /* archived */
  603. #define UFS_SF_IMMUTABLE 0x00020000 /* immutable (can't "change") */
  604. #define UFS_SF_APPEND 0x00040000 /* append-only */
  605. #define UFS_SF_NOUNLINK 0x00100000 /* can't be removed or renamed */
  606. /*
  607. * This structure is used for reading disk structures larger
  608. * than the size of fragment.
  609. */
  610. struct ufs_buffer_head {
  611. __u64 fragment; /* first fragment */
  612. __u64 count; /* number of fragments */
  613. struct buffer_head * bh[UFS_MAXFRAG]; /* buffers */
  614. };
  615. struct ufs_cg_private_info {
  616. struct ufs_cylinder_group ucg;
  617. __u32 c_cgx; /* number of cylidner group */
  618. __u16 c_ncyl; /* number of cyl's this cg */
  619. __u16 c_niblk; /* number of inode blocks this cg */
  620. __u32 c_ndblk; /* number of data blocks this cg */
  621. __u32 c_rotor; /* position of last used block */
  622. __u32 c_frotor; /* position of last used frag */
  623. __u32 c_irotor; /* position of last used inode */
  624. __u32 c_btotoff; /* (__u32) block totals per cylinder */
  625. __u32 c_boff; /* (short) free block positions */
  626. __u32 c_iusedoff; /* (char) used inode map */
  627. __u32 c_freeoff; /* (u_char) free block map */
  628. __u32 c_nextfreeoff; /* (u_char) next available space */
  629. __u32 c_clustersumoff;/* (u_int32) counts of avail clusters */
  630. __u32 c_clusteroff; /* (u_int8) free cluster map */
  631. __u32 c_nclusterblks; /* number of clusters this cg */
  632. };
  633. struct ufs_sb_private_info {
  634. struct ufs_buffer_head s_ubh; /* buffer containing super block */
  635. __u32 s_sblkno; /* offset of super-blocks in filesys */
  636. __u32 s_cblkno; /* offset of cg-block in filesys */
  637. __u32 s_iblkno; /* offset of inode-blocks in filesys */
  638. __u32 s_dblkno; /* offset of first data after cg */
  639. __u32 s_cgoffset; /* cylinder group offset in cylinder */
  640. __u32 s_cgmask; /* used to calc mod fs_ntrak */
  641. __u32 s_size; /* number of blocks (fragments) in fs */
  642. __u32 s_dsize; /* number of data blocks in fs */
  643. __u64 s_u2_size; /* ufs2: number of blocks (fragments) in fs */
  644. __u64 s_u2_dsize; /*ufs2: number of data blocks in fs */
  645. __u32 s_ncg; /* number of cylinder groups */
  646. __u32 s_bsize; /* size of basic blocks */
  647. __u32 s_fsize; /* size of fragments */
  648. __u32 s_fpb; /* fragments per block */
  649. __u32 s_minfree; /* minimum percentage of free blocks */
  650. __u32 s_bmask; /* `blkoff'' calc of blk offsets */
  651. __u32 s_fmask; /* s_fsize mask */
  652. __u32 s_bshift; /* `lblkno'' calc of logical blkno */
  653. __u32 s_fshift; /* s_fsize shift */
  654. __u32 s_fpbshift; /* fragments per block shift */
  655. __u32 s_fsbtodb; /* fsbtodb and dbtofsb shift constant */
  656. __u32 s_sbsize; /* actual size of super block */
  657. __u32 s_csmask; /* csum block offset */
  658. __u32 s_csshift; /* csum block number */
  659. __u32 s_nindir; /* value of NINDIR */
  660. __u32 s_inopb; /* value of INOPB */
  661. __u32 s_nspf; /* value of NSPF */
  662. __u32 s_npsect; /* # sectors/track including spares */
  663. __u32 s_interleave; /* hardware sector interleave */
  664. __u32 s_trackskew; /* sector 0 skew, per track */
  665. __u32 s_csaddr; /* blk addr of cyl grp summary area */
  666. __u32 s_cssize; /* size of cyl grp summary area */
  667. __u32 s_cgsize; /* cylinder group size */
  668. __u32 s_ntrak; /* tracks per cylinder */
  669. __u32 s_nsect; /* sectors per track */
  670. __u32 s_spc; /* sectors per cylinder */
  671. __u32 s_ipg; /* inodes per cylinder group */
  672. __u32 s_fpg; /* fragments per group */
  673. __u32 s_cpc; /* cyl per cycle in postbl */
  674. __s32 s_contigsumsize;/* size of cluster summary array, 44bsd */
  675. __s64 s_qbmask; /* ~usb_bmask */
  676. __s64 s_qfmask; /* ~usb_fmask */
  677. __s32 s_postblformat; /* format of positional layout tables */
  678. __s32 s_nrpos; /* number of rotational positions */
  679. __s32 s_postbloff; /* (__s16) rotation block list head */
  680. __s32 s_rotbloff; /* (__u8) blocks for each rotation */
  681. __u32 s_fpbmask; /* fragments per block mask */
  682. __u32 s_apb; /* address per block */
  683. __u32 s_2apb; /* address per block^2 */
  684. __u32 s_3apb; /* address per block^3 */
  685. __u32 s_apbmask; /* address per block mask */
  686. __u32 s_apbshift; /* address per block shift */
  687. __u32 s_2apbshift; /* address per block shift * 2 */
  688. __u32 s_3apbshift; /* address per block shift * 3 */
  689. __u32 s_nspfshift; /* number of sector per fragment shift */
  690. __u32 s_nspb; /* number of sector per block */
  691. __u32 s_inopf; /* inodes per fragment */
  692. __u32 s_sbbase; /* offset of NeXTstep superblock */
  693. __u32 s_bpf; /* bits per fragment */
  694. __u32 s_bpfshift; /* bits per fragment shift*/
  695. __u32 s_bpfmask; /* bits per fragment mask */
  696. __u32 s_maxsymlinklen;/* upper limit on fast symlinks' size */
  697. __s32 fs_magic; /* filesystem magic */
  698. };
  699. /*
  700. * Sizes of this structures are:
  701. * ufs_super_block_first 512
  702. * ufs_super_block_second 512
  703. * ufs_super_block_third 356
  704. */
  705. struct ufs_super_block_first {
  706. __fs32 fs_link;
  707. __fs32 fs_rlink;
  708. __fs32 fs_sblkno;
  709. __fs32 fs_cblkno;
  710. __fs32 fs_iblkno;
  711. __fs32 fs_dblkno;
  712. __fs32 fs_cgoffset;
  713. __fs32 fs_cgmask;
  714. __fs32 fs_time;
  715. __fs32 fs_size;
  716. __fs32 fs_dsize;
  717. __fs32 fs_ncg;
  718. __fs32 fs_bsize;
  719. __fs32 fs_fsize;
  720. __fs32 fs_frag;
  721. __fs32 fs_minfree;
  722. __fs32 fs_rotdelay;
  723. __fs32 fs_rps;
  724. __fs32 fs_bmask;
  725. __fs32 fs_fmask;
  726. __fs32 fs_bshift;
  727. __fs32 fs_fshift;
  728. __fs32 fs_maxcontig;
  729. __fs32 fs_maxbpg;
  730. __fs32 fs_fragshift;
  731. __fs32 fs_fsbtodb;
  732. __fs32 fs_sbsize;
  733. __fs32 fs_csmask;
  734. __fs32 fs_csshift;
  735. __fs32 fs_nindir;
  736. __fs32 fs_inopb;
  737. __fs32 fs_nspf;
  738. __fs32 fs_optim;
  739. union {
  740. struct {
  741. __fs32 fs_npsect;
  742. } fs_sun;
  743. struct {
  744. __fs32 fs_state;
  745. } fs_sunx86;
  746. } fs_u1;
  747. __fs32 fs_interleave;
  748. __fs32 fs_trackskew;
  749. __fs32 fs_id[2];
  750. __fs32 fs_csaddr;
  751. __fs32 fs_cssize;
  752. __fs32 fs_cgsize;
  753. __fs32 fs_ntrak;
  754. __fs32 fs_nsect;
  755. __fs32 fs_spc;
  756. __fs32 fs_ncyl;
  757. __fs32 fs_cpg;
  758. __fs32 fs_ipg;
  759. __fs32 fs_fpg;
  760. struct ufs_csum fs_cstotal;
  761. __s8 fs_fmod;
  762. __s8 fs_clean;
  763. __s8 fs_ronly;
  764. __s8 fs_flags;
  765. __s8 fs_fsmnt[UFS_MAXMNTLEN - 212];
  766. };
  767. struct ufs_super_block_second {
  768. __s8 fs_fsmnt[212];
  769. __fs32 fs_cgrotor;
  770. __fs32 fs_csp[UFS_MAXCSBUFS];
  771. __fs32 fs_maxcluster;
  772. __fs32 fs_cpc;
  773. __fs16 fs_opostbl[82];
  774. };
  775. struct ufs_super_block_third {
  776. __fs16 fs_opostbl[46];
  777. union {
  778. struct {
  779. __fs32 fs_sparecon[53];/* reserved for future constants */
  780. __fs32 fs_reclaim;
  781. __fs32 fs_sparecon2[1];
  782. __fs32 fs_state; /* file system state time stamp */
  783. __fs32 fs_qbmask[2]; /* ~usb_bmask */
  784. __fs32 fs_qfmask[2]; /* ~usb_fmask */
  785. } fs_sun;
  786. struct {
  787. __fs32 fs_sparecon[53];/* reserved for future constants */
  788. __fs32 fs_reclaim;
  789. __fs32 fs_sparecon2[1];
  790. __fs32 fs_npsect; /* # sectors/track including spares */
  791. __fs32 fs_qbmask[2]; /* ~usb_bmask */
  792. __fs32 fs_qfmask[2]; /* ~usb_fmask */
  793. } fs_sunx86;
  794. struct {
  795. __fs32 fs_sparecon[50];/* reserved for future constants */
  796. __fs32 fs_contigsumsize;/* size of cluster summary array */
  797. __fs32 fs_maxsymlinklen;/* max length of an internal symlink */
  798. __fs32 fs_inodefmt; /* format of on-disk inodes */
  799. __fs32 fs_maxfilesize[2]; /* max representable file size */
  800. __fs32 fs_qbmask[2]; /* ~usb_bmask */
  801. __fs32 fs_qfmask[2]; /* ~usb_fmask */
  802. __fs32 fs_state; /* file system state time stamp */
  803. } fs_44;
  804. } fs_u2;
  805. __fs32 fs_postblformat;
  806. __fs32 fs_nrpos;
  807. __fs32 fs_postbloff;
  808. __fs32 fs_rotbloff;
  809. __fs32 fs_magic;
  810. __u8 fs_space[1];
  811. };
  812. #ifdef __KERNEL__
  813. /* balloc.c */
  814. extern void ufs_free_fragments (struct inode *, unsigned, unsigned);
  815. extern void ufs_free_blocks (struct inode *, unsigned, unsigned);
  816. extern unsigned ufs_new_fragments(struct inode *, __fs32 *, unsigned, unsigned,
  817. unsigned, int *, struct page *);
  818. /* cylinder.c */
  819. extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
  820. extern void ufs_put_cylinder (struct super_block *, unsigned);
  821. /* dir.c */
  822. extern struct inode_operations ufs_dir_inode_operations;
  823. extern int ufs_add_link (struct dentry *, struct inode *);
  824. extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
  825. extern int ufs_make_empty(struct inode *, struct inode *);
  826. extern struct ufs_dir_entry *ufs_find_entry(struct inode *, struct dentry *, struct page **);
  827. extern int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *);
  828. extern int ufs_empty_dir (struct inode *);
  829. extern struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **);
  830. extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
  831. struct page *page, struct inode *inode);
  832. /* file.c */
  833. extern struct inode_operations ufs_file_inode_operations;
  834. extern const struct file_operations ufs_file_operations;
  835. extern struct address_space_operations ufs_aops;
  836. /* ialloc.c */
  837. extern void ufs_free_inode (struct inode *inode);
  838. extern struct inode * ufs_new_inode (struct inode *, int);
  839. /* inode.c */
  840. extern u64 ufs_frag_map (struct inode *, sector_t);
  841. extern void ufs_read_inode (struct inode *);
  842. extern void ufs_put_inode (struct inode *);
  843. extern int ufs_write_inode (struct inode *, int);
  844. extern int ufs_sync_inode (struct inode *);
  845. extern void ufs_delete_inode (struct inode *);
  846. extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *);
  847. extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
  848. extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
  849. /* namei.c */
  850. extern const struct file_operations ufs_dir_operations;
  851. /* super.c */
  852. extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
  853. extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
  854. extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
  855. /* symlink.c */
  856. extern struct inode_operations ufs_fast_symlink_inode_operations;
  857. /* truncate.c */
  858. extern void ufs_truncate (struct inode *);
  859. static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
  860. {
  861. return sb->s_fs_info;
  862. }
  863. static inline struct ufs_inode_info *UFS_I(struct inode *inode)
  864. {
  865. return container_of(inode, struct ufs_inode_info, vfs_inode);
  866. }
  867. #endif /* __KERNEL__ */
  868. #endif /* __LINUX_UFS_FS_H */