File_system
the in-memory data structure vnode is just an inode cache that stores information about the file(typically inode stores in the disk) so that it can be accessed more quickly.
file system
-
The boot block occupies the beginning of a file system, typically the first sector, and may contain the bootstrap code that is read into the machine to boot, or initialize, the operating system. Although only one boot block is needed to boot the system, every file system has a (possibly empty) boot block.
-
The super block describes the state of a file system — how large it is, how many files it can store, where to find free space on the file system, and other information.
-
The mode list is a list of Modes that follows the super block in the file system. Administrators specify the size of the Mode list when configuring a file system. The kernel references Modes by index into the Mode list. One Mode is the root mode of the file system: it is the Mode by which the directory structure of the file system is accessible after execution of the mount system call (Section 5.14).
-
The data blocks start at the end of the Mode list and contain file data and administrative data. An allocated data block can belong to one and only one file in the file system.
inode
Modes exist in a static form on disk, and the kernel reads them into an in-core mode to manipulate them. Disk modes consist of the following fields
- file owner identifier
- file type
- file access permission
- access time, last modified, last accessed
- number of links to the file
- table of contents for the disk addresses of data in a file
- file size
- no path
STRUCTURE OF A REGULAR FILE
the Mode contains the table of contents to locate a file's data on disk. Since each block on a disk is addressable by number, the table of contents consists of a set of disk block numbers.
For greater flexibility, the kernel allocates file space one block at a time and allows the data in a file to be spread throughout the file system.
To access the data via the indirect block, the kernel must read the indirect block, find the appropriate direct block entry, and then read the direct block to find the data.
directories
A directory is a file whose data is a sequence of entries, each consisting of an mode number and the name of a file contained in the directory.
ls
-rwxrw-r-- 10 root root 2048 Jan 13 07:11 afile.exe
?UUUGGGOOOS 00 UUUUUU GGGGGG #### ^-- date stamp and file name are obvious ;-)
^ ^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | | \--- File Size
| | | | | | | \-------- Group Name (for example, Users, Administrators, etc)
| | | | | | \--------------- Owner Acct
| | | | | \---------------------- Link count (what constitutes a "link" here varies)
| | | | \--------------------------- Alternative Access (blank means none defined, anything else varies)
| \--\--\----------------------------- Read, Write and Special access modes for [U]ser, [G]roup, and [O]thers (everyone else)
\------------------------------------- File type flag
conversion of a path name to an innode
The kernel does a linear search of the directory file associated with the working mode, trying to match the path name component to a directory entry name.
Children