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