Virtual File-System :
- The Linux VFS is designed around object-oriented principles.
- It has two compounds:
1) A set of definitions that specify the file-sytem objects.
2) A layer of software to manipulate the objects.
- The VFS defines four main object types:
1) An inode object represnts an individual file.
2) A file-object represents an open file.
3) A superblock object represents an entire file-system.
4) A dentry object represents an individual directory entry.
- For each object type, the VFS defines a set of operations.
- Each object contains a pointer to a funtion-table.
- The function-table lists the addresses of the actual functions functions that implement the defined operations for the object.
- Example of file-object's operations :
int open(. . .) - open a file.
ssize t read(. . .) - Read from a file.
ssize t write(. . .) - Write to a file.
int mmap(. . .) - Memory-map a file.
- The VFS software layer can perform an operation on the file-objects by calling the appropriate function from the object's function-table.
- The inode and file-objects are the mechanisms used to access files.
- An inode object is a data-structure containing pointers to the disk blocks that contain the actual file contents.
- File-object typically belong to a single process, but inode objects do not.