# 2.11BSD#431 - /usr/src/sys/h/fs.h

##### Macros

    BBLOCK            X
    BBSIZE            X
    INOPB             X
    LOSTFOUNDINO      X
    MAXMNTLEN         X
    MAXPIPSIZ         X
    NICFREE           X
    NICINOD           X
    NINDIR            X
    NMASK             X
    NSHIFT            X
    ROOTINO           X
    SBLOCK            X
    SBSIZE            X
    SUPERB            X
    _SYS_FS_H_        X
    blkoff            X
    dbtofsb           X
    freespace         X
    fsbtodb           X
    itod              X
    itoo              X
    lblkno            X

##### struct's

    fblk              X
    fs                X

       1: /*
       2:  * Copyright (c) 1986 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  *
       6:  *	@(#)fs.h	1.3 (2.11BSD GTE) 1995/12/24
       7:  */
       8:
       9: #ifndef _SYS_FS_H_
      10: #define _SYS_FS_H_
      11:
      12: /*
      13:  * The root inode is the root of the file system.
      14:  * Inode 0 can't be used for normal purposes and
      15:  * historically bad blocks were linked to inode 1,
      16:  * thus the root inode is 2. (inode 1 is no longer used for
      17:  * this purpose, however numerous dump tapes make this
      18:  * assumption, so we are stuck with it)
      19:  * The lost+found directory is given the next available
      20:  * inode when it is created by ``mkfs''.
      21:  */
      22: #define BBSIZE      DEV_BSIZE
      23: #define SBSIZE      DEV_BSIZE
      24: #define BBLOCK      ((daddr_t)(0))
      25: #define SBLOCK      ((daddr_t)(BBLOCK + BBSIZE / DEV_BSIZE))
      26:
      27: #define SUPERB      ((daddr_t)1)    /* block number of the super block */
      28: #define ROOTINO     ((ino_t)2)  /* i number of all roots */
      29: #define LOSTFOUNDINO    (ROOTINO + 1)
      30:
      31: #define NICINOD     100     /* number of superblock inodes */
      32: #define NICFREE     50      /* number of superblock free blocks */
      33:
      34: /*
      35:  * The path name on which the file system is mounted is maintained
      36:  * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
      37:  * the super block for this name.
      38:  */
      39: #define MAXMNTLEN 12
      40:
      41: /*
      42:  * Super block for a file system.  NOTE:  The 'fs_flock' and 'fs_ilock'
      43:  * fields MUST be on an even byte boundary because they are used as sleep()
      44:  * channels and odd values specify a network sleep().
      45:  */
      46: struct  fs
      47: {
      48:     u_short fs_isize;       /* first block after i-list */
      49:     daddr_t fs_fsize;       /* size in blocks of entire volume */
      50:     short   fs_nfree;       /* number of addresses in fs_free */
      51:     daddr_t fs_free[NICFREE];   /* free block list */
      52:     short   fs_ninode;      /* number of inodes in fs_inode */
      53:     ino_t   fs_inode[NICINOD];  /* free inode list */
      54:     char    fs_flock;       /* lock during free list manipulation */
      55:     char    fs_fmod;        /* super block modified flag */
      56:     char    fs_ilock;       /* lock during i-list manipulation */
      57:     char    fs_ronly;       /* mounted read-only flag */
      58:     time_t  fs_time;        /* last super block update */
      59:     daddr_t fs_tfree;       /* total free blocks */
      60:     ino_t   fs_tinode;      /* total free inodes */
      61:     short   fs_step;        /* optimal step in free list pattern */
      62:     short   fs_cyl;         /* number of blocks per pattern */
      63:     char    fs_fsmnt[MAXMNTLEN];    /* ordinary file mounted on */
      64:     ino_t   fs_lasti;       /* start place for circular search */
      65:     ino_t   fs_nbehind;     /* est # free inodes before s_lasti */
      66:     u_short fs_flags;       /* mount time flags */
      67: /* actually longer */
      68: };
      69:
      70: struct  fblk {
      71:     short   df_nfree;       /* number of addresses in df_free */
      72:     daddr_t df_free[NICFREE];   /* free block list */
      73: };
      74:
      75: /*
      76:  * Turn file system block numbers into disk block addresses.
      77:  * This maps file system blocks to device size blocks.
      78:  */
      79: #define fsbtodb(b)  ((daddr_t)((daddr_t)(b)<<1))
      80: #define dbtofsb(b)  ((daddr_t)((daddr_t)(b)>>1))
      81:
      82: /*
      83:  * Macros for handling inode numbers:
      84:  *     inode number to file system block offset.
      85:  *     inode number to file system block address.
      86:  */
      87: #define itoo(x)     ((int)(((x) + 2 * INOPB - 1) % INOPB))
      88: #define itod(x)     ((daddr_t)((((u_int)(x) + 2 * INOPB - 1) / INOPB)))
      89:
      90: /*
      91:  * The following macros optimize certain frequently calculated
      92:  * quantities by using shifts and masks in place of divisions
      93:  * modulos and multiplications.
      94:  */
      95: #define blkoff(loc)     /* calculates (loc % fs->fs_bsize) */ \
      96:     ((loc) & DEV_BMASK)
      97: #define lblkno(loc)     /* calculates (loc / fs->fs_bsize) */ \
      98:     ((loc) >> DEV_BSHIFT)
      99:
     100: /*
     101:  * Determine the number of available blocks given a
     102:  * percentage to hold in reserve
     103:  */
     104: #define freespace(fs, percentreserved) \
     105:     ((fs)->fs_tfree - ((fs)->fs_fsize - \
     106:     (fs)->fs_isize) * (percentreserved) / 100)
     107:
     108: /*
     109:  * INOPB is the number of inodes in a secondary storage block.
     110:  */
     111: #define INOPB   16          /* MAXBSIZE / sizeof(dinode) */
     112:
     113: /*
     114:  * NINDIR is the number of indirects in a file system block.
     115:  */
     116: #define NINDIR      (DEV_BSIZE / sizeof(daddr_t))
     117: #define NSHIFT      8       /* log2(NINDIR) */
     118: #define NMASK       0377L       /* NINDIR - 1 */
     119:
     120: /*
     121:  * We continue to implement pipes within the file system because it would
     122:  * be pretty tough for us to handle 10 4K blocked pipes on a 1M machine.
     123:  *
     124:  * 4K is the allowable buffering per write on a pipe.  This is also roughly
     125:  * the max size of the file created to implement the pipe.  If this size is
     126:  * bigger than 4096, pipes will be implemented with large files, which is
     127:  * probably not good.
     128:  */
     129: #define MAXPIPSIZ   (NDADDR * MAXBSIZE)
     130:
     131: #if defined(KERNEL) && !defined(SUPERVISOR)
     132: struct  fs *getfs();
     133: struct  fs *mountfs();
     134: #endif
     135: #endif /* _SYS_FS_H_ */

