MOS Source Code
|
The Virtual File System (VFS) is an abstraction layer that allows the kernel to interact with different filesystems in a uniform way. More...
Topics | |
Directory Entry | |
Directory entry. | |
Functions | |
should_inline const file_ops_t * | file_get_ops (file_t *file) |
void | vfs_register_filesystem (filesystem_t *fs) |
long | vfs_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. | |
file_t * | vfs_openat (int fd, const char *path, open_flags flags) |
Open a file at a given path. | |
long | vfs_fstatat (fd_t fd, const char *path, file_stat_t *restrict stat, fstatat_flags 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. | |
long | vfs_mkdir (const char *path) |
Create a directory. | |
long | vfs_rmdir (const char *path) |
size_t | vfs_list_dir (io_t *io, void *buf, size_t size) |
Get the content of a directory. | |
long | vfs_chdir (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. | |
Variables | |
dentry_t * | root_dentry |
The Virtual File System (VFS) is an abstraction layer that allows the kernel to interact with different filesystems in a uniform way.
should_inline const file_ops_t * file_get_ops | ( | file_t * | file | ) |
Definition at line 18 of file vfs.h.
Referenced by vfs_do_open(), vfs_io_ops_close(), vfs_io_ops_mmap(), vfs_io_ops_munmap(), vfs_io_ops_read(), vfs_io_ops_seek(), and vfs_io_ops_write().
void vfs_register_filesystem | ( | filesystem_t * | fs | ) |
Definition at line 372 of file vfs.c.
Referenced by register_cpiofs(), register_sysfs(), register_tmpfs(), and userfs_manager_register().
long vfs_mount | ( | const char * | device, |
const char * | path, | ||
const char * | fs, | ||
const char * | options ) |
Mount a filesystem at a given existing path.
device | The device to mount |
path | The path to mount the filesystem at, this absolute path to a directory must exist |
fs | The filesystem type, e.g. "tmpfs" |
options | The options to pass to the filesystem |
Definition at line 381 of file vfs.c.
Referenced by DEFINE_SYSCALL(), mos_start_kernel(), and MOS_TEST_DECL_PTEST().
long vfs_unmount | ( | const char * | path | ) |
Unmount a filesystem at a given path.
path | The path to the filesystem |
Definition at line 451 of file vfs.c.
Referenced by DEFINE_SYSCALL(), and MOS_TEST_DECL_PTEST().
file_t * vfs_openat | ( | int | fd, |
const char * | path, | ||
open_flags | flags ) |
Open a file at a given path.
fd | The fd of an open directory, or AT_FDCWD to use the current working directory |
path | The path to the file, can be absolute or relative |
flags | open_flags flags |
Definition at line 493 of file vfs.c.
Referenced by DEFINE_SYSCALL(), elf_create_process(), elf_map_interpreter(), and process_do_execveat().
long vfs_fstatat | ( | fd_t | fd, |
const char * | path, | ||
file_stat_t *restrict | stat, | ||
fstatat_flags | flags ) |
Stat a file.
fd | The directory, or a file if FSTATAT_FILE is set |
path | The path to the file |
flags | fstat_flags flags |
stat | The stat struct to store the file information in |
If the FSTATAT_FILE is set, the fd is a file, and the path will be ignored. If it is not set: If the path is absolute, the fd will be ignored. If the path is relative, the fd will be used as the directory to resolve the path from. If FSTATAT_NOFOLLOW is set, when the path is used, symlinks will not be followed.
Definition at line 501 of file vfs.c.
Referenced by DEFINE_SYSCALL().
Read a symbolic link.
dirfd | The file descriptor of the directory containing the symbolic link |
path | The path to the symbolic link |
buf | The buffer to store the link in |
size | The size of the buffer |
Definition at line 534 of file vfs.c.
Referenced by DEFINE_SYSCALL().
long vfs_symlink | ( | const char * | path, |
const char * | target ) |
Create a symbolic link.
path | The path to the symbolic link |
target | The target of the symbolic link |
Definition at line 557 of file vfs.c.
Referenced by DEFINE_SYSCALL().
long vfs_mkdir | ( | const char * | path | ) |
Create a directory.
path | The path to the directory |
Definition at line 575 of file vfs.c.
Referenced by DEFINE_SYSCALL(), mos_start_kernel(), and MOS_TEST_DECL_PTEST().
long vfs_rmdir | ( | const char * | path | ) |
Definition at line 600 of file vfs.c.
Referenced by MOS_TEST_DECL_PTEST().
Get the content of a directory.
io | The io object of a file_t, must be a directory and opened with FILE_OPEN_READ |
buf | The buffer to store the directory entries in |
size | The size of the buffer |
Definition at line 624 of file vfs.c.
Referenced by DEFINE_SYSCALL().
long vfs_chdir | ( | const char * | path | ) |
Change the current working directory.
path | The path to the new working directory |
Definition at line 675 of file vfs.c.
Referenced by DEFINE_SYSCALL().
Get the current working directory.
buf | The buffer to store the path in |
size | The size of the buffer |
Definition at line 691 of file vfs.c.
Referenced by DEFINE_SYSCALL().
Change the permissions of a file.
fd | The directory, or a file if FSTATAT_FILE is set |
path | The path to the file |
perm | The new permissions |
flags | fstat_flags flags |
Definition at line 700 of file vfs.c.
Referenced by DEFINE_SYSCALL().