Skip to content

Latest commit

 

History

History
18 lines (9 loc) · 1.4 KB

vfs.md

File metadata and controls

18 lines (9 loc) · 1.4 KB

Virtual File System

The virtual file system is an abstraction which allows the kernel to work with inodes and files independent on the file system they belong to. It's basically a set of functions each file system needs to implement. Each inode then holds pointers to these functions which the kernel functions call. As inodes are created by file system specific functions, they are created with the matching set of function pointers.

The functions each file system needs to implement are defined in vfs_operations.h. They are defined in three structs: one for functions related to the super block, one for inode related operations and one for file related ones.

At init time each file system calls register_file_system() with a struct containing everything the kernel needs to mount a file system of that type.

Mounting

When a file system should be mounted the kernel looks through all registered file systems, matches the name and calls the matching init_fs_super_block() function. This sets the file system related functions and also adds "private" (fs specific) data to the super_block.


Overview: kernel | file_system

File System: init_filesystem | vfs | xv6fs | devfs | block_io | inode | file | directory