#### Defined struct's

fblk defined in line 70; used 18 times

- in /usr/src/sbin/icheck/icheck.c line 350(2), 384(2)
- in /usr/src/sbin/mkfs/mkfs.c line 54(2)
- in /usr/src/sbin/restor/restor.c line 807(2), 831(2)
- in /usr/src/sys/sys/ufs_alloc.c line 23(2), 63(2), 247(2)
- in /usr/src/usr.sbin/mkproto/mkproto.c line 367(2)

fs defined in line 46; used 88 times

- in line 132-133(4)
- in /usr/src/bin/df.c line 219(2)
- in /usr/src/old/dump/dumptraverse.c line 4(2)
- in /usr/src/sbin/dcheck/dcheck.c line 30(2)
- in /usr/src/sbin/dump/dumptraverse.c line 7(2)
- in /usr/src/sbin/icheck/icheck.c line 23(2)
- in /usr/src/sbin/mkfs/mkfs.c line 59(2)
- in /usr/src/sbin/ncheck/ncheck.c line 28(2)
- in /usr/src/sbin/quotacheck/quotacheck.c line 69(2)
- in /usr/src/sbin/restor/restor.c line 44(2)
- in /usr/src/sbin/savecore/savecore.c line 263(2)
- in /usr/src/sys/h/mount.h line 54(2)
- in /usr/src/sys/pdp/machdep2.c line 381(2)
- in /usr/src/sys/sys/init_main.c line 61(2)
- in /usr/src/sys/sys/quota_subr.c line 84(2)
- in /usr/src/sys/sys/ufs_alloc.c line 38(2), 81-83(4), 136(2), 245(2), 289(2), 311(2)
- in /usr/src/sys/sys/ufs_inode.c line 102(2)
- in /usr/src/sys/sys/ufs_mount.c line 37(2), 139(2), 158(2), 166(2), 220(2)
- in /usr/src/sys/sys/ufs_namei.c line 119(2), 1072(2)
- in /usr/src/sys/sys/ufs_subr.c line 29(2), 107(2), 128-133(4), 146(2)
- in /usr/src/sys/sys/ufs_syscalls2.c line 66(2), 129(2), 155(2), 170(2)
- in /usr/src/usr.sbin/lpr/recvjob.c line 257(2)
- in /usr/src/usr.sbin/mkproto/mkproto.c line 29-33(4)
- in /usr/src/usr.sbin/quot/quot.c line 24(2)

