fs.h (202113) | fs.h (203763) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)fs.h 8.13 (Berkeley) 3/21/95 | 1/*- 2 * Copyright (c) 1982, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)fs.h 8.13 (Berkeley) 3/21/95 |
30 * $FreeBSD: head/sys/ufs/ffs/fs.h 202113 2010-01-11 20:44:05Z mckusick $ | 30 * $FreeBSD: head/sys/ufs/ffs/fs.h 203763 2010-02-10 20:10:35Z mckusick $ |
31 */ 32 33#ifndef _UFS_FFS_FS_H_ 34#define _UFS_FFS_FS_H_ 35 36/* 37 * Each disk drive contains some number of filesystems. 38 * A filesystem consists of a number of cylinder groups. --- 220 unchanged lines hidden (view full) --- 259 int32_t fs_cblkno; /* offset of cyl-block in filesys */ 260 int32_t fs_iblkno; /* offset of inode-blocks in filesys */ 261 int32_t fs_dblkno; /* offset of first data after cg */ 262 int32_t fs_old_cgoffset; /* cylinder group offset in cylinder */ 263 int32_t fs_old_cgmask; /* used to calc mod fs_ntrak */ 264 int32_t fs_old_time; /* last time written */ 265 int32_t fs_old_size; /* number of blocks in fs */ 266 int32_t fs_old_dsize; /* number of data blocks in fs */ | 31 */ 32 33#ifndef _UFS_FFS_FS_H_ 34#define _UFS_FFS_FS_H_ 35 36/* 37 * Each disk drive contains some number of filesystems. 38 * A filesystem consists of a number of cylinder groups. --- 220 unchanged lines hidden (view full) --- 259 int32_t fs_cblkno; /* offset of cyl-block in filesys */ 260 int32_t fs_iblkno; /* offset of inode-blocks in filesys */ 261 int32_t fs_dblkno; /* offset of first data after cg */ 262 int32_t fs_old_cgoffset; /* cylinder group offset in cylinder */ 263 int32_t fs_old_cgmask; /* used to calc mod fs_ntrak */ 264 int32_t fs_old_time; /* last time written */ 265 int32_t fs_old_size; /* number of blocks in fs */ 266 int32_t fs_old_dsize; /* number of data blocks in fs */ |
267 int32_t fs_ncg; /* number of cylinder groups */ | 267 u_int32_t fs_ncg; /* number of cylinder groups */ |
268 int32_t fs_bsize; /* size of basic blocks in fs */ 269 int32_t fs_fsize; /* size of frag blocks in fs */ 270 int32_t fs_frag; /* number of frags in a block in fs */ 271/* these are configuration parameters */ 272 int32_t fs_minfree; /* minimum percentage of free blocks */ 273 int32_t fs_old_rotdelay; /* num of ms for optimal next block */ 274 int32_t fs_old_rps; /* disk revolutions per second */ 275/* these fields can be computed from the others */ --- 23 unchanged lines hidden (view full) --- 299 int32_t fs_old_csaddr; /* blk addr of cyl grp summary area */ 300 int32_t fs_cssize; /* size of cyl grp summary area */ 301 int32_t fs_cgsize; /* cylinder group size */ 302 int32_t fs_spare2; /* old fs_ntrak */ 303 int32_t fs_old_nsect; /* sectors per track */ 304 int32_t fs_old_spc; /* sectors per cylinder */ 305 int32_t fs_old_ncyl; /* cylinders in filesystem */ 306 int32_t fs_old_cpg; /* cylinders per group */ | 268 int32_t fs_bsize; /* size of basic blocks in fs */ 269 int32_t fs_fsize; /* size of frag blocks in fs */ 270 int32_t fs_frag; /* number of frags in a block in fs */ 271/* these are configuration parameters */ 272 int32_t fs_minfree; /* minimum percentage of free blocks */ 273 int32_t fs_old_rotdelay; /* num of ms for optimal next block */ 274 int32_t fs_old_rps; /* disk revolutions per second */ 275/* these fields can be computed from the others */ --- 23 unchanged lines hidden (view full) --- 299 int32_t fs_old_csaddr; /* blk addr of cyl grp summary area */ 300 int32_t fs_cssize; /* size of cyl grp summary area */ 301 int32_t fs_cgsize; /* cylinder group size */ 302 int32_t fs_spare2; /* old fs_ntrak */ 303 int32_t fs_old_nsect; /* sectors per track */ 304 int32_t fs_old_spc; /* sectors per cylinder */ 305 int32_t fs_old_ncyl; /* cylinders in filesystem */ 306 int32_t fs_old_cpg; /* cylinders per group */ |
307 int32_t fs_ipg; /* inodes per group */ | 307 u_int32_t fs_ipg; /* inodes per group */ |
308 int32_t fs_fpg; /* blocks per group * fs_frag */ 309/* this data must be re-computed after crashes */ 310 struct csum fs_old_cstotal; /* cylinder summary information */ 311/* these fields are cleared at mount time */ 312 int8_t fs_fmod; /* super block modified flag */ 313 int8_t fs_clean; /* filesystem is clean flag */ 314 int8_t fs_ronly; /* mounted read-only flag */ 315 int8_t fs_old_flags; /* old FS_ flags */ --- 14 unchanged lines hidden (view full) --- 330 int64_t fs_sparecon64[16]; /* old rotation block list head */ 331 int64_t fs_sblockloc; /* byte offset of standard superblock */ 332 struct csum_total fs_cstotal; /* (u) cylinder summary information */ 333 ufs_time_t fs_time; /* last time written */ 334 int64_t fs_size; /* number of blocks in fs */ 335 int64_t fs_dsize; /* number of data blocks in fs */ 336 ufs2_daddr_t fs_csaddr; /* blk addr of cyl grp summary area */ 337 int64_t fs_pendingblocks; /* (u) blocks being freed */ | 308 int32_t fs_fpg; /* blocks per group * fs_frag */ 309/* this data must be re-computed after crashes */ 310 struct csum fs_old_cstotal; /* cylinder summary information */ 311/* these fields are cleared at mount time */ 312 int8_t fs_fmod; /* super block modified flag */ 313 int8_t fs_clean; /* filesystem is clean flag */ 314 int8_t fs_ronly; /* mounted read-only flag */ 315 int8_t fs_old_flags; /* old FS_ flags */ --- 14 unchanged lines hidden (view full) --- 330 int64_t fs_sparecon64[16]; /* old rotation block list head */ 331 int64_t fs_sblockloc; /* byte offset of standard superblock */ 332 struct csum_total fs_cstotal; /* (u) cylinder summary information */ 333 ufs_time_t fs_time; /* last time written */ 334 int64_t fs_size; /* number of blocks in fs */ 335 int64_t fs_dsize; /* number of data blocks in fs */ 336 ufs2_daddr_t fs_csaddr; /* blk addr of cyl grp summary area */ 337 int64_t fs_pendingblocks; /* (u) blocks being freed */ |
338 int32_t fs_pendinginodes; /* (u) inodes being freed */ 339 int32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */ 340 int32_t fs_avgfilesize; /* expected average file size */ 341 int32_t fs_avgfpdir; /* expected # of files per directory */ | 338 u_int32_t fs_pendinginodes; /* (u) inodes being freed */ 339 ino_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */ 340 u_int32_t fs_avgfilesize; /* expected average file size */ 341 u_int32_t fs_avgfpdir; /* expected # of files per directory */ |
342 int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */ 343 int32_t fs_sparecon32[26]; /* reserved for future constants */ 344 int32_t fs_flags; /* see FS_ flags below */ 345 int32_t fs_contigsumsize; /* size of cluster summary array */ 346 int32_t fs_maxsymlinklen; /* max length of an internal symlink */ 347 int32_t fs_old_inodefmt; /* format of on-disk inodes */ 348 u_int64_t fs_maxfilesize; /* maximum representable file size */ 349 int64_t fs_qbmask; /* ~fs_bmask for use with 64-bit size */ --- 108 unchanged lines hidden (view full) --- 458/* 459 * Cylinder group block for a filesystem. 460 */ 461#define CG_MAGIC 0x090255 462struct cg { 463 int32_t cg_firstfield; /* historic cyl groups linked list */ 464 int32_t cg_magic; /* magic number */ 465 int32_t cg_old_time; /* time last written */ | 342 int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */ 343 int32_t fs_sparecon32[26]; /* reserved for future constants */ 344 int32_t fs_flags; /* see FS_ flags below */ 345 int32_t fs_contigsumsize; /* size of cluster summary array */ 346 int32_t fs_maxsymlinklen; /* max length of an internal symlink */ 347 int32_t fs_old_inodefmt; /* format of on-disk inodes */ 348 u_int64_t fs_maxfilesize; /* maximum representable file size */ 349 int64_t fs_qbmask; /* ~fs_bmask for use with 64-bit size */ --- 108 unchanged lines hidden (view full) --- 458/* 459 * Cylinder group block for a filesystem. 460 */ 461#define CG_MAGIC 0x090255 462struct cg { 463 int32_t cg_firstfield; /* historic cyl groups linked list */ 464 int32_t cg_magic; /* magic number */ 465 int32_t cg_old_time; /* time last written */ |
466 int32_t cg_cgx; /* we are the cgx'th cylinder group */ | 466 u_int32_t cg_cgx; /* we are the cgx'th cylinder group */ |
467 int16_t cg_old_ncyl; /* number of cyl's this cg */ 468 int16_t cg_old_niblk; /* number of inode blocks this cg */ | 467 int16_t cg_old_ncyl; /* number of cyl's this cg */ 468 int16_t cg_old_niblk; /* number of inode blocks this cg */ |
469 int32_t cg_ndblk; /* number of data blocks this cg */ 470 struct csum cg_cs; /* cylinder summary information */ 471 int32_t cg_rotor; /* position of last used block */ 472 int32_t cg_frotor; /* position of last used frag */ 473 int32_t cg_irotor; /* position of last used inode */ 474 int32_t cg_frsum[MAXFRAG]; /* counts of available frags */ | 469 u_int32_t cg_ndblk; /* number of data blocks this cg */ 470 struct csum cg_cs; /* cylinder summary information */ 471 u_int32_t cg_rotor; /* position of last used block */ 472 u_int32_t cg_frotor; /* position of last used frag */ 473 u_int32_t cg_irotor; /* position of last used inode */ 474 u_int32_t cg_frsum[MAXFRAG]; /* counts of available frags */ |
475 int32_t cg_old_btotoff; /* (int32) block totals per cylinder */ 476 int32_t cg_old_boff; /* (u_int16) free block positions */ | 475 int32_t cg_old_btotoff; /* (int32) block totals per cylinder */ 476 int32_t cg_old_boff; /* (u_int16) free block positions */ |
477 int32_t cg_iusedoff; /* (u_int8) used inode map */ 478 int32_t cg_freeoff; /* (u_int8) free block map */ 479 int32_t cg_nextfreeoff; /* (u_int8) next available space */ 480 int32_t cg_clustersumoff; /* (u_int32) counts of avail clusters */ 481 int32_t cg_clusteroff; /* (u_int8) free cluster map */ 482 int32_t cg_nclusterblks; /* number of clusters this cg */ 483 int32_t cg_niblk; /* number of inode blocks this cg */ 484 int32_t cg_initediblk; /* last initialized inode */ 485 int32_t cg_unrefs; /* number of unreferenced inodes */ | 477 u_int32_t cg_iusedoff; /* (u_int8) used inode map */ 478 u_int32_t cg_freeoff; /* (u_int8) free block map */ 479 u_int32_t cg_nextfreeoff; /* (u_int8) next available space */ 480 u_int32_t cg_clustersumoff; /* (u_int32) counts of avail clusters */ 481 u_int32_t cg_clusteroff; /* (u_int8) free cluster map */ 482 u_int32_t cg_nclusterblks; /* number of clusters this cg */ 483 u_int32_t cg_niblk; /* number of inode blocks this cg */ 484 u_int32_t cg_initediblk; /* last initialized inode */ 485 u_int32_t cg_unrefs; /* number of unreferenced inodes */ |
486 int32_t cg_sparecon32[2]; /* reserved for future use */ 487 ufs_time_t cg_time; /* time last written */ 488 int64_t cg_sparecon64[3]; /* reserved for future use */ 489 u_int8_t cg_space[1]; /* space for cylinder group maps */ 490/* actually longer */ 491}; 492 493/* --- 30 unchanged lines hidden (view full) --- 524 (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask)))) 525 526/* 527 * Macros for handling inode numbers: 528 * inode number to filesystem block offset. 529 * inode number to cylinder group number. 530 * inode number to filesystem block address. 531 */ | 486 int32_t cg_sparecon32[2]; /* reserved for future use */ 487 ufs_time_t cg_time; /* time last written */ 488 int64_t cg_sparecon64[3]; /* reserved for future use */ 489 u_int8_t cg_space[1]; /* space for cylinder group maps */ 490/* actually longer */ 491}; 492 493/* --- 30 unchanged lines hidden (view full) --- 524 (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask)))) 525 526/* 527 * Macros for handling inode numbers: 528 * inode number to filesystem block offset. 529 * inode number to cylinder group number. 530 * inode number to filesystem block address. 531 */ |
532#define ino_to_cg(fs, x) ((x) / (fs)->fs_ipg) | 532#define ino_to_cg(fs, x) (((ino_t)(x)) / (fs)->fs_ipg) |
533#define ino_to_fsba(fs, x) \ | 533#define ino_to_fsba(fs, x) \ |
534 ((ufs2_daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + \ 535 (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs)))))) 536#define ino_to_fsbo(fs, x) ((x) % INOPB(fs)) | 534 ((ufs2_daddr_t)(cgimin(fs, ino_to_cg(fs, (ino_t)(x))) + \ 535 (blkstofrags((fs), ((((ino_t)(x)) % (fs)->fs_ipg) / INOPB(fs)))))) 536#define ino_to_fsbo(fs, x) (((ino_t)(x)) % INOPB(fs)) |
537 538/* 539 * Give cylinder group number for a filesystem block. 540 * Give cylinder group block number for a filesystem block. 541 */ 542#define dtog(fs, d) ((d) / (fs)->fs_fpg) 543#define dtogd(fs, d) ((d) % (fs)->fs_fpg) 544 --- 77 unchanged lines hidden --- | 537 538/* 539 * Give cylinder group number for a filesystem block. 540 * Give cylinder group block number for a filesystem block. 541 */ 542#define dtog(fs, d) ((d) / (fs)->fs_fpg) 543#define dtogd(fs, d) ((d) % (fs)->fs_fpg) 544 --- 77 unchanged lines hidden --- |