Annotation of researchv10dc/man/man5/filsys.5, revision 1.1

1.1     ! root        1: .TH FILSYS 5
        !             2: .CT 2 sa
        !             3: .SH NAME
        !             4: filsys, flblk, ino \- format of a disk file system 
        !             5: .SH SYNOPSIS
        !             6: .B #include <sys/types.h>
        !             7: .br
        !             8: .B #include <sys/fblk.h>
        !             9: .br
        !            10: .B #include <sys/filsys.h>
        !            11: .br
        !            12: .B #include <sys/ino.h>
        !            13: .SH DESCRIPTION
        !            14: Every
        !            15: file system is divided into a certain number
        !            16: of blocks of 1K or 4K bytes, as determined by
        !            17: the predicate
        !            18: .L BITFS()
        !            19: applied to the minor device number
        !            20: where the file system is mounted.
        !            21: Block 0 is unused and is available to contain
        !            22: a bootstrap program, pack label, or other information.
        !            23: .PP
        !            24: Block 1 is the
        !            25: `super-block'.
        !            26: Its layout is defined in
        !            27: .LR <sys/filsys.h> :
        !            28: .PP
        !            29: .EX
        !            30: .ta \w'#define 'u +\w's_cylsize 'u +\w'123 'u +\w'daddr_t 'u
        !            31: struct filsys {
        !            32:        unsigned short s_isize;
        !            33:        daddr_t s_fsize;
        !            34:        short   s_ninode;
        !            35:        ino_t   s_inode[NICINOD];
        !            36:        char    s_flock;
        !            37:        char    s_ilock;
        !            38:        char    s_fmod;
        !            39:        char    s_ronly;
        !            40:        time_t  s_time;
        !            41:        daddr_t s_tfree;
        !            42:        ino_t   s_tinode;
        !            43:        short   s_dinfo[2];
        !            44: #define        s_m     s_dinfo[0]
        !            45: #define        s_n     s_dinfo[1]
        !            46: #define        s_cylsize       s_dinfo[0]
        !            47: #define        s_aspace        s_dinfo[1]
        !            48:        char    s_fsmnt[14];
        !            49:        ino_t   s_lasti;
        !            50:        ino_t   s_nbehind;
        !            51:        union {
        !            52:                struct {
        !            53:                        short   S_nfree;
        !            54:                        daddr_t S_free[NICFREE];
        !            55:                } R;
        !            56:                struct {
        !            57:                        char    S_valid;
        !            58: #define        BITMAP  961
        !            59:                        long    S_bfree[BITMAP];
        !            60:                } B;
        !            61:                struct {
        !            62:                        char    S_valid;
        !            63:                        char    S_flag;  /* 1 means bitmap not in S_bfree */
        !            64:                        long    S_bsize; /* size of bitmap blocks */
        !            65:                        struct buf *    S_blk[BITMAP-1];
        !            66:                } N;
        !            67:        } U;
        !            68: };
        !            69: #define        s_nfree U.R.S_nfree
        !            70: #define        s_free  U.R.S_free
        !            71: #define        s_valid U.B.S_valid
        !            72: #define        s_bfree U.B.S_bfree
        !            73: .EE
        !            74: .TF s_isize
        !            75: .TP
        !            76: .B s_isize
        !            77: The address of the first block after the i-list,
        !            78: which starts in block 2.
        !            79: Thus the i-list is
        !            80: .LR s_isize-2
        !            81: blocks long.
        !            82: .PD
        !            83: .TP
        !            84: .B s_fsize
        !            85: The address of the first block not in the file system.
        !            86: .TP
        !            87: .B s_inode
        !            88: Array of free inode numbers.
        !            89: .TP
        !            90: .B  s_ninode
        !            91: The number of free i-numbers in the
        !            92: .L s_inode
        !            93: array.
        !            94: Inodes are placed in the list in LIFO order.
        !            95: If the list underflows, it is replenished by
        !            96: searching the i-list
        !            97: to obtain the numbers of free inodes.
        !            98: When the list is full,
        !            99: freed inodes are not recorded in
        !           100: .LR s_inode .
        !           101: .TP
        !           102: .B s_lasti
        !           103: Where the last search for free inodes ended.
        !           104: .TP
        !           105: .B s_nbehind
        !           106: Number of free inodes before
        !           107: .L s_lasti
        !           108: that are not listed in
        !           109: .LR s_inode .
        !           110: The system will search forward for free inodes from
        !           111: .L s_lasti
        !           112: for more inodes unless
        !           113: .L s_nbehind
        !           114: is sufficiently large, in which case it will search the
        !           115: i-list from the beginning.
        !           116: .TP
        !           117: .B s_flock
        !           118: .br
        !           119: .ns
        !           120: .TP
        !           121: .B s_ilock
        !           122: Flags maintained in the core
        !           123: copy of the super-block while the file system
        !           124: while it is mounted.
        !           125: The values on disk are immaterial.
        !           126: .TP
        !           127: .B s_fmod
        !           128: Flag to indicate that the super-block has
        !           129: changed and should be copied to
        !           130: the disk during the next periodic update of file
        !           131: system information.
        !           132: The value on disk is immaterial.
        !           133: .TP
        !           134: .B s_ronly
        !           135: Flag for read-only file system.
        !           136: The value on disk is immaterial.
        !           137: .TP
        !           138: .B  s_time
        !           139: Time of the last change to the super block.
        !           140: .TP
        !           141: .B s_dinfo
        !           142: Disk interleave information:
        !           143: .BR s_cylsize =
        !           144: blocks per cylinder,
        !           145: .BR s_aspace =
        !           146: blocks to skip; see
        !           147: .IR fsck (8).
        !           148: .TP
        !           149: .B s_fsmnt
        !           150: Unused.
        !           151: .TP
        !           152: .B s_tfree
        !           153: .br
        !           154: .ns
        !           155: .TP
        !           156: .B s_tinode
        !           157: Numbers of free blocks and free inodes.
        !           158: Maintained for the benefit of
        !           159: .IR df
        !           160: (see
        !           161: .IR du (1)),
        !           162: these values are otherwise irrelevant.
        !           163: .PD
        !           164: .PP
        !           165: Different data are used to manage free space in 1K and 4K file systems.
        !           166: These fields are for 1K file systems:
        !           167: .TF s_isize
        !           168: .TP
        !           169: .B s_free
        !           170: An array of free block numbers.
        !           171: .LR s_free[0]
        !           172: is the block address of the next
        !           173: in a chain of blocks constituting the free list.
        !           174: The layout of these blocks is defined in 
        !           175: .LR <sys/fblk.h> :
        !           176: .PD
        !           177: .LP
        !           178: .EX
        !           179: struct fblk {
        !           180:        int     df_nfree;
        !           181:        daddr_t df_free[NICFREE];
        !           182: }
        !           183: .EE
        !           184: .ns
        !           185: .IP
        !           186: where 
        !           187: .L df_nfree
        !           188: and
        !           189: .L df_free
        !           190: are exactly like
        !           191: .L s_nfree
        !           192: and
        !           193: .L s_free.
        !           194: .TP
        !           195: .B s_nfree
        !           196: Blocks given in
        !           197: .L s_free[1]
        !           198: through
        !           199: .L s_free[s_nfree-1]
        !           200: are available for allocation.
        !           201: Blocks are allocated in LIFO fashion from this list.
        !           202: If freeing would cause
        !           203: the array to overflow,
        !           204: it is cleared by copying into the newly freed block,
        !           205: which is pushed onto the free chain.
        !           206: If allocation would cause underflow, 
        !           207: the array is replenished from the next block on the chain.
        !           208: .PP
        !           209: These are for 4K file systems:
        !           210: .TF s_isize
        !           211: .TP
        !           212: .B s_bfree
        !           213: a bit array specifying the free blocks of a 4K file system.
        !           214: The bit
        !           215: .LR (s_bfree[i/w]>>(i%w))&1 ,
        !           216: where
        !           217: .I w
        !           218: is the bit size of a long,
        !           219: is nonzero if the
        !           220: .IR i th
        !           221: data block is free.  If the file system is too large for the bitmap
        !           222: to fit here, then it is stored at the end of the file system, and
        !           223: locked into memory when the file system is mounted.  The
        !           224: .B N
        !           225: variant of the union is used by the kernel in this case.
        !           226: .PD
        !           227: .TP
        !           228: .B s_valid
        !           229: The bitmap of a mounted file system is maintained only in main memory;
        !           230: the bitmap on the medium is marked invalid by setting
        !           231: .L s_valid
        !           232: to zero.
        !           233: Unmounting
        !           234: updates the medium copy and sets
        !           235: .L s_valid
        !           236: to 1.
        !           237: A file system with invalid bitmap may be mounted
        !           238: read-only; its bitmap can be corrected by
        !           239: .IR chuck (8).
        !           240: .PP
        !           241: I-numbers begin at 1, and the storage for inodes
        !           242: begins in block 2.
        !           243: Inodes are 64 bytes long.
        !           244: Inode 2 is reserved for the root directory of the file
        !           245: system, but no other i-number has a built-in
        !           246: meaning.
        !           247: Each inode represents one file.
        !           248: .PP
        !           249: The layout of an inode is defined in
        !           250: .LR <sys/ino.h> :
        !           251: .PP
        !           252: .EX
        !           253: .ta \w'struct 'u +\w'unsigned 'u
        !           254: struct dinode {
        !           255:        unsigned short di_mode;
        !           256:        short   di_nlink;
        !           257:        short   di_uid;
        !           258:        short   di_gid;
        !           259:        off_t   di_size;
        !           260:        char    di_addr[40];
        !           261:        time_t  di_atime;
        !           262:        time_t  di_mtime;
        !           263:        time_t  di_ctime;
        !           264: };
        !           265: .EE
        !           266: .TF di_nlink
        !           267: .TP
        !           268: .B di_mode
        !           269: The kind of file; it
        !           270: is encoded as
        !           271: .L st_mode field of
        !           272: .IR stat (2),
        !           273: and is 0 for a free inode.
        !           274: .PD
        !           275: .TP
        !           276: .B di_nlink
        !           277: The number of directory entries
        !           278: (links) that refer to this inode
        !           279: .TP
        !           280: .B di_uid
        !           281: Owner's userid.
        !           282: .TP
        !           283: .B di_gid
        !           284: Owner's groupid.
        !           285: .TP
        !           286: .B di_size
        !           287: Number of bytes in the file.
        !           288: .TP
        !           289: .B di_atime
        !           290: Time of last access; see
        !           291: .IR times (2).
        !           292: .TP
        !           293: .B di_mtime
        !           294: Time of last modification.
        !           295: .TP
        !           296: .B di_ctime
        !           297: Time of last change to inode or contents.
        !           298: .TP
        !           299: .B di_addr
        !           300: For special files the first two bytes of
        !           301: .L di_addr
        !           302: contain the device code; see
        !           303: .IR intro (4)
        !           304: and
        !           305: .IR types (5).
        !           306: .PD
        !           307: .IP
        !           308: For plain files and directories
        !           309: .L di_addr
        !           310: contains block numbers packed into 3 bytes each.
        !           311: The first 10 numbers specify device blocks directly.
        !           312: The last 3 are singly, doubly, and triply
        !           313: indirect and point to blocks of block pointers of type
        !           314: .L daddr_t
        !           315: (see
        !           316: .IR types (5)).
        !           317: A zero pointer indicates a `hole'
        !           318: where no data has been written.
        !           319: Holes read as if they contained all zeros.
        !           320: .PP
        !           321: A symbolic link is, aside from mode,
        !           322: a plain file whose sole content is the name of the file linked to.
        !           323: .SH "SEE ALSO"
        !           324: .IR chuck (8), 
        !           325: .IR fsck (8),
        !           326: .IR icheck (8),
        !           327: .IR dir (5), 
        !           328: .IR mount (8), 
        !           329: .IR stat (2), 
        !           330: .IR types (5),
        !           331: .IR l3tol (3)
        !           332: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.