#### Defined macros

BBLOCK defined in line 24; used 1 times

- in line 25

BBSIZE defined in line 22; used 10 times

- in line 25
- in /usr/src/bin/disklabel/disklabel.c line 94, 353(2), 415-420(3), 483(2)
- in /usr/src/lib/libc/gen/disklabel.c line 143

INOPB defined in line 111; used 40 times

- in line 87-88(4)
- in /usr/src/bin/df.c line 257
- in /usr/src/old/dump/dumptraverse.c line 5, 18, 24
- in /usr/src/sbin/dcheck/dcheck.c line 41, 114, 130, 142
- in /usr/src/sbin/dump/dumptraverse.c line 8, 21, 27
- in /usr/src/sbin/fsck/setup.c line 78-83(2)
- in /usr/src/sbin/icheck/icheck.c line 24, 147, 173
- in /usr/src/sbin/mkfs/mkfs.c line 233-239(4), 254, 443
- in /usr/src/sbin/ncheck/ncheck.c line 29, 126-131(2), 144, 156
- in /usr/src/sbin/quotacheck/quotacheck.c line 224
- in /usr/src/sbin/restor/restor.c line 346, 1206-1209(2), 1221-1223(2)
- in /usr/src/sys/sys/ufs_alloc.c line 201-205(2)
- in /usr/src/sys/sys/ufs_syscalls2.c line 75

LOSTFOUNDINO defined in line 29; used 3 times

- in /usr/src/sbin/mkfs/mkfs.c line 274-277(2), 298

MAXMNTLEN defined in line 39; used 1 times

- in line 63

MAXPIPSIZ defined in line 129; used 5 times

- in /usr/src/sys/sys/sys_pipe.c line 166, 192, 207, 248
- in /usr/src/sys/sys/ufs_inode.c line 460

NICFREE defined in line 32; used 21 times

- in line 51, 72
- in /usr/src/sbin/fsck/pass5.c line 43, 108, 172, 183
- in /usr/src/sbin/icheck/icheck.c line 356, 367, 373, 389-392(2)
- in /usr/src/sbin/mkfs/mkfs.c line 355, 396-398(2)
- in /usr/src/sbin/restor/restor.c line 810-812(2), 845
- in /usr/src/sys/sys/ufs_alloc.c line 51, 260
- in /usr/src/sys/sys/ufs_subr.c line 139
- in /usr/src/usr.sbin/mkproto/mkproto.c line 378

NICINOD defined in line 31; used 7 times

- in line 53
- in /usr/src/sys/sys/ufs_alloc.c line 181, 211, 219-222(2), 295
- in /usr/src/sys/sys/ufs_subr.c line 139

NINDIR defined in line 116; used 40 times

