filsys, flblk, ino \- format of file system volume
.B #include <sys/types.h>
.B #include <sys/filsys.h>
file system storage volume
(e.g. RF disk, RK disk, RP disk, DECtape reel)
has a common format for certain vital information.
Every such volume is divided into a certain number
Block 0 is unused and is available to contain
a bootstrap program, pack label, or other information.
The layout of the super block as defined by the include file
.ta \w'struct 'u +\w'daddr_t 'u +\w's_inode[NICINOD]; 'u
.so /usr/include/sys/filsys.h
is the address of the first block after the i-list,
which starts just after the super-block, in block 2.
is the address of the first block not potentially
These numbers are used by the system to
check for bad block addresses;
if an `impossible' block address is allocated from the free list
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
.I "s_free[1], ... , s_free[s_nfree\-1],"
up to NICFREE free block numbers.
NICFREE is a configuration constant.
is the block address of the head
of a chain of blocks constituting the free list.
The layout of each block of the free chain as defined
.so /usr/include/sys/fblk.h
in a free block are used exactly like
and the new block number is
If the new block address is 0,
there are no blocks left, so give an error.
To free a block, check if
to the freed block's address and
is the number of free i-numbers in the
If it was 0, read the i-list
and place the numbers of all free inodes
is already NICINODE, don't bother to enter the freed i-node into any table.
This list of i-nodes 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.
are used to avoid searching the inode list from the beginning
each time the system runs out of inodes.
gives the base of the block of inodes last searched on the filesystem
gives the number of inodes, whose numbers were less than
when they were freed with
is the number of free inodes before
The system will search forward for free inodes from
is sufficiently large, in which case it will search the file system
inode list from the beginning.
This mechanism serves to avoid n**2 behavior in allocating inodes.
are flags maintained in the core
and their values on disk are immaterial.
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
is a write-protection indicator; its disk value is also immaterial.
is the last time the super-block of the file system was changed.
of the super-block for the root file system
is used to set the system's idea of the time.
.I s_tfree, s_tinode, s_fname
are not currently maintained.
I-numbers begin at 1, and the storage for i-nodes
I-nodes are 64 bytes long, so 16 of them fit into a block.
I-node 2 is reserved for the root directory of the file
system, but no other i-number has a built-in
Each i-node represents one file.
The format of an i-node as given in the include file
.ta \w'#define 'u +\w'time_t 'u +\w'di_addr[40]; 'u
.so /usr/include/sys/ino.h
tells the kind of file; it
is encoded identically to the
is the number of directory entries
(links) that refer to this i-node.
are the owner's user and group IDs.
is the number of bytes in the file.
are the times of last access and modification
of the file contents (read, write or create)
records the time of last modification
to the inode or to the file, and is used
to determine whether it should be dumped.
Special files are recognized by their modes
A block-type special file is one which
can potentially be mounted as a file system;
a character-type special file cannot, though it is
not necessarily character-oriented.
field is occupied by the device code
of block and character special files overlap.
Disk addresses of plain files and directories
packed into 3 bytes each.
The first 10 addresses specify device blocks directly.
The last 3 addresses are singly, doubly, and triply
indirect and point to blocks of 256 block pointers.
Pointers in indirect blocks have the type
is not necessary that all blocks less than
A zero block number either in the address words of
the i-node or in an indirect block indicates that the
corresponding block has never been allocated.
Such a missing block reads as if it contained all zero words.
icheck(1), dcheck(1), dir(5), mount(1), stat(2), types(5)