![]() |
VOOZH | about |
The virtual file system is one of the best features of Linux that makes Linux an operating system of choice. Format a pen drive in any Linux flavor operating system and try to see the contents in windows OS. Windows OS does not show anything. What is the problem?
Now try doing the same in windows i.e format a Pendrive in the windows operating system to store some files and then try to view these files through any Linux operating system. we will be able to see the contents. we will also be able to open and read file content easily.
How is that possible? The answer to these questions lies in the concept of the virtual file system that Linux support. VFX is a file system interface for a user process. VFS has the capability of conceiving features and behavior of any file system regardless of processor type memory format as well as hardware.
Two mapping functions are used that transform the properties of the real-time system to the characteristics required by VFS.
As shown in the diagram:
The user process initiates the execution of the system call with the help of the VFS method. VFS interprets this stimulus into an appropriate internal file system call which in turn activates the concerned mapping function of the specified file system.
In the case of an operating system that demands structural changes, all required constructs are created dynamically to meet the requirements. Ex: In FAT-compatible systems, directories are not treated as files so such characteristics are dynamically created since they cannot be mapped. The target file system is then activated to take control so that results can be delivered to the user of the system.
As seen in the above diagram actions and reactions are observed as a role of VFS:
The user initiates a file-oriented system call.
1. Tmpfs virtual file system: A virtual file system for Linux called tmpfs stores data in the system's virtual memory. The internal caches of the kernel serve as temporary storage for all files, much like any other virtual file system.
2. Sysfs virtual file system: When a device is added or withdrawn, the sysfs virtual file system dynamically updates the user-specified view of the system's devices. The global, bus, and device discovery levels are represented by the directory hierarchy beneath /sys. The files on the global layer record the device's power state, which is also programmable. The files in the bus layer report details about each device's resources and IRQ number. The file system contains files that a device driver can use to access data or configurable interfaces.
The filesystem type, which is specified in include/linux/fs.h (and abbreviated here for brevity), must be known by the kernel in order to use a filesystem:
Example 1: