Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fs(4) — A/UX 0.7

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fsck(1M)

fsdb(1M)

mkfs(1M)

inode(4)



     fs(4)                                                       fs(4)



     NAME
          file system - format of a System V system volume

     SYNOPSIS
          #include <sys/types.h>
          #include <sys/param.h>
          #include <svfs/filsys.h>

     DESCRIPTION
          Every file system storage volume has a common format for
          certain vital information.  Every such volume is divided
          into a certain number of 512-byte long sectors.  Sector 0 is
          unused and is available to contain a bootstrap program or
          other information.

          Sector 1 is the ``superblock''.  The format of a superblock
          is:

          /*
           * Structure of the superblock
           */

          struct    filsys
          {
              ushort  s_isize;          /* size in blocks
                                           of i-list */
              daddr_t s_fsize;          /* size in blocks of
                                           entire volume */
              short   s_nfree;          /* number of addresses
                                           in s_free */
              daddr_t s_free[NICFREE];  /* free block list */
              short   s_ninode;         /* number of inodes
                                           in s_inode */
              ino_t   s_inode[NICINOD]; /* free inode list */
              char    s_flock;          /* lock during free
                                           list manipulation */
              char    s_ilock;          /* lock during i-list
                                           manipulation */
              char    s_fmod;           /* superblock modified
                                           flag */
              char    s_ronly;          /* mounted read-only
                                           flag */
              time_t  s_time;           /* last superblock
                                           update */
              short   s_dinfo[4];       /* device information */
              daddr_t s_tfree;          /* total free blocks*/
              ino_t   s_tinode;         /* total free inodes */
              char    s_fname[6];       /* file system name */
              char    s_fpack[6];       /* file system pack name */
              long    s_fill[14];       /* ADJUST size of
                                           filsys to 512 */
              ino_t   s_lasti;          /* start place for



     Page 1                                        (last mod. 1/14/87)





     fs(4)                                                       fs(4)



                                           circular search */
              ino_t   s_nbehind;        /* est # free inodes
                                           before s_lasti */
              long    s_magic;          /* magic number to
                                           indicate new filesys */
              long    s_type;           /* type of new filesys */
          };

          #define   FsMAGIC  0xfd187e20   /* s_magic number */
          #define   Fs1b     1            /* 512-byte block */
          #define   Fs2b     2            /* 1024-byte block */
          #define   Fs4b     4            /* 2048-byte block */

          stype indicates the file system type.  Currently, two types
          of file systems are supported: the original 512-byte
          oriented and the new improved 1024-byte oriented.  smagic
          is used to distinguish the original 512-byte oriented file
          systems from the newer file systems.  If this field is not
          equal to the magic number, FsMAGIC, the type is assumed to
          be Fs1b, otherwise the stype field is used.  In the
          following description, a block is then determined by the
          type.  For the original 512-byte oriented file system, a
          block is 512 bytes.  For the 1024-byte oriented file system,
          a block is 1024 bytes or two sectors.  The operating system
          takes care of all conversions from logical block numbers to
          physical sector numbers.

          sisize is the address of the first data block after the i-
          list; the i-list starts just after the super-block, namely
          in block 2; thus the i-list is s_isize-2 blocks long.
          sfsize is the first block not potentially available for
          allocation 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 on-line console.  Moreover, the
          free array is cleared, so as to prevent further allocation
          from a presumably corrupted free list.

          The free list for each volume is maintained as follows.  The
          sfree array contains, in sfree[1], ..., sfree[snfree-1],
          up to 49 numbers of free blocks.  sfree[0] is the block
          number of the head of a chain of blocks constituting the
          free list.  The first long in each free-chain block is the
          number (up to 50) of free-block numbers listed in the next
          50 longs of this chain member.  The first of these 50 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 became 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 50
          longs into the sfree array.  To free a block, check if



     Page 2                                        (last mod. 1/14/87)





     fs(4)                                                       fs(4)



          snfree is 50; if so, copy snfree and the sfree array into
          it, write it out, and set snfree to 0.  In any event set
          sfree[snfree] to the freed block's number and increment
          snfree.

          stfree is the total free blocks available in the file
          system.

          sninode is the number of free i-numbers in the sinode
          array.  To allocate 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 100) into the sinode array, then try again.  To free an
          inode, provided sninode is less than 100, place its number
          into sinode[sninode] and increment sninode.  If sninode
          is already 100, do not bother to enter the freed inode into
          any table.  This list of inodes is only to speed up the
          allocation process; the information as to whether the inode
          is really free or not is maintained in the inode itself.

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

          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 likewise
          immaterial; it 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 file system 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 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 file system is used to set
          the system's idea of the time.

          sfname is the name of the file system and sfpack is the
          name of the pack.

          I-numbers begin at 1, and the storage for inodes begins in
          block 2.  Also, inodes are 64 bytes long.  Inode 1 is
          reserved for future use.  Inode 2 is reserved for the root
          directory of the file system, 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(4).

     FILES
          /usr/include/sys/filsys.h
          /usr/include/sys/stat.h




     Page 3                                        (last mod. 1/14/87)





     fs(4)                                                       fs(4)



     SEE ALSO
          fsck(1M), fsdb(1M), mkfs(1M), inode(4).





















































     Page 4                                        (last mod. 1/14/87)



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