Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ filesyst(FP) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fsck(ADM)

fsname(ADM)

inode(FP)

labelit(ADM)

mkfs(ADM)


 filesystem(FP)                 6 January 1993                 filesystem(FP)


 Name

    filesystem - format of filesystem types

 Syntax


    #include <sys/fs/*filsys.h>
    #include <sys/types.h>
    #include <sys/param.h>


 Description

    Every filesystem storage volume (for example, a hard disk) has a common
    format for certain vital information.  Every such volume is divided into
    a certain number of 1024-byte blocks.  There are four filesystem types
    available:

       S51K (UNIX filesystem)
       XENIX
       AFS (ACER Fast Filesystem)
       DOS

    The DOS filesystem is a 512-byte filesystem.  (The DOS filesystem struc-
    ture is shown in /usr/include/fs/dosfilsys.h.  Consult a DOS reference
    guide for more information.)

    Block 0 is unused and available to contain a bootstrap program or other
    information.

    Block 1 is the ``super block.''  The formats of the S51K, AFS, and XENIX
    filesystem super blocks are described in two files in the directory
    /usr/include/sys/fs:  s5filsys.h (S51K and AFS) and xxfilsys.h (XENIX).
    The XENIX filesystem boot block is 1024 bytes; the S51K and UNIX boot
    blocks are 512-byte blocks.  In these include files, sisize is the
    address of the first data block after the i-list.  The i-list starts just
    after the super block in block 2; thus the i-list is sisize-2 blocks
    long.  sfsize is the first block not potentially available for alloca-
    tion to a file.  These numbers are used by the system to check for bad
    block numbers.  If an ``impossible'' block number is allocated from the
    free list or is freed, a diagnostic is written on the console.  Moreover,
    the free array is cleared so as to prevent further allocation from a
    presumably corrupted free list.

    The free list for S51K and XENIX volumes (but not AFS) is maintained as
    follows:  The sfree array contains, in sfree[1], ...,
    sfree[snfree-1], up to NICFREE-1 numbers of free blocks.  sfree[0] is
    the block number of the head of a chain of blocks constituting the free
    list.  The first short in each free-chain block is the number (up to NIC-
    FREE) of free-block numbers listed in the next NICFREE longs of this
    chain member.  The first of these NICFREE blocks is the link to the next
    member of the chain.  To allocate a block: decrement snfree, and the new
    block is sfree[snfree].  If the new block number is 0, there are no
    blocks left, so give an error.  If snfree becomes 0, read in the block
    named by the new block number, replace snfree by its first word, and
    copy the block numbers in the next NICFREE longs into the sfree array.
    To free a block, check if snfree is NICFREE; if so, copy snfree and the
    sfree array into it, write it out, and set snfree to 0.  In all cases,
    set sfree[snfree] to the freed block's number and increment snfree.

    In the AFS filesystem, the free list is maintained differently The AFS
    free list is organized as a bitmap, one bit per (1K) block in the file-
    system.  This organization makes it easy to find contiguous stretches of
    free blocks.

    stfree is the total free blocks available in the filesystem.

    sninode is the number of free i-numbers in the sinode array.  To allo-
    cate an inode:  if sninode is greater than 0, decrement it and return
    sinode[sninode].  If it was 0, read the i-list and place the numbers of
    all free inodes (up to NICINOD) into the sinode array, then try again.
    To free an inode, provided sninode is less than NICINOD, place its num-
    ber into sinode[sninode] and increment sninode.  If sninode is
    already NICINOD, do not enter the freed inode into any table.  This list
    of inodes only speeds up the allocation process. The information about
    whether the inode is free is maintained in the inode itself.

    stinode is the total free inodes available in the file system.

    The following applies only to S51K and AFS filesystems:  sstate indi-
    cates the state of the filesystem.  A cleanly unmounted, undamaged file-
    system is indicated by the FsOKAY state.  After a file system has been
    mounted for update, the state changes to FsACTIVE.  A special case is
    used for the root file system.  If the root file system appears damaged
    at boot time, it is mounted but marked FsBAD.  Lastly, after a file sys-
    tem has been unmounted, the state reverts to FsOKAY.

    sflock and silock are flags maintained in the core copy of the file-
    system while it is mounted, and their values on disk are immaterial.  The
    value of sfmod on disk is also immaterial, and is used as a flag to
    indicate that the super block has changed and should be copied to the
    disk during the next periodic update of filesystem information.

    sronly is a read-only flag to indicate write-protection.

    stime is the last time the super block of the file system was changed,
    and is a double-precision representation of the number of seconds that
    have elapsed since 00:00 Jan. 1, 1970 (GMT).  During a reboot, the stime
    of the super block for the root filesystem is used to set the system's
    time.

    I-numbers begin at 1, and the storage for inodes begins in block 2.
    Inodes are 64 bytes long, so 16 of them fit into a block.  Therefore,
    inode i is located in block (i+31)/16, and begins 64x((i+31) (mod 16))
    bytes from its start.  Inode 1 is reserved for future use.  Inode 2 is
    reserved for the root directory of the filesystem, but no other i-number
    has a built-in meaning.  Each inode represents one file.  For the format
    of an inode and its flags, see inode(FP).

 Files

    /usr/include/sys/filsys.h

    /usr/include/sys/stat.h

 See also

    fsck(ADM), fsname(ADM), inode(FP), labelit(ADM), mkfs(ADM)


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026