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