?? filsys.5
字號(hào):
.TH FILSYS 5.SH NAMEfilsys, flblk, ino \- format of file system volume.SH SYNOPSIS.B #include <sys/types.h>.br.B #include <sys/flbk.h>.br.B #include <sys/filsys.h>.br.B #include <sys/ino.h>.SH DESCRIPTIONEveryfile 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 numberof 512-byte blocks.Block 0 is unused and is available to containa bootstrap program, pack label, or other information..PPBlock 1 is the.I "super block."The layout of the super block as defined by the include file.I <sys/filsys.h>is:.PP.nf.ta \w'struct 'u +\w'daddr_t 'u +\w's_inode[NICINOD]; 'u.so /usr/include/sys/filsys.h.fi.PP.I S_isizeis the address of the first block after the i-list,which starts just after the super-block, in block 2.Thus is i-list is.IR s_isize \-2blocks long..I S_fsizeis the address of the first block not potentiallyavailable for allocationto a file.These numbers are used by the system tocheck for bad block addresses;if an `impossible' block address is allocated from the free listor is freed,a diagnostic is written on the on-line console.Moreover, the free array is cleared, so as to prevent furtherallocation from a presumably corrupted free list..PPThe free list for each volume is maintained asfollows.The.I s_freearray contains, in.I "s_free[1], ... , s_free[s_nfree\-1],"up to NICFREE free block numbers.NICFREE is a configuration constant..I S_free[0]is the block address of the headof a chain of blocks constituting the free list.The layout of each block of the free chain as definedin the include file.I <sys/fblk.h>is:.PP.nf.so /usr/include/sys/fblk.h.fi.PPThe fields.I df_nfreeand.I df_freein a free block are used exactly like.I s_nfreeand .I s_freein the super block.To allocate a block:decrement.I s_nfree,and the new block number is.I s_free[s_nfree].If the new block address is 0,there are no blocks left, so give an error.If.I s_nfreebecame 0,read the new block into.I s_nfreeand .I s_free.To free a block, check if.I s_nfreeis NICFREE; if so,copy.I s_nfreeand the.I s_freearray into it,write it out, and set.I s_nfreeto 0.In any event set.I s_free[s_nfree]to the freed block's address andincrement.I s_nfree..PP.I S_ninodeis the number of free i-numbers in the.I s_inodearray.To allocate an i-node:if.I s_ninodeis greater than 0,decrement it and return.I s_inode[s_ninode].If it was 0, read the i-listand place the numbers of all free inodes(up to NICINOD) into the.I s_inodearray,then try again.To free an i-node,provided.I s_ninodeis less than NICINODE,place its number into.I s_inode[s_ninode]and increment.I s_ninode.If.I s_ninodeis already NICINODE, don't bother to enter the freed i-node into any table.This list of i-nodes is only to speedup the allocation process; the informationas to whether the inode is really freeor not is maintained in the inode itself..PP.I S_flockand.I s_ilockare flags maintained in the corecopy of the file systemwhile it is mountedand their values on disk are immaterial.The value of.I s_fmodon disk is likewise immaterial;it is used as a flag to indicate that the super-block haschanged and should be copied tothe disk during the next periodic update of filesystem information..I S_ronlyis a write-protection indicator; its disk value is also immaterial..PP.I S_timeis the last time the super-block of the file system was changed.During a reboot,.I s_timeof the super-block for the root file systemis used to set the system's idea of the time..PPThe fields.I s_tfree, s_tinode, s_fnameand.I s_fpackare not currently maintained..PPI-numbers begin at 1, and the storage for i-nodesbegins in block 2..tr |I-nodes are 64 bytes long, so 8 of them fit into a block.I-node 2 is reserved for the root directory of the filesystem, but no other i-number has a built-inmeaning.Each i-node represents one file.The format of an i-node as given in the include file.I <sys/ino.h>is:.PP.nf.ta \w'#define 'u +\w'time_t 'u +\w'di_addr[40]; 'u.so /usr/include/sys/ino.h.fi.PP.I Di_modetells the kind of file; itis encoded identically to the.I st_mode field of.IR stat (2)..I Di_nlinkis the number of directory entries(links) that refer to this i-node..I Di_uidand.I di_gidare the owner's user and group IDs..I Sizeis the number of bytes in the file..I Di_atimeand.I di_mtimeare the times of last access and modificationof the file contents (read, write or create)(see.IR times (2));.I Di_ctimerecords the time of last modificationto the inode or to the file, and is usedto determine whether it should be dumped..PPSpecial files are recognized by their modesand not by i-number.A block-type special file is one whichcan potentially be mounted as a file system;a character-type special file cannot, though it isnot necessarily character-oriented.For special files, the .I di_addrfield is occupied by the device code(see.IR types (5)).The device codesof block and character special files overlap..PPDisk addresses of plain files and directoriesare kept in the array.I di_addrpacked into 3 bytes each.The first 10 addresses specify device blocks directly.The last 3 addresses are singly, doubly, and triplyindirect and point to blocks of 128 block pointers.Pointers in indirect blocks have the type.I daddr_t(see.IR types (5))..PPFor block.I bin a file to exist,itis not necessary that all blocks less than.I bexist.A zero block number either in the address words ofthe i-node or in an indirect block indicates that thecorresponding block has never been allocated.Such a missing block reads as if it contained all zero words..SH "SEE ALSO"icheck(1), dcheck(1), dir(5), mount(1), stat(2), types(5)
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -