1139825Simp/*- 21541Srgrimes * Copyright (c) 1982, 1986, 1993 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * Redistribution and use in source and binary forms, with or without 61541Srgrimes * modification, are permitted provided that the following conditions 71541Srgrimes * are met: 81541Srgrimes * 1. Redistributions of source code must retain the above copyright 91541Srgrimes * notice, this list of conditions and the following disclaimer. 101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111541Srgrimes * notice, this list of conditions and the following disclaimer in the 121541Srgrimes * documentation and/or other materials provided with the distribution. 131541Srgrimes * 4. Neither the name of the University nor the names of its contributors 141541Srgrimes * may be used to endorse or promote products derived from this software 151541Srgrimes * without specific prior written permission. 161541Srgrimes * 171541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 181541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 191541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 201541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 211541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 221541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 231541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 241541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 251541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 261541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 271541Srgrimes * SUCH DAMAGE. 281541Srgrimes * 2922521Sdyson * @(#)fs.h 8.13 (Berkeley) 3/21/95 3050477Speter * $FreeBSD$ 311541Srgrimes */ 321541Srgrimes 332176Spaul#ifndef _UFS_FFS_FS_H_ 342176Spaul#define _UFS_FFS_FS_H_ 352176Spaul 36243245Strasz#include <sys/mount.h> 37243250Strasz#include <ufs/ufs/dinode.h> 38243245Strasz 391541Srgrimes/* 4096755Strhodes * Each disk drive contains some number of filesystems. 4196755Strhodes * A filesystem consists of a number of cylinder groups. 421541Srgrimes * Each cylinder group has inodes and data. 431541Srgrimes * 4496755Strhodes * A filesystem is described by its super-block, which in turn 451541Srgrimes * describes the cylinder groups. The super-block is critical 461541Srgrimes * data and is replicated in each cylinder group to protect against 471541Srgrimes * catastrophic loss. This is done at `newfs' time and the critical 481541Srgrimes * super-block data does not change, so the copies need not be 491541Srgrimes * referenced further unless disaster strikes. 501541Srgrimes * 5196755Strhodes * For filesystem fs, the offsets of the various blocks of interest 521541Srgrimes * are given in the super block as: 531541Srgrimes * [fs->fs_sblkno] Super-block 541541Srgrimes * [fs->fs_cblkno] Cylinder group block 551541Srgrimes * [fs->fs_iblkno] Inode blocks 561541Srgrimes * [fs->fs_dblkno] Data blocks 571541Srgrimes * The beginning of cylinder group cg in fs, is given by 581541Srgrimes * the ``cgbase(fs, cg)'' macro. 591541Srgrimes * 6098542Smckusick * Depending on the architecture and the media, the superblock may 6198542Smckusick * reside in any one of four places. For tiny media where every block 6298542Smckusick * counts, it is placed at the very front of the partition. Historically, 6398542Smckusick * UFS1 placed it 8K from the front to leave room for the disk label and 6498542Smckusick * a small bootstrap. For UFS2 it got moved to 64K from the front to leave 6598542Smckusick * room for the disk label and a bigger bootstrap, and for really piggy 6698542Smckusick * systems we check at 256K from the front if the first three fail. In 6798542Smckusick * all cases the size of the superblock will be SBLOCKSIZE. All values are 6898542Smckusick * given in byte-offset form, so they do not imply a sector size. The 6998542Smckusick * SBLOCKSEARCH specifies the order in which the locations should be searched. 701541Srgrimes */ 7198542Smckusick#define SBLOCK_FLOPPY 0 7298542Smckusick#define SBLOCK_UFS1 8192 7398542Smckusick#define SBLOCK_UFS2 65536 7498542Smckusick#define SBLOCK_PIGGY 262144 7598542Smckusick#define SBLOCKSIZE 8192 7698542Smckusick#define SBLOCKSEARCH \ 7798542Smckusick { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 } 781541Srgrimes 7998542Smckusick/* 8098542Smckusick * Max number of fragments per block. This value is NOT tweakable. 8198542Smckusick */ 8293736Sphk#define MAXFRAG 8 8398542Smckusick 841541Srgrimes/* 851541Srgrimes * Addresses stored in inodes are capable of addressing fragments 868876Srgrimes * of `blocks'. File system blocks of at most size MAXBSIZE can 871541Srgrimes * be optionally broken into 2, 4, or 8 pieces, each of which is 8813765Smpp * addressable; these pieces may be DEV_BSIZE, or some multiple of 891541Srgrimes * a DEV_BSIZE unit. 901541Srgrimes * 911541Srgrimes * Large files consist of exclusively large data blocks. To avoid 921541Srgrimes * undue wasted disk space, the last data block of a small file may be 931541Srgrimes * allocated as only as many fragments of a large block as are 9496755Strhodes * necessary. The filesystem format retains only a single pointer 951541Srgrimes * to such a fragment, which is a piece of a single large block that 961541Srgrimes * has been divided. The size of such a fragment is determinable from 971541Srgrimes * information in the inode, using the ``blksize(fs, ip, lbn)'' macro. 981541Srgrimes * 9996755Strhodes * The filesystem records space availability at the fragment level; 1001541Srgrimes * to determine block availability, aligned fragments are examined. 1011541Srgrimes */ 1021541Srgrimes 1031541Srgrimes/* 1041541Srgrimes * MINBSIZE is the smallest allowable block size. 1051541Srgrimes * In order to insure that it is possible to create files of size 1061541Srgrimes * 2^32 with only two levels of indirection, MINBSIZE is set to 4096. 1071541Srgrimes * MINBSIZE must be big enough to hold a cylinder group block, 1081541Srgrimes * thus changes to (struct cg) must keep its size within MINBSIZE. 109179295Srodrigc * Note that super blocks are always of size SBLOCKSIZE, 110179295Srodrigc * and that both SBLOCKSIZE and MAXBSIZE must be >= MINBSIZE. 1111541Srgrimes */ 1121541Srgrimes#define MINBSIZE 4096 1131541Srgrimes 1141541Srgrimes/* 11596755Strhodes * The path name on which the filesystem is mounted is maintained 1168876Srgrimes * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in 1171541Srgrimes * the super block for this name. 11822521Sdyson */ 119109034Sgordon#define MAXMNTLEN 468 12022521Sdyson 12122521Sdyson/* 122108970Sgordon * The volume name for this filesystem is maintained in fs_volname. 123108970Sgordon * MAXVOLLEN defines the length of the buffer allocated. 124108970Sgordon */ 125108970Sgordon#define MAXVOLLEN 32 126108970Sgordon 127108970Sgordon/* 12871073Siedowse * There is a 128-byte region in the superblock reserved for in-core 12971073Siedowse * pointers to summary information. Originally this included an array 13088025Siedowse * of pointers to blocks of struct csum; now there are just a few 13171073Siedowse * pointers and the remaining space is padded with fs_ocsp[]. 13271073Siedowse * 13371073Siedowse * NOCSPTRS determines the size of this padding. One pointer (fs_csp) 13471073Siedowse * is taken away to point to a contiguous array of struct csum for 13571073Siedowse * all cylinder groups; a second (fs_maxcluster) points to an array 13675377Smckusick * of cluster sizes that is computed as cylinder groups are inspected, 13775377Smckusick * and the third points to an array that tracks the creation of new 13888025Siedowse * directories. A fourth pointer, fs_active, is used when creating 13988025Siedowse * snapshots; it points to a bitmap of cylinder groups for which the 14088025Siedowse * free-block bitmap has changed since the snapshot operation began. 1411541Srgrimes */ 14288025Siedowse#define NOCSPTRS ((128 / sizeof(void *)) - 4) 1431541Srgrimes 1441541Srgrimes/* 1451541Srgrimes * A summary of contiguous blocks of various sizes is maintained 1461541Srgrimes * in each cylinder group. Normally this is set by the initial 1471541Srgrimes * value of fs_maxcontig. To conserve space, a maximum summary size 1481541Srgrimes * is set by FS_MAXCONTIG. 1491541Srgrimes */ 1501541Srgrimes#define FS_MAXCONTIG 16 1511541Srgrimes 1521541Srgrimes/* 15396755Strhodes * MINFREE gives the minimum acceptable percentage of filesystem 1541541Srgrimes * blocks which may be free. If the freelist drops below this level 1551541Srgrimes * only the superuser may continue to allocate blocks. This may 1561541Srgrimes * be set to 0 if no reserve of free blocks is deemed necessary, 15796755Strhodes * however throughput drops by fifty percent if the filesystem 1581541Srgrimes * is run at between 95% and 100% full; thus the minimum default 1591541Srgrimes * value of fs_minfree is 5%. However, to get good clustering 1601541Srgrimes * performance, 10% is a better choice. hence we use 10% as our 1611541Srgrimes * default value. With 10% free space, fragmentation is not a 1621541Srgrimes * problem, so we choose to optimize for time. 1631541Srgrimes */ 1646994Sdg#define MINFREE 8 1651541Srgrimes#define DEFAULTOPT FS_OPTTIME 1661541Srgrimes 1671541Srgrimes/* 16875377Smckusick * Grigoriy Orlov <gluk@ptci.ru> has done some extensive work to fine 16975377Smckusick * tune the layout preferences for directories within a filesystem. 17075377Smckusick * His algorithm can be tuned by adjusting the following parameters 17175377Smckusick * which tell the system the average file size and the average number 17275377Smckusick * of files per directory. These defaults are well selected for typical 17375377Smckusick * filesystems, but may need to be tuned for odd cases like filesystems 174129895Skrion * being used for squid caches or news spools. 17575377Smckusick */ 17675377Smckusick#define AVFILESIZ 16384 /* expected average file size */ 17775377Smckusick#define AFPDIR 64 /* expected number of files per directory */ 17875377Smckusick 17975377Smckusick/* 18062553Smckusick * The maximum number of snapshot nodes that can be associated 18162553Smckusick * with each filesystem. This limit affects only the number of 18262553Smckusick * snapshot files that can be recorded within the superblock so 18362553Smckusick * that they can be found when the filesystem is mounted. However, 18462553Smckusick * maintaining too many will slow the filesystem performance, so 18562553Smckusick * having this limit is a good idea. 18662553Smckusick */ 18762553Smckusick#define FSMAXSNAP 20 18862553Smckusick 18962553Smckusick/* 19062553Smckusick * Used to identify special blocks in snapshots: 19162553Smckusick * 19262553Smckusick * BLK_NOCOPY - A block that was unallocated at the time the snapshot 19362553Smckusick * was taken, hence does not need to be copied when written. 19462553Smckusick * BLK_SNAP - A block held by another snapshot that is not needed by this 19562553Smckusick * snapshot. When the other snapshot is freed, the BLK_SNAP entries 19662553Smckusick * are converted to BLK_NOCOPY. These are needed to allow fsck to 19762553Smckusick * identify blocks that are in use by other snapshots (which are 19862553Smckusick * expunged from this snapshot). 19962553Smckusick */ 20098542Smckusick#define BLK_NOCOPY ((ufs2_daddr_t)(1)) 20198542Smckusick#define BLK_SNAP ((ufs2_daddr_t)(2)) 20262553Smckusick 20362553Smckusick/* 20474548Smckusick * Sysctl values for the fast filesystem. 20574548Smckusick */ 20674548Smckusick#define FFS_ADJ_REFCNT 1 /* adjust inode reference count */ 20774548Smckusick#define FFS_ADJ_BLKCNT 2 /* adjust inode used block count */ 20874548Smckusick#define FFS_BLK_FREE 3 /* free range of blocks in map */ 20974548Smckusick#define FFS_DIR_FREE 4 /* free specified dir inodes in map */ 21074548Smckusick#define FFS_FILE_FREE 5 /* free specified file inodes in map */ 21174548Smckusick#define FFS_SET_FLAGS 6 /* set filesystem flags */ 212142123Sdelphij#define FFS_ADJ_NDIR 7 /* adjust number of directories */ 213142123Sdelphij#define FFS_ADJ_NBFREE 8 /* adjust number of free blocks */ 214142123Sdelphij#define FFS_ADJ_NIFREE 9 /* adjust number of free inodes */ 215142123Sdelphij#define FFS_ADJ_NFFREE 10 /* adjust number of free frags */ 216142123Sdelphij#define FFS_ADJ_NUMCLUSTERS 11 /* adjust number of free clusters */ 217202113Smckusick#define FFS_SET_CWD 12 /* set current directory */ 218202113Smckusick#define FFS_SET_DOTDOT 13 /* set inode number for ".." */ 219202113Smckusick#define FFS_UNLINK 14 /* remove a name in the filesystem */ 220224061Smckusick#define FFS_SET_INODE 15 /* update an on-disk inode */ 221224061Smckusick#define FFS_SET_BUFOUTPUT 16 /* set buffered writing on descriptor */ 222224061Smckusick#define FFS_MAXID 16 /* number of valid ffs ids */ 22374548Smckusick 22474548Smckusick/* 22574548Smckusick * Command structure passed in to the filesystem to adjust filesystem values. 22674548Smckusick */ 22798542Smckusick#define FFS_CMD_VERSION 0x19790518 /* version ID */ 22874548Smckusickstruct fsck_cmd { 22998542Smckusick int32_t version; /* version of command structure */ 23098542Smckusick int32_t handle; /* reference to filesystem to be changed */ 23198542Smckusick int64_t value; /* inode or block number to be affected */ 23298542Smckusick int64_t size; /* amount or range to be adjusted */ 23398542Smckusick int64_t spare; /* reserved for future use */ 23474548Smckusick}; 23574548Smckusick 23674548Smckusick/* 2371541Srgrimes * Per cylinder group information; summarized in blocks allocated 2381541Srgrimes * from first cylinder group data blocks. These blocks have to be 2391541Srgrimes * read in from fs_csaddr (size fs_cssize) in addition to the 2401541Srgrimes * super block. 2411541Srgrimes */ 2421541Srgrimesstruct csum { 24322521Sdyson int32_t cs_ndir; /* number of directories */ 24422521Sdyson int32_t cs_nbfree; /* number of free blocks */ 24522521Sdyson int32_t cs_nifree; /* number of free inodes */ 24622521Sdyson int32_t cs_nffree; /* number of free frags */ 2471541Srgrimes}; 24898542Smckusickstruct csum_total { 24998542Smckusick int64_t cs_ndir; /* number of directories */ 25098542Smckusick int64_t cs_nbfree; /* number of free blocks */ 25198542Smckusick int64_t cs_nifree; /* number of free inodes */ 25298542Smckusick int64_t cs_nffree; /* number of free frags */ 25398542Smckusick int64_t cs_numclusters; /* number of free clusters */ 25498542Smckusick int64_t cs_spare[3]; /* future expansion */ 25598542Smckusick}; 2561541Srgrimes 2571541Srgrimes/* 25896755Strhodes * Super block for an FFS filesystem. 2591541Srgrimes */ 2601541Srgrimesstruct fs { 26196755Strhodes int32_t fs_firstfield; /* historic filesystem linked list, */ 26222521Sdyson int32_t fs_unused_1; /* used for incore super blocks */ 26398542Smckusick int32_t fs_sblkno; /* offset of super-block in filesys */ 26498542Smckusick int32_t fs_cblkno; /* offset of cyl-block in filesys */ 26598542Smckusick int32_t fs_iblkno; /* offset of inode-blocks in filesys */ 26698542Smckusick int32_t fs_dblkno; /* offset of first data after cg */ 26798542Smckusick int32_t fs_old_cgoffset; /* cylinder group offset in cylinder */ 26898542Smckusick int32_t fs_old_cgmask; /* used to calc mod fs_ntrak */ 26998542Smckusick int32_t fs_old_time; /* last time written */ 27098542Smckusick int32_t fs_old_size; /* number of blocks in fs */ 27198542Smckusick int32_t fs_old_dsize; /* number of data blocks in fs */ 272203763Smckusick u_int32_t fs_ncg; /* number of cylinder groups */ 27322521Sdyson int32_t fs_bsize; /* size of basic blocks in fs */ 27422521Sdyson int32_t fs_fsize; /* size of frag blocks in fs */ 27522521Sdyson int32_t fs_frag; /* number of frags in a block in fs */ 2761541Srgrimes/* these are configuration parameters */ 27722521Sdyson int32_t fs_minfree; /* minimum percentage of free blocks */ 27898542Smckusick int32_t fs_old_rotdelay; /* num of ms for optimal next block */ 27998542Smckusick int32_t fs_old_rps; /* disk revolutions per second */ 2801541Srgrimes/* these fields can be computed from the others */ 28122521Sdyson int32_t fs_bmask; /* ``blkoff'' calc of blk offsets */ 28222521Sdyson int32_t fs_fmask; /* ``fragoff'' calc of frag offsets */ 28322521Sdyson int32_t fs_bshift; /* ``lblkno'' calc of logical blkno */ 28422521Sdyson int32_t fs_fshift; /* ``numfrags'' calc number of frags */ 2851541Srgrimes/* these are configuration parameters */ 28622521Sdyson int32_t fs_maxcontig; /* max number of contiguous blks */ 28722521Sdyson int32_t fs_maxbpg; /* max number of blks per cyl group */ 2881541Srgrimes/* these fields can be computed from the others */ 28922521Sdyson int32_t fs_fragshift; /* block to frag shift */ 29022521Sdyson int32_t fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ 29122521Sdyson int32_t fs_sbsize; /* actual size of super block */ 29298542Smckusick int32_t fs_spare1[2]; /* old fs_csmask */ 29398542Smckusick /* old fs_csshift */ 29422521Sdyson int32_t fs_nindir; /* value of NINDIR */ 295203784Smckusick u_int32_t fs_inopb; /* value of INOPB */ 29698542Smckusick int32_t fs_old_nspf; /* value of NSPF */ 2971541Srgrimes/* yet another configuration parameter */ 29822521Sdyson int32_t fs_optim; /* optimization preference, see below */ 29998542Smckusick int32_t fs_old_npsect; /* # sectors/track including spares */ 30098542Smckusick int32_t fs_old_interleave; /* hardware sector interleave */ 30198542Smckusick int32_t fs_old_trackskew; /* sector 0 skew, per track */ 30224171Sbde int32_t fs_id[2]; /* unique filesystem id */ 3031541Srgrimes/* sizes determined by number of cylinder groups and their sizes */ 30498542Smckusick int32_t fs_old_csaddr; /* blk addr of cyl grp summary area */ 30522521Sdyson int32_t fs_cssize; /* size of cyl grp summary area */ 30622521Sdyson int32_t fs_cgsize; /* cylinder group size */ 30798542Smckusick int32_t fs_spare2; /* old fs_ntrak */ 30898542Smckusick int32_t fs_old_nsect; /* sectors per track */ 30998542Smckusick int32_t fs_old_spc; /* sectors per cylinder */ 31098542Smckusick int32_t fs_old_ncyl; /* cylinders in filesystem */ 31198542Smckusick int32_t fs_old_cpg; /* cylinders per group */ 312203763Smckusick u_int32_t fs_ipg; /* inodes per group */ 31398542Smckusick int32_t fs_fpg; /* blocks per group * fs_frag */ 3141541Srgrimes/* this data must be re-computed after crashes */ 31598542Smckusick struct csum fs_old_cstotal; /* cylinder summary information */ 3161541Srgrimes/* these fields are cleared at mount time */ 31722521Sdyson int8_t fs_fmod; /* super block modified flag */ 31896755Strhodes int8_t fs_clean; /* filesystem is clean flag */ 31922521Sdyson int8_t fs_ronly; /* mounted read-only flag */ 320107294Smckusick int8_t fs_old_flags; /* old FS_ flags */ 32122521Sdyson u_char fs_fsmnt[MAXMNTLEN]; /* name mounted on */ 322108970Sgordon u_char fs_volname[MAXVOLLEN]; /* volume name */ 323109034Sgordon u_int64_t fs_swuid; /* system-wide uid */ 324109053Smarcel int32_t fs_pad; /* due to alignment of fs_swuid */ 3251541Srgrimes/* these fields retain the current block allocation info */ 32622521Sdyson int32_t fs_cgrotor; /* last cg searched */ 32771073Siedowse void *fs_ocsp[NOCSPTRS]; /* padding; was list of fs_cs buffers */ 328140702Sjeff u_int8_t *fs_contigdirs; /* (u) # of contig. allocated dirs */ 329140702Sjeff struct csum *fs_csp; /* (u) cg summary info buffer */ 330140702Sjeff int32_t *fs_maxcluster; /* (u) max cluster in each cyl group */ 331140702Sjeff u_int *fs_active; /* (u) used by snapshots to track fs */ 33298542Smckusick int32_t fs_old_cpc; /* cyl per cycle in postbl */ 33398542Smckusick int32_t fs_maxbsize; /* maximum blocking factor permitted */ 334163841Spjd int64_t fs_unrefs; /* number of unreferenced inodes */ 335242379Strasz int64_t fs_providersize; /* size of underlying GEOM provider */ 336248623Smckusick int64_t fs_metaspace; /* size of area reserved for metadata */ 337248623Smckusick int64_t fs_sparecon64[14]; /* old rotation block list head */ 338107294Smckusick int64_t fs_sblockloc; /* byte offset of standard superblock */ 339140702Sjeff struct csum_total fs_cstotal; /* (u) cylinder summary information */ 34098542Smckusick ufs_time_t fs_time; /* last time written */ 34198542Smckusick int64_t fs_size; /* number of blocks in fs */ 34298542Smckusick int64_t fs_dsize; /* number of data blocks in fs */ 34398542Smckusick ufs2_daddr_t fs_csaddr; /* blk addr of cyl grp summary area */ 344140702Sjeff int64_t fs_pendingblocks; /* (u) blocks being freed */ 345203763Smckusick u_int32_t fs_pendinginodes; /* (u) inodes being freed */ 346227382Sgleb uint32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */ 347203763Smckusick u_int32_t fs_avgfilesize; /* expected average file size */ 348203763Smckusick u_int32_t fs_avgfpdir; /* expected # of files per directory */ 34998542Smckusick int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */ 350207141Sjeff ufs_time_t fs_mtime; /* Last mount or fsck time. */ 351207141Sjeff int32_t fs_sujfree; /* SUJ free list */ 352207141Sjeff int32_t fs_sparecon32[23]; /* reserved for future constants */ 353107294Smckusick int32_t fs_flags; /* see FS_ flags below */ 35422521Sdyson int32_t fs_contigsumsize; /* size of cluster summary array */ 35522521Sdyson int32_t fs_maxsymlinklen; /* max length of an internal symlink */ 35698542Smckusick int32_t fs_old_inodefmt; /* format of on-disk inodes */ 35722521Sdyson u_int64_t fs_maxfilesize; /* maximum representable file size */ 35822521Sdyson int64_t fs_qbmask; /* ~fs_bmask for use with 64-bit size */ 35922521Sdyson int64_t fs_qfmask; /* ~fs_fmask for use with 64-bit size */ 36022521Sdyson int32_t fs_state; /* validate fs_clean field */ 36198542Smckusick int32_t fs_old_postblformat; /* format of positional layout tables */ 36298542Smckusick int32_t fs_old_nrpos; /* number of rotational positions */ 36398542Smckusick int32_t fs_spare5[2]; /* old fs_postbloff */ 36498542Smckusick /* old fs_rotbloff */ 36522521Sdyson int32_t fs_magic; /* magic number */ 3661541Srgrimes}; 36722521Sdyson 368109053Smarcel/* Sanity checking. */ 369109053Smarcel#ifdef CTASSERT 370109053SmarcelCTASSERT(sizeof(struct fs) == 1376); 371109053Smarcel#endif 372109053Smarcel 3731541Srgrimes/* 37413765Smpp * Filesystem identification 3751541Srgrimes */ 37698542Smckusick#define FS_UFS1_MAGIC 0x011954 /* UFS1 fast filesystem magic number */ 37798542Smckusick#define FS_UFS2_MAGIC 0x19540119 /* UFS2 fast filesystem magic number */ 378134011Sjhb#define FS_BAD_MAGIC 0x19960408 /* UFS incomplete newfs magic number */ 3791541Srgrimes#define FS_OKAY 0x7c269d38 /* superblock checksum */ 3801541Srgrimes#define FS_42INODEFMT -1 /* 4.2BSD inode format */ 3811541Srgrimes#define FS_44INODEFMT 2 /* 4.4BSD inode format */ 38234266Sjulian 3831541Srgrimes/* 3841541Srgrimes * Preference for optimization. 3851541Srgrimes */ 3861541Srgrimes#define FS_OPTTIME 0 /* minimize allocation time */ 3871541Srgrimes#define FS_OPTSPACE 1 /* minimize disk fragmentation */ 3881541Srgrimes 3891541Srgrimes/* 39034266Sjulian * Filesystem flags. 39175503Smckusick * 39298542Smckusick * The FS_UNCLEAN flag is set by the kernel when the filesystem was 39398542Smckusick * mounted with fs_clean set to zero. The FS_DOSOFTDEP flag indicates 39498542Smckusick * that the filesystem should be managed by the soft updates code. 39575503Smckusick * Note that the FS_NEEDSFSCK flag is set and cleared only by the 39675503Smckusick * fsck utility. It is set when background fsck finds an unexpected 39775503Smckusick * inconsistency which requires a traditional foreground fsck to be 39875503Smckusick * run. Such inconsistencies should only be found after an uncorrectable 39975503Smckusick * disk error. A foreground fsck will clear the FS_NEEDSFSCK flag when 40075503Smckusick * it has successfully cleaned up the filesystem. The kernel uses this 40175503Smckusick * flag to enforce that inconsistent filesystems be mounted read-only. 40298542Smckusick * The FS_INDEXDIRS flag when set indicates that the kernel maintains 40398542Smckusick * on-disk auxiliary indexes (such as B-trees) for speeding directory 40498542Smckusick * accesses. Kernels that do not support auxiliary indicies clear the 40598542Smckusick * flag to indicate that the indicies need to be rebuilt (by fsck) before 40698542Smckusick * they can be used. 407105112Srwatson * 408200796Strasz * FS_ACLS indicates that POSIX.1e ACLs are administratively enabled 409200796Strasz * for the file system, so they should be loaded from extended attributes, 410105112Srwatson * observed for access control purposes, and be administered by object 411200796Strasz * owners. FS_NFS4ACLS indicates that NFSv4 ACLs are administratively 412200796Strasz * enabled. This flag is mutually exclusive with FS_ACLS. FS_MULTILABEL 413200796Strasz * indicates that the TrustedBSD MAC Framework should attempt to back MAC 414200796Strasz * labels into extended attributes on the file system rather than maintain 415200796Strasz * a single mount label for all objects. 41634266Sjulian */ 417200796Strasz#define FS_UNCLEAN 0x0001 /* filesystem not clean at mount */ 418200796Strasz#define FS_DOSOFTDEP 0x0002 /* filesystem using soft dependencies */ 419200796Strasz#define FS_NEEDSFSCK 0x0004 /* filesystem needs sync fsck before mount */ 420207141Sjeff#define FS_SUJ 0x0008 /* Filesystem using softupdate journal */ 421200796Strasz#define FS_ACLS 0x0010 /* file system has POSIX.1e ACLs enabled */ 422200796Strasz#define FS_MULTILABEL 0x0020 /* file system is MAC multi-label */ 423200796Strasz#define FS_GJOURNAL 0x0040 /* gjournaled file system */ 424200796Strasz#define FS_FLAGS_UPDATED 0x0080 /* flags have been moved to new location */ 425200796Strasz#define FS_NFS4ACLS 0x0100 /* file system has NFSv4 ACLs enabled */ 426207141Sjeff#define FS_INDEXDIRS 0x0200 /* kernel supports indexed directories */ 427216796Skib#define FS_TRIM 0x0400 /* issue BIO_DELETE for deleted blocks */ 42834266Sjulian 42934266Sjulian/* 43088138Smckusick * Macros to access bits in the fs_active array. 43188138Smckusick */ 43288138Smckusick#define ACTIVECGNUM(fs, cg) ((fs)->fs_active[(cg) / (NBBY * sizeof(int))]) 43389450Smckusick#define ACTIVECGOFF(cg) (1 << ((cg) % (NBBY * sizeof(int)))) 434140702Sjeff#define ACTIVESET(fs, cg) do { \ 435140702Sjeff if ((fs)->fs_active) \ 436140702Sjeff ACTIVECGNUM((fs), (cg)) |= ACTIVECGOFF((cg)); \ 437140702Sjeff} while (0) 438140702Sjeff#define ACTIVECLEAR(fs, cg) do { \ 439140702Sjeff if ((fs)->fs_active) \ 440140702Sjeff ACTIVECGNUM((fs), (cg)) &= ~ACTIVECGOFF((cg)); \ 441140702Sjeff} while (0) 44288138Smckusick 44388138Smckusick/* 4441541Srgrimes * The size of a cylinder group is calculated by CGSIZE. The maximum size 4451541Srgrimes * is limited by the fact that cylinder groups are at most one block. 4468876Srgrimes * Its size is derived from the size of the maps maintained in the 4471541Srgrimes * cylinder group and the (struct cg) size. 4481541Srgrimes */ 4491541Srgrimes#define CGSIZE(fs) \ 45022521Sdyson /* base cg */ (sizeof(struct cg) + sizeof(int32_t) + \ 45198542Smckusick /* old btotoff */ (fs)->fs_old_cpg * sizeof(int32_t) + \ 45298542Smckusick /* old boff */ (fs)->fs_old_cpg * sizeof(u_int16_t) + \ 4531541Srgrimes /* inode map */ howmany((fs)->fs_ipg, NBBY) + \ 45498542Smckusick /* block map */ howmany((fs)->fs_fpg, NBBY) +\ 4551541Srgrimes /* if present */ ((fs)->fs_contigsumsize <= 0 ? 0 : \ 45622521Sdyson /* cluster sum */ (fs)->fs_contigsumsize * sizeof(int32_t) + \ 45798542Smckusick /* cluster map */ howmany(fragstoblks(fs, (fs)->fs_fpg), NBBY))) 4581541Srgrimes 4591541Srgrimes/* 46098542Smckusick * The minimal number of cylinder groups that should be created. 46198542Smckusick */ 46298542Smckusick#define MINCYLGRPS 4 46398542Smckusick 46498542Smckusick/* 4651541Srgrimes * Convert cylinder group to base address of its global summary info. 4661541Srgrimes */ 46771073Siedowse#define fs_cs(fs, indx) fs_csp[indx] 4681541Srgrimes 4691541Srgrimes/* 47096755Strhodes * Cylinder group block for a filesystem. 4711541Srgrimes */ 4721541Srgrimes#define CG_MAGIC 0x090255 47322521Sdysonstruct cg { 47422521Sdyson int32_t cg_firstfield; /* historic cyl groups linked list */ 47522521Sdyson int32_t cg_magic; /* magic number */ 47698542Smckusick int32_t cg_old_time; /* time last written */ 477203763Smckusick u_int32_t cg_cgx; /* we are the cgx'th cylinder group */ 47898542Smckusick int16_t cg_old_ncyl; /* number of cyl's this cg */ 47998542Smckusick int16_t cg_old_niblk; /* number of inode blocks this cg */ 480203763Smckusick u_int32_t cg_ndblk; /* number of data blocks this cg */ 481203763Smckusick struct csum cg_cs; /* cylinder summary information */ 482203763Smckusick u_int32_t cg_rotor; /* position of last used block */ 483203763Smckusick u_int32_t cg_frotor; /* position of last used frag */ 484203763Smckusick u_int32_t cg_irotor; /* position of last used inode */ 485203763Smckusick u_int32_t cg_frsum[MAXFRAG]; /* counts of available frags */ 48698542Smckusick int32_t cg_old_btotoff; /* (int32) block totals per cylinder */ 48798542Smckusick int32_t cg_old_boff; /* (u_int16) free block positions */ 488203763Smckusick u_int32_t cg_iusedoff; /* (u_int8) used inode map */ 489203763Smckusick u_int32_t cg_freeoff; /* (u_int8) free block map */ 490203763Smckusick u_int32_t cg_nextfreeoff; /* (u_int8) next available space */ 491203763Smckusick u_int32_t cg_clustersumoff; /* (u_int32) counts of avail clusters */ 492203763Smckusick u_int32_t cg_clusteroff; /* (u_int8) free cluster map */ 493203763Smckusick u_int32_t cg_nclusterblks; /* number of clusters this cg */ 494203763Smckusick u_int32_t cg_niblk; /* number of inode blocks this cg */ 495203763Smckusick u_int32_t cg_initediblk; /* last initialized inode */ 496203763Smckusick u_int32_t cg_unrefs; /* number of unreferenced inodes */ 497163841Spjd int32_t cg_sparecon32[2]; /* reserved for future use */ 49898542Smckusick ufs_time_t cg_time; /* time last written */ 49998542Smckusick int64_t cg_sparecon64[3]; /* reserved for future use */ 50022521Sdyson u_int8_t cg_space[1]; /* space for cylinder group maps */ 5011541Srgrimes/* actually longer */ 5021541Srgrimes}; 50322521Sdyson 5041541Srgrimes/* 5051541Srgrimes * Macros for access to cylinder group array structures 5061541Srgrimes */ 50798542Smckusick#define cg_chkmagic(cgp) ((cgp)->cg_magic == CG_MAGIC) 5081541Srgrimes#define cg_inosused(cgp) \ 50998542Smckusick ((u_int8_t *)((u_int8_t *)(cgp) + (cgp)->cg_iusedoff)) 5101541Srgrimes#define cg_blksfree(cgp) \ 51198542Smckusick ((u_int8_t *)((u_int8_t *)(cgp) + (cgp)->cg_freeoff)) 5121541Srgrimes#define cg_clustersfree(cgp) \ 51322521Sdyson ((u_int8_t *)((u_int8_t *)(cgp) + (cgp)->cg_clusteroff)) 5141541Srgrimes#define cg_clustersum(cgp) \ 515127818Smux ((int32_t *)((uintptr_t)(cgp) + (cgp)->cg_clustersumoff)) 5161541Srgrimes 5171541Srgrimes/* 51896755Strhodes * Turn filesystem block numbers into disk block addresses. 51996755Strhodes * This maps filesystem blocks to device size blocks. 5201541Srgrimes */ 521136336Snjl#define fsbtodb(fs, b) ((daddr_t)(b) << (fs)->fs_fsbtodb) 5221541Srgrimes#define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb) 5231541Srgrimes 5241541Srgrimes/* 5251541Srgrimes * Cylinder group macros to locate things in cylinder groups. 52696755Strhodes * They calc filesystem addresses of cylinder group data structures. 5271541Srgrimes */ 528111238Smckusick#define cgbase(fs, c) (((ufs2_daddr_t)(fs)->fs_fpg) * (c)) 529248623Smckusick#define cgdata(fs, c) (cgdmin(fs, c) + (fs)->fs_metaspace) /* data zone */ 530248623Smckusick#define cgmeta(fs, c) (cgdmin(fs, c)) /* meta data */ 5311541Srgrimes#define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */ 5321541Srgrimes#define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */ 5331541Srgrimes#define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */ 5341541Srgrimes#define cgtod(fs, c) (cgstart(fs, c) + (fs)->fs_cblkno) /* cg block */ 5351541Srgrimes#define cgstart(fs, c) \ 53698542Smckusick ((fs)->fs_magic == FS_UFS2_MAGIC ? cgbase(fs, c) : \ 53798542Smckusick (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask)))) 5381541Srgrimes 5391541Srgrimes/* 5401541Srgrimes * Macros for handling inode numbers: 54196755Strhodes * inode number to filesystem block offset. 5421541Srgrimes * inode number to cylinder group number. 54396755Strhodes * inode number to filesystem block address. 5441541Srgrimes */ 545203763Smckusick#define ino_to_cg(fs, x) (((ino_t)(x)) / (fs)->fs_ipg) 5461541Srgrimes#define ino_to_fsba(fs, x) \ 547203763Smckusick ((ufs2_daddr_t)(cgimin(fs, ino_to_cg(fs, (ino_t)(x))) + \ 548203763Smckusick (blkstofrags((fs), ((((ino_t)(x)) % (fs)->fs_ipg) / INOPB(fs)))))) 549203763Smckusick#define ino_to_fsbo(fs, x) (((ino_t)(x)) % INOPB(fs)) 5501541Srgrimes 5511541Srgrimes/* 55296755Strhodes * Give cylinder group number for a filesystem block. 55396755Strhodes * Give cylinder group block number for a filesystem block. 5541541Srgrimes */ 5551541Srgrimes#define dtog(fs, d) ((d) / (fs)->fs_fpg) 5561541Srgrimes#define dtogd(fs, d) ((d) % (fs)->fs_fpg) 5571541Srgrimes 5581541Srgrimes/* 5591541Srgrimes * Extract the bits for a block from a map. 5601541Srgrimes * Compute the cylinder and rotational position of a cyl block addr. 5611541Srgrimes */ 5621541Srgrimes#define blkmap(fs, map, loc) \ 5631541Srgrimes (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag))) 5641541Srgrimes 5651541Srgrimes/* 5661541Srgrimes * The following macros optimize certain frequently calculated 5671541Srgrimes * quantities by using shifts and masks in place of divisions 5681541Srgrimes * modulos and multiplications. 5691541Srgrimes */ 5701541Srgrimes#define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \ 5711541Srgrimes ((loc) & (fs)->fs_qbmask) 5721541Srgrimes#define fragoff(fs, loc) /* calculates (loc % fs->fs_fsize) */ \ 5731541Srgrimes ((loc) & (fs)->fs_qfmask) 57498542Smckusick#define lfragtosize(fs, frag) /* calculates ((off_t)frag * fs->fs_fsize) */ \ 575111238Smckusick (((off_t)(frag)) << (fs)->fs_fshift) 57618899Sbde#define lblktosize(fs, blk) /* calculates ((off_t)blk * fs->fs_bsize) */ \ 577111238Smckusick (((off_t)(blk)) << (fs)->fs_bshift) 57818899Sbde/* Use this only when `blk' is known to be small, e.g., < NDADDR. */ 57918899Sbde#define smalllblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \ 5801541Srgrimes ((blk) << (fs)->fs_bshift) 5811541Srgrimes#define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \ 5821541Srgrimes ((loc) >> (fs)->fs_bshift) 5831541Srgrimes#define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \ 5841541Srgrimes ((loc) >> (fs)->fs_fshift) 5851541Srgrimes#define blkroundup(fs, size) /* calculates roundup(size, fs->fs_bsize) */ \ 5861541Srgrimes (((size) + (fs)->fs_qbmask) & (fs)->fs_bmask) 5871541Srgrimes#define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \ 5881541Srgrimes (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask) 5891541Srgrimes#define fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \ 5901541Srgrimes ((frags) >> (fs)->fs_fragshift) 5911541Srgrimes#define blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \ 5921541Srgrimes ((blks) << (fs)->fs_fragshift) 5931541Srgrimes#define fragnum(fs, fsb) /* calculates (fsb % fs->fs_frag) */ \ 5941541Srgrimes ((fsb) & ((fs)->fs_frag - 1)) 5951541Srgrimes#define blknum(fs, fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \ 5961541Srgrimes ((fsb) &~ ((fs)->fs_frag - 1)) 5971541Srgrimes 5981541Srgrimes/* 5991541Srgrimes * Determine the number of available frags given a 60022521Sdyson * percentage to hold in reserve. 6011541Srgrimes */ 6021541Srgrimes#define freespace(fs, percentreserved) \ 6031541Srgrimes (blkstofrags((fs), (fs)->fs_cstotal.cs_nbfree) + \ 60458155Smckusick (fs)->fs_cstotal.cs_nffree - \ 605111238Smckusick (((off_t)((fs)->fs_dsize)) * (percentreserved) / 100)) 6061541Srgrimes 6071541Srgrimes/* 60896755Strhodes * Determining the size of a file block in the filesystem. 6091541Srgrimes */ 6101541Srgrimes#define blksize(fs, ip, lbn) \ 61118899Sbde (((lbn) >= NDADDR || (ip)->i_size >= smalllblktosize(fs, (lbn) + 1)) \ 6121541Srgrimes ? (fs)->fs_bsize \ 6131541Srgrimes : (fragroundup(fs, blkoff(fs, (ip)->i_size)))) 61434266Sjulian#define sblksize(fs, size, lbn) \ 61534266Sjulian (((lbn) >= NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \ 61634266Sjulian ? (fs)->fs_bsize \ 61734266Sjulian : (fragroundup(fs, blkoff(fs, (size))))) 6181541Srgrimes 6191541Srgrimes/* 620215113Skib * Number of indirects in a filesystem block. 621215113Skib */ 622215113Skib#define NINDIR(fs) ((fs)->fs_nindir) 623215113Skib 624215113Skib/* 625207141Sjeff * Indirect lbns are aligned on NDADDR addresses where single indirects 626207141Sjeff * are the negated address of the lowest lbn reachable, double indirects 627207141Sjeff * are this lbn - 1 and triple indirects are this lbn - 2. This yields 628207141Sjeff * an unusual bit order to determine level. 629207141Sjeff */ 630207141Sjeffstatic inline int 631207141Sjefflbn_level(ufs_lbn_t lbn) 632207141Sjeff{ 633207141Sjeff if (lbn >= 0) 634207141Sjeff return 0; 635207141Sjeff switch (lbn & 0x3) { 636207141Sjeff case 0: 637207141Sjeff return (0); 638207141Sjeff case 1: 639207141Sjeff break; 640207141Sjeff case 2: 641207141Sjeff return (2); 642207141Sjeff case 3: 643207141Sjeff return (1); 644207141Sjeff default: 645207141Sjeff break; 646207141Sjeff } 647207141Sjeff return (-1); 648207141Sjeff} 649215113Skib 650215113Skibstatic inline ufs_lbn_t 651215113Skiblbn_offset(struct fs *fs, int level) 652215113Skib{ 653215113Skib ufs_lbn_t res; 654215113Skib 655215113Skib for (res = 1; level > 0; level--) 656215113Skib res *= NINDIR(fs); 657215113Skib return (res); 658215113Skib} 659215113Skib 660207141Sjeff/* 66122521Sdyson * Number of inodes in a secondary storage block/fragment. 6621541Srgrimes */ 6631541Srgrimes#define INOPB(fs) ((fs)->fs_inopb) 6641541Srgrimes#define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift) 6651541Srgrimes 6661541Srgrimes/* 667207141Sjeff * Softdep journal record format. 668207141Sjeff */ 669207141Sjeff 670207141Sjeff#define JOP_ADDREF 1 /* Add a reference to an inode. */ 671207141Sjeff#define JOP_REMREF 2 /* Remove a reference from an inode. */ 672207141Sjeff#define JOP_NEWBLK 3 /* Allocate a block. */ 673207141Sjeff#define JOP_FREEBLK 4 /* Free a block or a tree of blocks. */ 674207141Sjeff#define JOP_MVREF 5 /* Move a reference from one off to another. */ 675207141Sjeff#define JOP_TRUNC 6 /* Partial truncation record. */ 676222958Sjeff#define JOP_SYNC 7 /* fsync() complete record. */ 677207141Sjeff 678207141Sjeff#define JREC_SIZE 32 /* Record and segment header size. */ 679207141Sjeff 680207141Sjeff#define SUJ_MIN (4 * 1024 * 1024) /* Minimum journal size */ 681207141Sjeff#define SUJ_MAX (32 * 1024 * 1024) /* Maximum journal size */ 682207141Sjeff#define SUJ_FILE ".sujournal" /* Journal file name */ 683207141Sjeff 684207141Sjeff/* 685207141Sjeff * Size of the segment record header. There is at most one for each disk 686212617Smckusick * block in the journal. The segment header is followed by an array of 687207141Sjeff * records. fsck depends on the first element in each record being 'op' 688207141Sjeff * and the second being 'ino'. Segments may span multiple disk blocks but 689207141Sjeff * the header is present on each. 690207141Sjeff */ 691207141Sjeffstruct jsegrec { 692207141Sjeff uint64_t jsr_seq; /* Our sequence number */ 693207141Sjeff uint64_t jsr_oldest; /* Oldest valid sequence number */ 694207141Sjeff uint16_t jsr_cnt; /* Count of valid records */ 695218602Skib uint16_t jsr_blocks; /* Count of device bsize blocks. */ 696207141Sjeff uint32_t jsr_crc; /* 32bit crc of the valid space */ 697207141Sjeff ufs_time_t jsr_time; /* timestamp for mount instance */ 698207141Sjeff}; 699207141Sjeff 700207141Sjeff/* 701207141Sjeff * Reference record. Records a single link count modification. 702207141Sjeff */ 703207141Sjeffstruct jrefrec { 704207141Sjeff uint32_t jr_op; 705227382Sgleb uint32_t jr_ino; 706227382Sgleb uint32_t jr_parent; 707207141Sjeff uint16_t jr_nlink; 708207141Sjeff uint16_t jr_mode; 709227382Sgleb int64_t jr_diroff; 710207141Sjeff uint64_t jr_unused; 711207141Sjeff}; 712207141Sjeff 713207141Sjeff/* 714207141Sjeff * Move record. Records a reference moving within a directory block. The 715207141Sjeff * nlink is unchanged but we must search both locations. 716207141Sjeff */ 717207141Sjeffstruct jmvrec { 718207141Sjeff uint32_t jm_op; 719227382Sgleb uint32_t jm_ino; 720227382Sgleb uint32_t jm_parent; 721207141Sjeff uint16_t jm_unused; 722227382Sgleb int64_t jm_oldoff; 723227382Sgleb int64_t jm_newoff; 724207141Sjeff}; 725207141Sjeff 726207141Sjeff/* 727207141Sjeff * Block record. A set of frags or tree of blocks starting at an indirect are 728207141Sjeff * freed or a set of frags are allocated. 729207141Sjeff */ 730207141Sjeffstruct jblkrec { 731207141Sjeff uint32_t jb_op; 732207141Sjeff uint32_t jb_ino; 733207141Sjeff ufs2_daddr_t jb_blkno; 734207141Sjeff ufs_lbn_t jb_lbn; 735207141Sjeff uint16_t jb_frags; 736207141Sjeff uint16_t jb_oldfrags; 737207141Sjeff uint32_t jb_unused; 738207141Sjeff}; 739207141Sjeff 740207141Sjeff/* 741207141Sjeff * Truncation record. Records a partial truncation so that it may be 742222958Sjeff * completed at check time. Also used for sync records. 743207141Sjeff */ 744207141Sjeffstruct jtrncrec { 745207141Sjeff uint32_t jt_op; 746207141Sjeff uint32_t jt_ino; 747227382Sgleb int64_t jt_size; 748207141Sjeff uint32_t jt_extsize; 749207141Sjeff uint32_t jt_pad[3]; 750207141Sjeff}; 751207141Sjeff 752207141Sjeffunion jrec { 753207141Sjeff struct jsegrec rec_jsegrec; 754207141Sjeff struct jrefrec rec_jrefrec; 755207141Sjeff struct jmvrec rec_jmvrec; 756207141Sjeff struct jblkrec rec_jblkrec; 757207141Sjeff struct jtrncrec rec_jtrncrec; 758207141Sjeff}; 759207141Sjeff 760207141Sjeff#ifdef CTASSERT 761207141SjeffCTASSERT(sizeof(struct jsegrec) == JREC_SIZE); 762207141SjeffCTASSERT(sizeof(struct jrefrec) == JREC_SIZE); 763207141SjeffCTASSERT(sizeof(struct jmvrec) == JREC_SIZE); 764207141SjeffCTASSERT(sizeof(struct jblkrec) == JREC_SIZE); 765207141SjeffCTASSERT(sizeof(struct jtrncrec) == JREC_SIZE); 766207141SjeffCTASSERT(sizeof(union jrec) == JREC_SIZE); 767207141Sjeff#endif 768207141Sjeff 7691541Srgrimesextern int inside[], around[]; 7701541Srgrimesextern u_char *fragtbl[]; 7712176Spaul 772243245Strasz/* 773243245Strasz * IOCTLs used for filesystem write suspension. 774243245Strasz */ 775243245Strasz#define UFSSUSPEND _IOW('U', 1, fsid_t) 776243245Strasz#define UFSRESUME _IO('U', 2) 777243245Strasz 7782176Spaul#endif 779