01.01.2013 Views

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

FS (4) FS (4)<br />

S_type indicates the file system type. Currently, two types of file<br />

systems are supported: the original 512-byte oriented and the new<br />

improved 1024-byte oriented. S_magic is used to distinguish the<br />

original 512-byte oriented file systems from the newer file systems.<br />

If this field is not equal to the magic number, FsMAGIC, the type<br />

is assumed to be Fsl b, otherwise the s_type field is used. In the<br />

following description, a block is then determined by the type. For<br />

the original 512-byte oriented file system, a block is 512 bytes.<br />

For the 1024-byte oriented file system, a block is 1024 bytes or<br />

two sectors. The operating system takes care of all conversions<br />

from logical block numbers to physical sector numbers.<br />

S_isize is the address of the first data block after the i-list; the ilist<br />

starts just after the super-block, namely in block 2; thus the<br />

i-list is s_isize- 2 blocks long. SJsize is the first block not potentially<br />

available for allocation to a file. These numbers are used by<br />

the system to check for bad block numbers; if an "impossible"<br />

block number is allocated from the free list or is freed, a diagnostic<br />

is written on the on-line console. Moreover, the free array is<br />

cleared, so as to prevent further allocation from a presumably corrupted<br />

free list.<br />

The free list for each volume is maintained as follows. The sJree<br />

array contains, in sJree[1], ... , sJree [s_nfree-1], up to 49<br />

numbers of free blocks. SJree [OJ is the block number of the head<br />

of a chain of blocks constituting the free list. The first long in<br />

each free-chain block is the number (up to 50) of free-block<br />

numbers listed in the next 50 longs of this chain member. The<br />

first of these 50 blocks is the link to the next member of the chain.<br />

To allocate a block: decrement s_nfree, and the new block is<br />

sJree [s_nfree ]. If the new block number is 0, there are no blocks<br />

left, so give an error. If s_nfree became 0, read in the block<br />

named by the new block number, replace s_nfree by its first<br />

word, and copy the block numbers in the next 50 longs into the<br />

sJree array. To free a block, check if s_nfree is 50; if so, copy<br />

s_nfree and the sJree array into it, write it out, and set s_nfree<br />

to 0. In any event set sJree [s_nfree] to the freed block's number<br />

and increment s_nfree .<br />

s_tfree is the total free blocks available in the file system.<br />

S_ninode is the number of free i-numbers in the s_inode array.<br />

To allocate an i-node: if s_ninode is greater than 0, decrement it<br />

and return s_inode [s_ninode]. If it was 0, read the i-list and<br />

place the numbers of all free inodes (up to 100) into the s_inode<br />

array, then try again. To free an i-node, provided s_ninode is less<br />

than 100, place its number into s_inode [ s_ninode] and increment<br />

s_ninode . If s_ninode is already 100, do not bother to enter the<br />

freed i-node into any table. This list of i-nodes is only to speed up<br />

the allocation process; the information as to whether the inode is<br />

really free or not is maintained in the inode itself.<br />

S_tinode is the total free inodes available in the file system.<br />

S_fiock and s_ilock are flags maintained in the core copy of the<br />

file system while it is mounted and their values on disk are<br />

- 2-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!