MOS Source Code
Loading...
Searching...
No Matches
vfs.cpp File Reference
Include dependency graph for vfs.cpp:

Go to the source code of this file.

Functions

static long do_pagecache_flush (FsBaseFile *file, off_t pgoff, size_t npages)
static long do_sync_inode (FsBaseFile *file)
static vmfault_result_t vfs_fault_handler (vmap_t *vmap, ptr_t fault_addr, pagefault_t *info)
static __used void vfs_flusher_entry (void *arg)
static void vfs_flusher_init (void)
 MOS_INIT (KTHREAD, vfs_flusher_init)
static void vfs_copy_stat (file_stat_t *statbuf, inode_t *inode)
static filesystem_tvfs_find_filesystem (mos::string_view name)
static bool vfs_verify_permissions (dentry_t &file_dentry, bool open, bool read, bool create, bool execute, bool write)
static PtrResult< FsBaseFilevfs_do_open (dentry_t *base, mos::string_view path, OpenFlags flags)
PtrResult< FsBaseFilevfs_do_open_dentry (dentry_t *dentry, bool created, bool read, bool write, bool exec, bool truncate)
 Open an directory dentry.
void vfs_register_filesystem (filesystem_t *fs)
PtrResult< voidvfs_mount (const char *device, const char *path, const char *fs, const char *options)
 Mount a filesystem at a given existing path.
long vfs_unmount (const char *path)
 Unmount a filesystem at a given path.
PtrResult< FsBaseFilevfs_openat (int fd, mos::string_view path, OpenFlags flags)
 Open a file at a given path.
long vfs_fstatat (fd_t fd, const char *path, file_stat_t *__restrict statbuf, FStatAtFlags flags)
 Stat a file.
size_t vfs_readlinkat (fd_t dirfd, const char *path, char *buf, size_t size)
 Read a symbolic link.
long vfs_symlink (const char *path, const char *target)
 Create a symbolic link.
PtrResult< voidvfs_mkdir (const char *path)
 Create a directory.
PtrResult< voidvfs_rmdir (const char *path)
size_t vfs_list_dir (IO *io, void *user_buf, size_t user_size)
 Get the content of a directory.
long vfs_chdirat (fd_t dirfd, const char *path)
 Change the current working directory.
ssize_t vfs_getcwd (char *buf, size_t size)
 Get the current working directory.
long vfs_fchmodat (fd_t fd, const char *path, int perm, int flags)
 Change the permissions of a file.
long vfs_unlinkat (fd_t dirfd, const char *path)
 Remove the name of a file, and possibly the file itself.
long vfs_fsync (IO *io, bool sync_metadata, off_t start, off_t end)
 Synchronize a file with the filesystem.
static bool vfs_sysfs_filesystems (sysfs_file_t *f)
static bool vfs_sysfs_mountpoints (sysfs_file_t *f)
static void vfs_sysfs_dentry_stats_stat_receiver (int depth, const dentry_t *dentry, bool mountroot, void *data)
static bool vfs_sysfs_dentry_stats (sysfs_file_t *f)
 SYSFS_AUTOREGISTER (vfs, vfs_sysfs_items)

Variables

static list_head vfs_fs_list
static spinlock_t vfs_fs_list_lock
dentry_troot_dentry = NULL
static sysfs_item_t vfs_sysfs_items []

Function Documentation

◆ do_pagecache_flush()

long do_pagecache_flush ( FsBaseFile * file,
off_t pgoff,
size_t npages )
static

Definition at line 37 of file vfs.cpp.

Referenced by FsFile::on_closed(), and vfs_fsync().

Here is the call graph for this function:

◆ do_sync_inode()

long do_sync_inode ( FsBaseFile * file)
static

Definition at line 52 of file vfs.cpp.

Referenced by FsFile::on_closed(), and vfs_fsync().

◆ vfs_fault_handler()

vmfault_result_t vfs_fault_handler ( vmap_t * vmap,
ptr_t fault_addr,
pagefault_t * info )
static

Definition at line 187 of file vfs.cpp.

Referenced by FsFile::on_mmap().

Here is the call graph for this function:

◆ vfs_flusher_entry()

__used void vfs_flusher_entry ( void * arg)
static

Definition at line 276 of file vfs.cpp.

Here is the call graph for this function:

◆ vfs_flusher_init()

void vfs_flusher_init ( void )
static

Definition at line 286 of file vfs.cpp.

Referenced by MOS_INIT().

◆ MOS_INIT()

MOS_INIT ( KTHREAD ,
vfs_flusher_init  )
Here is the call graph for this function:

◆ vfs_copy_stat()

void vfs_copy_stat ( file_stat_t * statbuf,
inode_t * inode )
static

Definition at line 292 of file vfs.cpp.

Referenced by vfs_fstatat().

◆ vfs_find_filesystem()

filesystem_t * vfs_find_filesystem ( mos::string_view name)
static

Definition at line 309 of file vfs.cpp.

Referenced by vfs_mount(), and vfs_register_filesystem().

◆ vfs_verify_permissions()

bool vfs_verify_permissions ( dentry_t & file_dentry,
bool open,
bool read,
bool create,
bool execute,
bool write )
static

Definition at line 321 of file vfs.cpp.

Referenced by vfs_do_open().

◆ vfs_do_open()

PtrResult< FsBaseFile > vfs_do_open ( dentry_t * base,
mos::string_view path,
OpenFlags flags )
static

Definition at line 338 of file vfs.cpp.

Referenced by vfs_openat().

Here is the call graph for this function:

◆ vfs_sysfs_filesystems()

bool vfs_sysfs_filesystems ( sysfs_file_t * f)
static

Definition at line 901 of file vfs.cpp.

Here is the call graph for this function:

◆ vfs_sysfs_mountpoints()

bool vfs_sysfs_mountpoints ( sysfs_file_t * f)
static

Definition at line 911 of file vfs.cpp.

Here is the call graph for this function:

◆ vfs_sysfs_dentry_stats_stat_receiver()

void vfs_sysfs_dentry_stats_stat_receiver ( int depth,
const dentry_t * dentry,
bool mountroot,
void * data )
static

Definition at line 925 of file vfs.cpp.

Referenced by vfs_sysfs_dentry_stats().

Here is the call graph for this function:

◆ vfs_sysfs_dentry_stats()

bool vfs_sysfs_dentry_stats ( sysfs_file_t * f)
static

Definition at line 937 of file vfs.cpp.

Here is the call graph for this function:

◆ SYSFS_AUTOREGISTER()

SYSFS_AUTOREGISTER ( vfs ,
vfs_sysfs_items  )

Variable Documentation

◆ vfs_fs_list

list_head vfs_fs_list
static

Definition at line 32 of file vfs.cpp.

Referenced by vfs_find_filesystem(), vfs_register_filesystem(), and vfs_sysfs_filesystems().

◆ vfs_fs_list_lock

spinlock_t vfs_fs_list_lock
static

Definition at line 33 of file vfs.cpp.

Referenced by vfs_find_filesystem(), and vfs_register_filesystem().

◆ vfs_sysfs_items

sysfs_item_t vfs_sysfs_items[]
static
Initial value:
= {
}
#define SYSFS_RO_ITEM(_name, _show_fn)
Definition sysfs.hpp:42
static bool vfs_sysfs_dentry_stats(sysfs_file_t *f)
Definition vfs.cpp:937
static bool vfs_sysfs_filesystems(sysfs_file_t *f)
Definition vfs.cpp:901
static bool vfs_sysfs_mountpoints(sysfs_file_t *f)
Definition vfs.cpp:911

Definition at line 943 of file vfs.cpp.

Referenced by SYSFS_AUTOREGISTER().