- in /usr/src/old/dump/dumptraverse.c line 68-74(3), 81
- in /usr/src/sbin/dcheck/dcheck.c line 249
- in /usr/src/sbin/dump/dumptraverse.c line 69-75(3), 82
- in /usr/src/sbin/fsck/inode.c line 82-87(5)
- in /usr/src/sbin/fsck/pass1.c line 98
- in /usr/src/sbin/icheck/icheck.c line 229-231(3), 272, 284, 296
- in /usr/src/sbin/ncheck/ncheck.c line 366-371(2)
- in /usr/src/sbin/restor/restor.c line 785-789(2), 867
- in /usr/src/sys/sys/ufs_bmap.c line 133
- in /usr/src/sys/sys/ufs_inode.c line 488-489(3), 616-619(3), 643, 667, 706-710(3)
- in /usr/src/usr.sbin/mkproto/mkproto.c line 306, 335

NMASK defined in line 118; used 3 times

- in /usr/src/sbin/restor/restor.c line 910
- in /usr/src/sys/pdpstand/sys.c line 208
- in /usr/src/sys/sys/ufs_bmap.c line 128

NSHIFT defined in line 117; used 9 times

- in /usr/src/sbin/restor/restor.c line 887-888(2), 909
- in /usr/src/sys/pdpstand/sys.c line 167-168(2), 207
- in /usr/src/sys/sys/ufs_bmap.c line 86-87(2), 127

ROOTINO defined in line 28; used 76 times

- in line 29
- in /usr/src/sbin/dcheck/dcheck.c line 166
- in /usr/src/sbin/dump/dumpdir.c line 94
- in /usr/src/sbin/fsck/dir.c line 202, 306-323(6), 342, 348-351(2), 411(2), 510
- in /usr/src/sbin/fsck/inode.c line 121, 179, 195, 251
- in /usr/src/sbin/fsck/main.c line 234
- in /usr/src/sbin/fsck/pass1.c line 39
- in /usr/src/sbin/fsck/pass1b.c line 28-29(2)
- in /usr/src/sbin/fsck/pass2.c line 28-30(2), 36-38(4), 44-53(7), 60-80(9)
- in /usr/src/sbin/fsck/pass3.c line 26, 36
- in /usr/src/sbin/fsck/pass4.c line 27
- in /usr/src/sbin/fsck/utilities.c line 270, 291
- in /usr/src/sbin/mkfs/mkfs.c line 272-278(3), 308
- in /usr/src/sbin/ncheck/ncheck.c line 312
- in /usr/src/sbin/quotacheck/quotacheck.c line 226, 503
- in /usr/src/sbin/restor/restor.c line 637
- in /usr/src/sys/pdpstand/sys.c line 105
- in /usr/src/sys/sys/init_main.c line 206-208(2)
- in /usr/src/sys/sys/ufs_alloc.c line 161
- in /usr/src/sys/sys/ufs_inode.c line 139
- in /usr/src/sys/sys/ufs_mount.c line 66, 117
- in /usr/src/sys/sys/ufs_namei.c line 643-644(2), 1166, 1189
- in /usr/src/usr.sbin/mkproto/mkproto.c line 103-106(3), 153, 167, 274

SBLOCK defined in line 25; used 18 times

- in /usr/src/bin/df.c line 243
- in /usr/src/sbin/dcheck/dcheck.c line 113
- in /usr/src/sbin/fsck/setup.c line 73-75(2)
- in /usr/src/sbin/fsck/utilities.c line 142-143(2)
- in /usr/src/sbin/icheck/icheck.c line 146, 184
- in /usr/src/sbin/mkfs/mkfs.c line 262
- in /usr/src/sbin/ncheck/ncheck.c line 124
- in /usr/src/sbin/quotacheck/quotacheck.c line 223
- in /usr/src/sbin/restor/restor.c line 345, 367, 381
- in /usr/src/sys/sys/ufs_mount.c line 200
- in /usr/src/usr.sbin/lpr/recvjob.c line 259
- in /usr/src/usr.sbin/mkproto/mkproto.c line 62-65(2)

SBSIZE defined in line 23; used 10 times

