|
AquilaOS documentation
How it works, and its code
|
The virtual filesystem (VFS): the filesystems that are installed, the root, mounting one filesystem on a directory of another, and permissions. More...
#include <core/system.h>#include <core/string.h>#include <mm/mm.h>#include <fs/vfs.h>#include <sys/proc.h>#include <sys/sched.h>#include <aquila/fcntl.h>#include <aquila/errno.h>#include <dev/dev.h>#include <net/socket.h>Go to the source code of this file.
Functions | |
| int | vfs_mount_root (struct vnode *vnode) |
| Makes a vnode the root of the filesystem tree. | |
| int | vfs_bind (struct vnode *dir, struct vnode *root) |
| Mounts a filesystem on a directory: a lookup that reaches dir goes on in root instead. | |
| void | vfs_init (void) |
| Sets up the VFS at boot. | |
| int | vfs_install (struct fs *fs) |
| Installs a filesystem, so that it can be mounted by name. | |
| int | vfs_access (struct vnode *vnode, struct uio *uio, int mode) |
| Checks whether a user may access a vnode in a way: the owner's permissions apply to its owner, the group's to its group, the others' to everyone else. | |
| int | vfs_perms_check (struct file *file, struct uio *uio) |
| Checks whether a user may open a file the way it's being opened (read, write, execute, as its flags say). | |
Variables | |
| static int | vfs_log_level = LOG_NONE |
| struct fs_list * | registered_fs = NULL |
| The installed filesystems. | |
| struct vnode * | vfs_root = NULL |
The virtual filesystem (VFS): the filesystems that are installed, the root, mounting one filesystem on a directory of another, and permissions.
See docs/kernel/vfs.md.
Definition in file vfs.c.
Checks whether a user may access a vnode in a way: the owner's permissions apply to its owner, the group's to its group, the others' to everyone else.
Root may do anything, but only execute a file that has an execute bit.
Definition at line 114 of file vfs.c.
References uio::gid, vnode::gid, vnode::mode, shift, uio::uid, vnode::uid, vfs_access(), and VFS_X.
Referenced by binfmt_load(), cwd_set(), do_faccessat(), exec_script(), vfs_access(), vfs_link(), vfs_mknod(), vfs_perms_check(), vfs_remove(), vfs_rename(), vfs_utimens(), and walk().
Mounts a filesystem on a directory: a lookup that reaches dir goes on in root instead.
The mount keeps a reference to dir. Mounting on the root makes root the new root.
| dir | the directory to mount on |
| root | the root directory of the filesystem to mount |
Definition at line 53 of file vfs.c.
References vnode::covered, vnode::mounted, vnode::ref, vfs_bind(), vfs_mount_root(), and vfs_root.
Referenced by devfs_mount(), devpts_mount(), ext2_mount(), minix_mount(), procfs_mount(), tmpfs_mount(), and vfs_bind().
| void vfs_init | ( | void | ) |
Sets up the VFS at boot.
Definition at line 74 of file vfs.c.
References LOG_INFO, and vfs_init().
Referenced by kmain(), and vfs_init().
| int vfs_install | ( | struct fs * | fs | ) |
Installs a filesystem, so that it can be mounted by name.
| fs | the filesystem |
Definition at line 85 of file vfs.c.
References fs_list::fs, kmalloc(), LOG_INFO, fs::name, fs_list::name, fs_list::next, registered_fs, and vfs_install().
Referenced by devfs_init(), devpts_init(), ext2_init(), minix_init(), procfs_init(), tmpfs_init(), and vfs_install().
| int vfs_mount_root | ( | struct vnode * | vnode | ) |
Makes a vnode the root of the filesystem tree.
| vnode | the root directory of a filesystem |
Definition at line 37 of file vfs.c.
References vfs_mount_root(), and vfs_root.
Referenced by load_ramdisk(), vfs_bind(), vfs_mount_root(), and vfs_mount_root_dev().
Checks whether a user may open a file the way it's being opened (read, write, execute, as its flags say).
| file | the file being opened, its flags set |
| uio | who is opening it |
Definition at line 139 of file vfs.c.
References file::flags, vfs_access(), vfs_perms_check(), VFS_R, VFS_W, and VFS_X.
Referenced by do_openat(), and vfs_perms_check().
The installed filesystems.
Definition at line 25 of file vfs.c.
Referenced by procfs_filesystems(), vfs_install(), vfs_mount(), and vfs_mount_root_dev().
Definition at line 29 of file vfs.c.
Referenced by sched_init_spawn(), vfs_bind(), vfs_mount_root(), vfs_mount_root_of(), vfs_vnode_path(), and walk_root().