UNIX File System (UFS)


The UNIX File System (UFS) covers what you might think of as "normal" files on a local disk. The contents of this file must be accessed through the file system, because only the UFS code knows how to locate the blocks on the disk.

There are several sets of UFS functions: those dealing with the virtual file system and its needs, those handling vnode and inode related requests , and those managing the details of the file system organization, keeping track of superblocks, cylinder groups, and free fragments .

VFS operations are fairly obvious; they provide low-level support for the standard file system operations, such as mounting. A ufs_mount() function would be the place where the contents of the superblock are checked for validity, to make sure that the user is trying to mount a real file system instead of a swap device.

Vnode operations are a bit more numerous , but still just implement the inode-specific details of system calls and functions on files. The function ufs_readlink() , for example, would find and read the value of a UFS-style symbolic link.

The bulk of the UFS code deals with managing the internal structure of the file system on disk. We won't get into much here, since the details of the internal file system structure could fill a book by themselves , but you will find functions to allocate and free inodes, blocks, and file fragments; manage the free blocks and fragments; search, create, and update directories.

  • ufs_dirlook() ” Look for a file name in a directory. (Known as dirlook() in SunOS 4.x.)

  • ufs_direnter() ” Create a new directory entry. (Again, direnter() in SunOS 4.x.)

  • ufs_dirfixdotdot() ” Set up the appropriate " .. " entry in a new directory. (As above, there is no ufs_ prefix in SunOS 4.x.)

  • ufs_ialloc() ” Allocate an inode in the file system.

  • ufs_freesp() ” Free all storage space associated with the given inode.

Some renaming was done in Solaris 2 to accommodate all the other file system types the kernel might have to deal with, since UFS is certainly not the only one, although it may be one of the most common.



PANIC. UNIX System Crash Dump Analysis Handbook
PANIC! UNIX System Crash Dump Analysis Handbook (Bk/CD-ROM)
ISBN: 0131493868
EAN: 2147483647
Year: 1994
Pages: 289
Authors: Chris Drake

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net