Go to the documentation of this file.
30 #ifndef __LINUX_UFS_FS_H
31 #define __LINUX_UFS_FS_H
33 #include <linux/types.h>
34 #include <linux/kernel.h>
35 #include <linux/stat.h>
39 #include <asm/div64.h>
45 #define UFS_BBSIZE 8192
46 #define UFS_SBLOCK 8192
47 #define UFS_SBSIZE 8192
49 #define UFS_SECTOR_SIZE 512
50 #define UFS_SECTOR_BITS 9
51 #define UFS_MAGIC 0x00011954
52 #define UFS_MAGIC_BW 0x0f242697
53 #define UFS2_MAGIC 0x19540119
54 #define UFS_CIGAM 0x54190100
89 #define SBLOCK_FLOPPY 0
90 #define SBLOCK_UFS1 8192
91 #define SBLOCK_UFS2 65536
92 #define SBLOCK_PIGGY 262144
93 #define SBLOCKSIZE 8192
94 #define SBLOCKSEARCH \
95 { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }
100 #define UFS_MAGIC_LFN 0x00095014
101 #define UFS_CIGAM_LFN 0x14500900
103 #define UFS_MAGIC_SEC 0x00612195
104 #define UFS_CIGAM_SEC 0x95216100
106 #define UFS_MAGIC_FEA 0x00195612
107 #define UFS_CIGAM_FEA 0x12561900
109 #define UFS_MAGIC_4GB 0x05231994
110 #define UFS_CIGAM_4GB 0x94192305
113 #define UFS_FSF_LFN 0x00000001
114 #define UFS_FSF_B1 0x00000002
115 #define UFS_FSF_LFS 0x00000002
116 #define UFS_FSF_LUID 0x00000004
121 #define UFS_BSIZE 8192
122 #define UFS_MINBSIZE 4096
123 #define UFS_FSIZE 1024
124 #define UFS_MAXFRAG (UFS_BSIZE / UFS_FSIZE)
126 #define UFS_NDADDR 12
129 #define UFS_IND_BLOCK (UFS_NDADDR + 0)
130 #define UFS_DIND_BLOCK (UFS_NDADDR + 1)
131 #define UFS_TIND_BLOCK (UFS_NDADDR + 2)
133 #define UFS_NDIR_FRAGMENT (UFS_NDADDR << uspi->s_fpbshift)
134 #define UFS_IND_FRAGMENT (UFS_IND_BLOCK << uspi->s_fpbshift)
135 #define UFS_DIND_FRAGMENT (UFS_DIND_BLOCK << uspi->s_fpbshift)
136 #define UFS_TIND_FRAGMENT (UFS_TIND_BLOCK << uspi->s_fpbshift)
138 #define UFS_ROOTINO 2
139 #define UFS_FIRST_INO (UFS_ROOTINO + 1)
141 #define UFS_USEEFT ((__u16)65535)
144 #define UFS_FSOK 0x7c269d38
145 #define UFS_FSACTIVE ((__s8)0x00)
146 #define UFS_FSCLEAN ((__s8)0x01)
147 #define UFS_FSSTABLE ((__s8)0x02)
148 #define UFS_FSOSF1 ((__s8)0x03)
149 #define UFS_FSBAD ((__s8)0xff)
152 #define UFS_FSSUSPEND ((__s8)0xfe)
153 #define UFS_FSLOG ((__s8)0xfd)
154 #define UFS_FSFIX ((__s8)0xfc)
158 #define UFS_DE_MASK 0x00000010
159 #define UFS_DE_OLD 0x00000000
160 #define UFS_DE_44BSD 0x00000010
162 #define UFS_UID_MASK 0x00000060
163 #define UFS_UID_OLD 0x00000000
164 #define UFS_UID_44BSD 0x00000020
165 #define UFS_UID_EFT 0x00000040
167 #define UFS_ST_MASK 0x00000700
168 #define UFS_ST_OLD 0x00000000
169 #define UFS_ST_44BSD 0x00000100
170 #define UFS_ST_SUN 0x00000200
171 #define UFS_ST_SUNOS 0x00000300
172 #define UFS_ST_SUNx86 0x00000400
174 #define UFS_CG_MASK 0x00003000
175 #define UFS_CG_OLD 0x00000000
176 #define UFS_CG_44BSD 0x00002000
177 #define UFS_CG_SUN 0x00001000
179 #define UFS_TYPE_MASK 0x00010000
180 #define UFS_TYPE_UFS1 0x00000000
181 #define UFS_TYPE_UFS2 0x00010000
185 #define UFS_42INODEFMT -1
186 #define UFS_44INODEFMT 2
200 #define UFS_MINFREE 5
201 #define UFS_DEFAULTOPT UFS_OPTTIME
207 #define ufs_fsbtodb(uspi, b) ((b) << (uspi)->s_fsbtodb)
208 #define ufs_dbtofsb(uspi, b) ((b) >> (uspi)->s_fsbtodb)
214 #define ufs_cgbase(c) (uspi->s_fpg * (c))
215 #define ufs_cgstart(c) ((uspi)->fs_magic == UFS2_MAGIC ? ufs_cgbase(c) : \
216 (ufs_cgbase(c) + uspi->s_cgoffset * ((c) & ~uspi->s_cgmask)))
217 #define ufs_cgsblock(c) (ufs_cgstart(c) + uspi->s_sblkno)
218 #define ufs_cgcmin(c) (ufs_cgstart(c) + uspi->s_cblkno)
219 #define ufs_cgimin(c) (ufs_cgstart(c) + uspi->s_iblkno)
220 #define ufs_cgdmin(c) (ufs_cgstart(c) + uspi->s_dblkno)
228 #define ufs_inotocg(x) ((x) / uspi->s_ipg)
229 #define ufs_inotocgoff(x) ((x) % uspi->s_ipg)
230 #define ufs_inotofsba(x) (((u64)ufs_cgimin(ufs_inotocg(x))) + ufs_inotocgoff(x) / uspi->s_inopf)
231 #define ufs_inotofsbo(x) ((x) % uspi->s_inopf)
236 #define ufs_cbtocylno(bno) \
237 ((bno) * uspi->s_nspf / uspi->s_spc)
238 #define ufs_cbtorpos(bno) \
239 ((UFS_SB(sb)->s_flags & UFS_CG_SUN) ? \
240 (((((bno) * uspi->s_nspf % uspi->s_spc) % \
242 uspi->s_nrpos) / uspi->s_nsect) \
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))
254 #define ufs_blkoff(loc) ((loc) & uspi->s_qbmask)
255 #define ufs_fragoff(loc) ((loc) & uspi->s_qfmask)
256 #define ufs_lblktosize(blk) ((blk) << uspi->s_bshift)
257 #define ufs_lblkno(loc) ((loc) >> uspi->s_bshift)
258 #define ufs_numfrags(loc) ((loc) >> uspi->s_fshift)
259 #define ufs_blkroundup(size) (((size) + uspi->s_qbmask) & uspi->s_bmask)
260 #define ufs_fragroundup(size) (((size) + uspi->s_qfmask) & uspi->s_fmask)
261 #define ufs_fragstoblks(frags) ((frags) >> uspi->s_fpbshift)
262 #define ufs_blkstofrags(blks) ((blks) << uspi->s_fpbshift)
263 #define ufs_fragnum(fsb) ((fsb) & uspi->s_fpbmask)
264 #define ufs_blknum(fsb) ((fsb) & ~uspi->s_fpbmask)
266 #define UFS_MAXNAMLEN 255
267 #define UFS_MAXMNTLEN 512
268 #define UFS2_MAXMNTLEN 468
269 #define UFS2_MAXVOLLEN 32
270 #define UFS_MAXCSBUFS 31
271 #define UFS_LINK_MAX 32000
275 #define UFS2_NOCSPTRS 28
281 #define UFS_DIR_PAD 4
282 #define UFS_DIR_ROUND (UFS_DIR_PAD - 1)
283 #define UFS_DIR_REC_LEN(name_len) (((name_len) + 1 + 8 + UFS_DIR_ROUND) & ~UFS_DIR_ROUND)
329 #define UFS_UNCLEAN 0x01
330 #define UFS_DOSOFTDEP 0x02
331 #define UFS_NEEDSFSCK 0x04
332 #define UFS_INDEXDIRS 0x08
333 #define UFS_ACLS 0x10
334 #define UFS_MULTILABEL 0x20
335 #define UFS_FLAGS_UPDATED 0x80
344 struct ufs_super_block {
500 #define UFS_OPTTIME 0
501 #define UFS_OPTSPACE 1
506 #define UFS_42POSTBLFMT -1
507 #define UFS_DYNAMICPOSTBLFMT 1
512 #define fs_cs(indx) s_csp[(indx)]
520 #define CG_MAGIC 0x090255
521 #define ufs_cg_chkmagic(sb, ucg) \
522 (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC)
526 #define ufs_ocg_blktot(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_btot)
527 #define ufs_ocg_blks(sb, ucg, cylno) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_b[cylno])
528 #define ufs_ocg_inosused(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_iused)
529 #define ufs_ocg_blksfree(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_free)
530 #define ufs_ocg_chkmagic(sb, ucg) \
531 (fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_magic) == CG_MAGIC)
684 #define UFS_UF_SETTABLE 0x0000ffff
685 #define UFS_UF_NODUMP 0x00000001
686 #define UFS_UF_IMMUTABLE 0x00000002
687 #define UFS_UF_APPEND 0x00000004
688 #define UFS_UF_OPAQUE 0x00000008
689 #define UFS_UF_NOUNLINK 0x00000010
691 #define UFS_SF_SETTABLE 0xffff0000
692 #define UFS_SF_ARCHIVED 0x00010000
693 #define UFS_SF_IMMUTABLE 0x00020000
694 #define UFS_SF_APPEND 0x00040000
695 #define UFS_SF_NOUNLINK 0x00100000