Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fs_s5(4) — Atari System V 1.1-06

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mount(2)

fsck(1M)

fsdb(1M)

mkfs(1M)

inode(4)





   fs(4)                              (s5)                               fs(4)


   NAME
         fs (s5) - format of s5 file system volume

   SYNOPSIS
         #include <sys/types.h>
         #include <sys/param.h>
         #include <sys/fs/s5filsys.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 super-block.  The format of a super-block is:

         struct      filsys
         {
           ushort    sisize;           /* size in blocks of i-list */
           daddrt   sfsize;           /* size in blocks of entire volume */
           short     snfree;           /* number of addresses in sfree */
           daddrt   sfree[NICFREE];   /* free block list */
           short     sninode;          /* number of i-nodes in sinode */
           oinot   sinode[NICINOD];  /* free i-node list */
           char      sflock;           /* lock during free list */
                                        /* manipulation */
           char      silock;           /* lock during i-list manipulation */
           char      sfmod;            /* super block modified flag */
           char      sronly;           /* mounted read-only flag */
           timet    stime;            /* last super block update */
           short     sdinfo[4];        /* device information */
           daddrt   stfree;           /* total free blocks*/
           oinot   stinode;          /* total free i-nodes */
           char      sfname[6];        /* file system name */
           char      sfpack[6];        /* file system pack name */
           long      sfill[12];        /* ADJUST to make */
                                        /* sizeof filsys be 512 */
           long      sstate;           /* file system state */
           long      smagic;           /* magic number to denote new file
                                        /* system */
           long      stype;            /* type of new file system */
         };
         #define   FsMAGIC    0xfd187e21   /* smagic number */
         #define   Fs1b       1            /* 512-byte block */
         #define   Fs2b       2            /* 1024-byte block */
         #define   Fs4b       3            /* 2048-byte block */
         #define   FsOKAY     0x7c269d38   /* sstate: clean */
         #define   FsACTIVE   0x5e72d81a   /* sstate: active */
         #define   FsBAD      0xcb096f43   /* sstate: bad root */
         #define   FsBADBLK   0xbadbc14b   /* sstate: bad block */
                                           /* corrupted it */


   8/91                                                                 Page 1









   fs(4)                              (s5)                               fs(4)


         stype indicates the file system type.  Currently, three types of
         file systems are supported:  the original 512-byte logical block, the
         1024-byte logical block, and the 2048-byte logical block.  smagic is
         used to distinguish the s5 file system from other FSTypes.  The
         stype field is used to determine the blocksize of the file system;
         512-bytes, 1K, or 2K.  The operating system takes care of all
         conversions from logical block numbers to physical sector numbers.

         sstate indicates the state of the file system.  A cleanly unmounted,
         not damaged 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 system has been unmounted, the
         state reverts to FsOKAY.

         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 sisize-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 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 i-node:  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 i-nodes (up to 100) into the sinode array, then
         try again.  To free an i-node, 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 i-node into


   Page 2                                                                 8/91









   fs(4)                              (s5)                               fs(4)


         any table.  This list of i-nodes is only to speed up the allocation
         process; the information as to whether the i-node is really free or
         not is maintained in the i-node itself.

         stinode is the total free i-nodes 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 (UTC).  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 i-nodes begins in block 2.
         Also, i-nodes are 64 bytes long.  I-node 1 is reserved for future
         use.  I-node 2 is reserved for the root directory of the file system,
         but no other i-number has a built-in meaning.  Each i-node represents
         one file.  For the format of an i-node and its flags, see inode(4).

   SEE ALSO
         mount(2).
         fsck(1M), fsdb(1M), mkfs(1M), s5-specific inode(4)




















   8/91                                                                 Page 3





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