- in /usr/src/bin/df.c line 220, 243
- in /usr/src/bin/disklabel/disklabel.c line 749
- in /usr/src/lib/libc/gen/disklabel.c line 147
- in /usr/src/sbin/dcheck/dcheck.c line 113
- in /usr/src/sbin/fsck/setup.c line 73-76(2)
- in /usr/src/sbin/ncheck/ncheck.c line 124
- in /usr/src/sbin/quotacheck/quotacheck.c line 223
- in /usr/src/sys/pdpstand/conf.c line 167

SUPERB defined in line 27; used 6 times

- in /usr/src/sbin/fsck/setup.c line 78-83(2)
- in /usr/src/sbin/savecore/savecore.c line 271
- in /usr/src/sys/sys/ufs_alloc.c line 77, 193
- in /usr/src/sys/sys/ufs_syscalls2.c line 152

_SYS_FS_H_ defined in line 10; used 1 times

- in line 9

blkoff defined in line 95; used 9 times

- in /usr/src/sbin/dcheck/dcheck.c line 220
- in /usr/src/sbin/ncheck/ncheck.c line 280, 287
- in /usr/src/sys/pdpstand/sys.c line 263
- in /usr/src/sys/sys/sys_inode.c line 223
- in /usr/src/sys/sys/ufs_inode.c line 497
- in /usr/src/sys/sys/ufs_namei.c line 389, 408, 1092

dbtofsb defined in line 80; used 46 times

- in /usr/src/sbin/mkfs/mkfs.c line 185-189(2), 204
- in /usr/src/sys/pdpstand/sys.c line 314, 342
- in /usr/src/sys/pdpuba/ht.c line 178, 223-225(2), 237-238(2), 259-265(3), 313, 364-372(3)
- in /usr/src/sys/pdpuba/tm.c line 276, 358, 366, 378-383(2), 405-410(3), 550, 593
- in /usr/src/sys/pdpuba/ts.c line 262, 329, 337, 349-354(2), 375-381(3), 554, 585-587(2), 593, 599
- in /usr/src/sys/sys/kern_exec.c line 246, 285, 324
- in /usr/src/sys/sys/ufs_bmap.c line 58, 104, 141

freespace defined in line 104; never used
fsbtodb defined in line 79; used 10 times

- in /usr/src/sys/pdpstand/sys.c line 78, 200, 269, 317, 340-343(2)
- in /usr/src/sys/sys/ufs_bio.c line 219, 255, 399
- in /usr/src/sys/sys/ufs_subr.c line 77

itod defined in line 88; used 11 times

- in /usr/src/sbin/clri/clri.c line 56, 68
- in /usr/src/sbin/fsck/inode.c line 123
- in /usr/src/sbin/mkfs/mkfs.c line 448
- in /usr/src/sbin/quotacheck/quotacheck.c line 482
- in /usr/src/sys/pdpstand/sys.c line 77
- in /usr/src/sys/sys/ufs_alloc.c line 188
- in /usr/src/sys/sys/ufs_inode.c line 198, 379
- in /usr/src/usr.sbin/mkproto/mkproto.c line 103, 351

itoo defined in line 87; used 9 times

- in /usr/src/sbin/clri/clri.c line 71
- in /usr/src/sbin/fsck/inode.c line 134
- in /usr/src/sbin/mkfs/mkfs.c line 455
- in /usr/src/sys/pdpstand/sys.c line 84
- in /usr/src/sys/sys/ufs_alloc.c line 185
- in /usr/src/sys/sys/ufs_inode.c line 228, 404
- in /usr/src/usr.sbin/mkproto/mkproto.c line 105, 352

lblkno defined in line 97; used 12 times

- in /usr/src/sbin/dcheck/dcheck.c line 214
- in /usr/src/sbin/fsck/dir.c line 441
- in /usr/src/sbin/ncheck/ncheck.c line 281
- in /usr/src/sys/pdpstand/sys.c line 265
- in /usr/src/sys/sys/kern_exec.c line 246, 285, 324
- in /usr/src/sys/sys/sys_inode.c line 222
- in /usr/src/sys/sys/ufs_inode.c line 470, 486, 499
- in /usr/src/sys/sys/ufs_namei.c line 1073

