My Kernel v0.1.0

Virtual File System. More...

Collaboration diagram for VFS:

Modules

 Virtual filesystem
 
 Virtual nodes
 

Data Structures

struct  vfs_fs
 Represents a file system format. More...
 

Macros

#define DECLARE_FILESYSTEM(fs_name, fs_new)
 Declare a new available filesystem. More...
 

Functions

static bool vfs_exist (const char *path)
 

Detailed Description

Virtual Filesystem

The virtual is an abstraction over filesystems used to separate the high level interface from the low level fs-dependent implementation. It also allows for computing a path which spans over multiple different imbricked filesystems, effectively viewing it as a single big filesystem from the user's POV.

Design

The VFS splits each mounted filesystem into 2 parts:

The VFS driver keeps track of all the present virtual filesystem, and addresses them in order to find a requested path. When "opening" a file, we instead ask the corresponding VFS to create the VNODE which corresponds to this file, and interact with it instead. All the filesystem dependant logic is hidden from the VFS driver.

See also
http://www.cs.fsu.edu/~awang/courses/cop5611_s2024/vnode.pdf

Macro Definition Documentation

◆ DECLARE_FILESYSTEM

#define DECLARE_FILESYSTEM (   fs_name,
  fs_new 
)
Value:
SECTION(".data.vfs.filesystems") \
MAYBE_UNUSED \
static vfs_fs_t fs_name##_fs_declaration = { \
.name = stringify(fs_name), \
.new = fs_new, \
}
#define stringify(_x)
Preprocess an expression into a raw string.
Definition: stringify.h:8
Represents a file system format.
Definition: vfs.h:253
const char *const name
Name of the filesystem.
Definition: vfs.h:254

A file system needs to be declared using this macro for the VFS driver to be able to mount it using vfs_mount.

Parameters
fs_nameThe name of the filesystem
fw_newThe function used to create a new instance of this filesystem

Function Documentation

◆ vfs_exist()

static bool vfs_exist ( const char *  path)
inlinestatic
Returns
Whether a path exists in the current VFS.