Lines Matching defs:fs
61 * @(#)fs.h 8.13 (Berkeley) 3/21/95
81 * For file system fs, the offsets of the various blocks of interest
83 * [fs->fs_sblkno] Super-block
84 * [fs->fs_cblkno] Cylinder group block
85 * [fs->fs_iblkno] Inode blocks
86 * [fs->fs_dblkno] Data blocks
87 * The beginning of cylinder group cg in fs, is given by
88 * the ``cgbase(fs, cg)'' macro.
113 * information in the inode, using the ``blksize(fs, ip, lbn)'' macro.
208 struct fs {
218 int32_t fs_size; /* number of blocks in fs */
219 int32_t fs_dsize; /* number of data blocks in fs */
221 int32_t fs_bsize; /* size of basic blocks in fs */
222 int32_t fs_fsize; /* size of frag blocks in fs */
223 int32_t fs_frag; /* number of frags in a block in fs */
323 #define fs_postbl(fs, cylno) \
324 (((fs)->fs_postblformat == FS_42POSTBLFMT) \
325 ? ((fs)->fs_opostbl[cylno]) \
326 : ((int16_t *)((u_int8_t *)(fs) + \
327 (fs)->fs_postbloff) + (cylno) * (fs)->fs_nrpos))
328 #define fs_rotbl(fs) \
329 (((fs)->fs_postblformat == FS_42POSTBLFMT) \
330 ? ((fs)->fs_space) \
331 : ((u_int8_t *)((u_int8_t *)(fs) + (fs)->fs_rotbloff)))
339 #define CGSIZE(fs) \
341 /* blktot size */ (fs)->fs_cpg * sizeof(int32_t) + \
342 /* blks size */ (fs)->fs_cpg * (fs)->fs_nrpos * sizeof(int16_t) + \
343 /* inode map */ howmany((fs)->fs_ipg, NBBY) + \
344 /* block map */ howmany((fs)->fs_cpg * (fs)->fs_spc / NSPF(fs), NBBY) +\
345 /* if present */ ((fs)->fs_contigsumsize <= 0 ? 0 : \
346 /* cluster sum */ (fs)->fs_contigsumsize * sizeof(int32_t) + \
347 /* cluster map */ howmany((fs)->fs_cpg * (fs)->fs_spc / NSPB(fs), NBBY)))
354 #define fs_cs(fs, indx) fs_csp[indx]
393 #define cg_blks(fs, cgp, cylno) \
397 (cgp)->cg_boff) + (cylno) * (fs)->fs_nrpos))
442 #define fsbtodb(fs, b) ((b) << (fs)->fs_fsbtodb)
443 #define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb)
449 #define cgbase(fs, c) ((ufs_daddr_t)((fs)->fs_fpg * (c)))
450 #define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */
451 #define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */
452 #define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */
453 #define cgtod(fs, c) (cgstart(fs, c) + (fs)->fs_cblkno) /* cg block */
454 #define cgstart(fs, c) \
455 (cgbase(fs, c) + (fs)->fs_cgoffset * ((c) & ~((fs)->fs_cgmask)))
463 #define ino_to_cg(fs, x) ((x) / (fs)->fs_ipg)
464 #define ino_to_fsba(fs, x) \
465 ((ufs_daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + \
466 (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs))))))
467 #define ino_to_fsbo(fs, x) ((x) % INOPB(fs))
473 #define dtog(fs, d) ((d) / (fs)->fs_fpg)
474 #define dtogd(fs, d) ((d) % (fs)->fs_fpg)
480 #define blkmap(fs, map, loc) \
481 (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag)))
482 #define cbtocylno(fs, bno) \
483 ((bno) * NSPF(fs) / (fs)->fs_spc)
484 #define cbtorpos(fs, bno) \
485 (((bno) * NSPF(fs) % (fs)->fs_spc / (fs)->fs_nsect * (fs)->fs_trackskew + \
486 (bno) * NSPF(fs) % (fs)->fs_spc % (fs)->fs_nsect * (fs)->fs_interleave) % \
487 (fs)->fs_nsect * (fs)->fs_nrpos / (fs)->fs_npsect)
494 #define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \
495 ((loc) & (fs)->fs_qbmask)
496 #define fragoff(fs, loc) /* calculates (loc % fs->fs_fsize) */ \
497 ((loc) & (fs)->fs_qfmask)
498 #define lblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \
499 ((blk) << (fs)->fs_bshift)
500 #define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \
501 ((loc) >> (fs)->fs_bshift)
502 #define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \
503 ((loc) >> (fs)->fs_fshift)
504 #define blkroundup(fs, size) /* calculates roundup(size, fs->fs_bsize) */ \
505 (((size) + (fs)->fs_qbmask) & (fs)->fs_bmask)
506 #define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \
507 (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask)
508 #define fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \
509 ((frags) >> (fs)->fs_fragshift)
510 #define blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \
511 ((blks) << (fs)->fs_fragshift)
512 #define fragnum(fs, fsb) /* calculates (fsb % fs->fs_frag) */ \
513 ((fsb) & ((fs)->fs_frag - 1))
514 #define blknum(fs, fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \
515 ((fsb) &~ ((fs)->fs_frag - 1))
521 #define freespace(fs, percentreserved) \
522 (blkstofrags((fs), (fs)->fs_cstotal.cs_nbfree) + \
523 (fs)->fs_cstotal.cs_nffree - ((fs)->fs_dsize * (percentreserved) / 100))
528 #define blksize(fs, ip, lbn) \
529 (((lbn) >= NDADDR || (ip)->i_size >= ((lbn) + 1) << (fs)->fs_bshift) \
530 ? (fs)->fs_bsize \
531 : (fragroundup(fs, blkoff(fs, (ip)->i_size))))
532 #define dblksize(fs, dip, lbn) \
533 (((lbn) >= NDADDR || (dip)->di_size >= ((lbn) + 1) << (fs)->fs_bshift) \
534 ? (fs)->fs_bsize \
535 : (fragroundup(fs, blkoff(fs, (dip)->di_size))))
541 #define NSPB(fs) ((fs)->fs_nspf << (fs)->fs_fragshift)
542 #define NSPF(fs) ((fs)->fs_nspf)
547 #define INOPB(fs) ((fs)->fs_inopb)
548 #define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift)
553 #define NINDIR(fs) ((fs)->fs_nindir)