#### Usage of this include

fs.h used 60 times

- in /usr/src/bin/df.c line 215
- in /usr/src/bin/disklabel/disklabel.c line 54
- in /usr/src/lib/libc/gen/disklabel.c line 40
- in /usr/src/new/crash/crash.c line 82
- in /usr/src/new/crash/crashsubs.c line 21
- in /usr/src/old/dump/dump.h line 18
- in /usr/src/old/dump/dumpdir.c line 4
- in /usr/src/sbin/clri/clri.c line 8
- in /usr/src/sbin/dcheck/dcheck.c line 24
- in /usr/src/sbin/dump/dump.h line 12
- in /usr/src/sbin/dump/dumpdir.c line 4
- in /usr/src/sbin/fsck/dir.c line 13
- in /usr/src/sbin/fsck/inode.c line 14
- in /usr/src/sbin/fsck/main.c line 17
- in /usr/src/sbin/fsck/pass1.c line 14
- in /usr/src/sbin/fsck/pass1b.c line 13
- in /usr/src/sbin/fsck/pass2.c line 13
- in /usr/src/sbin/fsck/pass3.c line 13
- in /usr/src/sbin/fsck/pass4.c line 13
- in /usr/src/sbin/fsck/pass5.c line 13
- in /usr/src/sbin/fsck/setup.c line 15
- in /usr/src/sbin/fsck/utilities.c line 15
- in /usr/src/sbin/icheck/icheck.c line 21
- in /usr/src/sbin/mkfs/mkfs.c line 26
- in /usr/src/sbin/ncheck/ncheck.c line 24
- in /usr/src/sbin/quotacheck/quotacheck.c line 53
- in /usr/src/sbin/restor/restor.c line 27
- in /usr/src/sbin/savecore/savecore.c line 9
- in /usr/src/sys/CURLY/param.c line 19
- in /usr/src/sys/GENERIC/param.c line 19
- in /usr/src/sys/QT/param.c line 19
- in /usr/src/sys/conf/param.c line 19
- in /usr/src/sys/h/mount.h line 12
- in /usr/src/sys/pdp/machdep2.c line 17
- in /usr/src/sys/pdpstand/saio.h line 16
- in /usr/src/sys/pdpuba/ht.c line 21
- in /usr/src/sys/pdpuba/tm.c line 21
- in /usr/src/sys/pdpuba/ts.c line 21
- in /usr/src/sys/sys/init_main.c line 13
- in /usr/src/sys/sys/kern_exec.c line 21
- in /usr/src/sys/sys/kern_xxx.c line 15
- in /usr/src/sys/sys/quota_kern.c line 32
- in /usr/src/sys/sys/quota_subr.c line 21
- in /usr/src/sys/sys/quota_sys.c line 20
- in /usr/src/sys/sys/quota_ufs.c line 21
- in /usr/src/sys/sys/sys_inode.c line 17
- in /usr/src/sys/sys/sys_pipe.c line 15
- in /usr/src/sys/sys/ufs_alloc.c line 12
- in /usr/src/sys/sys/ufs_bio.c line 13
- in /usr/src/sys/sys/ufs_bmap.c line 18
- in /usr/src/sys/sys/ufs_fio.c line 11
- in /usr/src/sys/sys/ufs_inode.c line 15
- in /usr/src/sys/sys/ufs_mount.c line 15
- in /usr/src/sys/sys/ufs_namei.c line 14
- in /usr/src/sys/sys/ufs_subr.c line 14
- in /usr/src/sys/sys/ufs_syscalls.c line 14
- in /usr/src/sys/sys/ufs_syscalls2.c line 14
- in /usr/src/usr.sbin/lpr/recvjob.c line 17
- in /usr/src/usr.sbin/mkproto/mkproto.c line 25
- in /usr/src/usr.sbin/quot/quot.c line 10

Last modified: 1995-12-27 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 908 |