Kernel Virtual Filesystem - VFS
The VFS is an abstraction layer to support the implementation of many filesystems.
It specifies a commom file model that is capable of representing any conceivable filesystem's general features and behavior. Its like a framework.
The abstraction layer works by defining the basic conceptual interfaces and data structures that all filesystems support. The Filesystem mold their view of concepts such as "this is how I open files" and "this is what a directory is to me" to match the expectations of the VFS.
To VFS and the rest of the kernel, each filesystem looks the same.
All filesystems rely on VFS to allow them not only to coexist, but also to interoperate.
Unix Filesystems
Historically, Unix has provided four basic filesystem-related abstractions: files, directory entries, inodes and mount points.
A filesystem is a hierarchical storage of data adhering to a specific structure.
Filesystems contain file, directories, and associated control information.
In Unix, filesystems are mounted at a specific mount point in a global hierarchy know as namespace.
A file is an ordered string of bytes. The first byte marks the beginning of the file and the last byte marks the end of the file. Each file is assigned a human-readable name for identification by both the system and the user.
Files are organized in directories.
A directory is analogous to a folder and usually contains related files.
Directories can also contain subdirectories; in this fashion, directories may be nested to form paths. Each component of a path is called a directory entry.
A path example is /home/wolfman/butter, the root directory /, the directories home and wolfman, and the file butter are all directory entries, called dentries.
In Unix, directories are actually normal files that simply list the files contained therein.
Because a directory is a file to the VFS, the same operations performed on files can be performed on directories.
Unix systems separate the concept of a file from any associated information about it, such as access permissions, size, owner creation time, and so on. This information is sometimes called file metadata and is stored in a separate data structure from the file, called the inode (index node).
All this information is tied together with the filesystem's control information, which is stored in the superblock. The superblock is a data structure containing information about the filesystem as a whole.
Filesystem metadata includes information about both the individual files and the filesystem as a whole.
Non-Unix filesystem, such as FAT or NTFS, still work in Linux, but their filesystem code must provide the appearance of these concepts.
For example, even if a filesystem does not support distinct inodes, it mus assemble the inode data structure in memory as if it did.
Or if a filesystem treats directories as a special object, to the VFS they must represent directories as mere files.
VFS Objects and their Data Structures
The four primary object types of the VFS are:
An operations object is contained within each of these primary objects. These objects describe the methods that the kernel invokes against the primary objects. The are:
This is the basic of VFS.
Later I'm gonna add some stuff here, but that's for now!!
Cya
It specifies a commom file model that is capable of representing any conceivable filesystem's general features and behavior. Its like a framework.
The abstraction layer works by defining the basic conceptual interfaces and data structures that all filesystems support. The Filesystem mold their view of concepts such as "this is how I open files" and "this is what a directory is to me" to match the expectations of the VFS.
To VFS and the rest of the kernel, each filesystem looks the same.
All filesystems rely on VFS to allow them not only to coexist, but also to interoperate.
Unix Filesystems
Historically, Unix has provided four basic filesystem-related abstractions: files, directory entries, inodes and mount points.
A filesystem is a hierarchical storage of data adhering to a specific structure.
Filesystems contain file, directories, and associated control information.
In Unix, filesystems are mounted at a specific mount point in a global hierarchy know as namespace.
A file is an ordered string of bytes. The first byte marks the beginning of the file and the last byte marks the end of the file. Each file is assigned a human-readable name for identification by both the system and the user.
Files are organized in directories.
A directory is analogous to a folder and usually contains related files.
Directories can also contain subdirectories; in this fashion, directories may be nested to form paths. Each component of a path is called a directory entry.
A path example is /home/wolfman/butter, the root directory /, the directories home and wolfman, and the file butter are all directory entries, called dentries.
In Unix, directories are actually normal files that simply list the files contained therein.
Because a directory is a file to the VFS, the same operations performed on files can be performed on directories.
Unix systems separate the concept of a file from any associated information about it, such as access permissions, size, owner creation time, and so on. This information is sometimes called file metadata and is stored in a separate data structure from the file, called the inode (index node).
All this information is tied together with the filesystem's control information, which is stored in the superblock. The superblock is a data structure containing information about the filesystem as a whole.
Filesystem metadata includes information about both the individual files and the filesystem as a whole.
Non-Unix filesystem, such as FAT or NTFS, still work in Linux, but their filesystem code must provide the appearance of these concepts.
For example, even if a filesystem does not support distinct inodes, it mus assemble the inode data structure in memory as if it did.
Or if a filesystem treats directories as a special object, to the VFS they must represent directories as mere files.
VFS Objects and their Data Structures
The four primary object types of the VFS are:
- The superblock object, which represents a specific mounted filesystem.
- The inode object, which represents a specific file.
- The dentry object, which represents a directory entry, a single component of a path.
- The file object, which represents an open file as associated with a process.
An operations object is contained within each of these primary objects. These objects describe the methods that the kernel invokes against the primary objects. The are:
- The super_operations object, which contains the methods that the kernel can invoke on a specific filesystem.
- The inode_operations object, which contains the methods that the kernel can invoke on a specific file.
- The dentry_operations object, which contains the methods that the kernel can invoke on a specific directory entry.
- The file object, which contains the methods that a process can invoke on an open file.
This is the basic of VFS.
Later I'm gonna add some stuff here, but that's for now!!
Cya