Manual Page Result
0
Command: filsys | Section: 5 | Source: UNIX v10 | File: filsys.5
FILSYS(5) File Formats Manual FILSYS(5)
NAME
filsys, flblk, ino - format of a disk file system
SYNOPSIS
#include <sys/types.h>
#include <sys/fblk.h>
#include <sys/filsys.h>
#include <sys/ino.h>
DESCRIPTION
Every file system is divided into a certain number of blocks of 1K or
4K bytes, as determined by the predicate applied to the minor device
number where the file system is mounted. Block 0 is unused and is
available to contain a bootstrap program, pack label, or other informa-
tion.
Block 1 is the `super-block'. Its layout is defined in
struct filsys {
unsigned short s_isize;
daddr_t s_fsize;
short s_ninode;
ino_t s_inode[NICINOD];
char s_flock;
char s_ilock;
char s_fmod;
char s_ronly;
time_t s_time;
daddr_t s_tfree;
ino_t s_tinode;
short s_dinfo[2];
#define s_m s_dinfo[0]
#define s_n s_dinfo[1]
#define s_cylsize s_dinfo[0]
#define s_aspace s_dinfo[1]
char s_fsmnt[14];
ino_t s_lasti;
ino_t s_nbehind;
union {
struct {
short S_nfree;
daddr_t S_free[NICFREE];
} R;
struct {
char S_valid;
#define BITMAP 961
long S_bfree[BITMAP];
} B;
struct {
char S_valid;
char S_flag; /* 1 means bitmap not in S_bfree */
long S_bsize; /* size of bitmap blocks */
struct buf *S_blk[BITMAP-1];
} N;
} U;
};
#define s_nfree U.R.S_nfree
#define s_free U.R.S_free
#define s_valid U.B.S_valid
#define s_bfree U.B.S_bfree
s_isize
The address of the first block after the i-list, which starts in
block 2. Thus the i-list is blocks long.
s_fsize
The address of the first block not in the file system.
s_inode
Array of free inode numbers.
s_ninode
The number of free i-numbers in the array. Inodes are placed in
the list in LIFO order. If the list underflows, it is replen-
ished by searching the i-list to obtain the numbers of free in-
odes. When the list is full, freed inodes are not recorded in
s_lasti
Where the last search for free inodes ended.
s_nbehind
Number of free inodes before that are not listed in The system
will search forward for free inodes from for more inodes unless
is sufficiently large, in which case it will search the i-list
from the beginning.
s_flock
s_ilock
Flags maintained in the core copy of the super-block while the
file system while it is mounted. The values on disk are immate-
rial.
s_fmod Flag to indicate that the super-block has changed and should be
copied to the disk during the next periodic update of file sys-
tem information. The value on disk is immaterial.
s_ronly
Flag for read-only file system. The value on disk is immater-
ial.
s_time Time of the last change to the super block.
s_dinfo
Disk interleave information: s_cylsize= blocks per cylinder,
s_aspace= blocks to skip; see fsck(8).
s_fsmnt
Unused.
s_tfree
s_tinode
Numbers of free blocks and free inodes. Maintained for the ben-
efit of df (see du(1)), these values are otherwise irrelevant.
Different data are used to manage free space in 1K and 4K file systems.
These fields are for 1K file systems:
s_free An array of free block numbers. is the block address of the
next in a chain of blocks constituting the free list. The lay-
out of these blocks is defined in
struct fblk {
int df_nfree;
daddr_t df_free[NICFREE];
}
where and are exactly like and
s_nfree
Blocks given in through are available for allocation. Blocks
are allocated in LIFO fashion from this list. If freeing would
cause the array to overflow, it is cleared by copying into the
newly freed block, which is pushed onto the free chain. If al-
location would cause underflow, the array is replenished from
the next block on the chain.
These are for 4K file systems:
s_bfree
a bit array specifying the free blocks of a 4K file system. The
bit where w is the bit size of a long, is nonzero if the ith
data block is free. If the file system is too large for the
bitmap to fit here, then it is stored at the end of the file
system, and locked into memory when the file system is mounted.
The N variant of the union is used by the kernel in this case.
s_valid
The bitmap of a mounted file system is maintained only in main
memory; the bitmap on the medium is marked invalid by setting to
zero. Unmounting updates the medium copy and sets to 1. A file
system with invalid bitmap may be mounted read-only; its bitmap
can be corrected by chuck(8).
I-numbers begin at 1, and the storage for inodes begins in block 2.
Inodes are 64 bytes long. 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.
The layout of an inode is defined in
struct dinode {
unsigned short di_mode;
short di_nlink;
short di_uid;
short di_gid;
off_t di_size;
char di_addr[40];
time_t di_atime;
time_t di_mtime;
time_t di_ctime;
};
di_mode
The kind of file; it is encoded as stat(2), and is 0 for a free
inode.
di_nlink
The number of directory entries (links) that refer to this inode
di_uid Owner's userid.
di_gid Owner's groupid.
di_size
Number of bytes in the file.
di_atime
Time of last access; see times(2).
di_mtime
Time of last modification.
di_ctime
Time of last change to inode or contents.
di_addr
For special files the first two bytes of contain the device
code; see intro(4) and types(5).
For plain files and directories contains block numbers packed
into 3 bytes each. The first 10 numbers specify device blocks
directly. The last 3 are singly, doubly, and triply indirect
and point to blocks of block pointers of type (see types(5)). A
zero pointer indicates a `hole' where no data has been written.
Holes read as if they contained all zeros.
A symbolic link is, aside from mode, a plain file whose sole content is
the name of the file linked to.
SEE ALSO
chuck(8), fsck(8), icheck(8), dir(5), mount(8), stat(2), types(5),
l3tol(3)
FILSYS(5)