1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

Kernel: Rename VFS => VirtualFileSystem

This commit is contained in:
Andreas Kling 2021-07-11 00:25:24 +02:00
parent d53d9d3677
commit 0d39bd04d3
38 changed files with 124 additions and 124 deletions

View file

@ -16,7 +16,7 @@ KResultOr<FlatPtr> Process::sys$access(Userspace<const char*> user_path, size_t
auto path = get_syscall_path_argument(user_path, path_length);
if (path.is_error())
return path.error();
return VFS::the().access(path.value()->view(), mode, current_directory());
return VirtualFileSystem::the().access(path.value()->view(), mode, current_directory());
}
}

View file

@ -17,7 +17,7 @@ KResultOr<FlatPtr> Process::sys$chdir(Userspace<const char*> user_path, size_t p
auto path = get_syscall_path_argument(user_path, path_length);
if (path.is_error())
return path.error();
auto directory_or_error = VFS::the().open_directory(path.value()->view(), current_directory());
auto directory_or_error = VirtualFileSystem::the().open_directory(path.value()->view(), current_directory());
if (directory_or_error.is_error())
return directory_or_error.error();
m_cwd = *directory_or_error.value();

View file

@ -17,7 +17,7 @@ KResultOr<FlatPtr> Process::sys$chmod(Userspace<const char*> user_path, size_t p
auto path = get_syscall_path_argument(user_path, path_length);
if (path.is_error())
return path.error();
return VFS::the().chmod(path.value()->view(), mode, current_directory());
return VirtualFileSystem::the().chmod(path.value()->view(), mode, current_directory());
}
KResultOr<FlatPtr> Process::sys$fchmod(int fd, mode_t mode)

View file

@ -27,7 +27,7 @@ KResultOr<FlatPtr> Process::sys$chown(Userspace<const Syscall::SC_chown_params*>
auto path = get_syscall_path_argument(params.path);
if (path.is_error())
return path.error();
return VFS::the().chown(path.value()->view(), params.uid, params.gid, current_directory());
return VirtualFileSystem::the().chown(path.value()->view(), params.uid, params.gid, current_directory());
}
}

View file

@ -19,7 +19,7 @@ KResultOr<FlatPtr> Process::sys$chroot(Userspace<const char*> user_path, size_t
auto path = get_syscall_path_argument(user_path, path_length);
if (path.is_error())
return path.error();
auto directory_or_error = VFS::the().open_directory(path.value()->view(), current_directory());
auto directory_or_error = VirtualFileSystem::the().open_directory(path.value()->view(), current_directory());
if (directory_or_error.is_error())
return directory_or_error.error();
auto directory = directory_or_error.value();

View file

@ -762,7 +762,7 @@ KResultOr<RefPtr<FileDescription>> Process::find_elf_interpreter_for_executable(
if (!interpreter_path.is_empty()) {
dbgln_if(EXEC_DEBUG, "exec({}): Using program interpreter {}", path, interpreter_path);
auto interp_result = VFS::the().open(interpreter_path, O_EXEC, 0, current_directory());
auto interp_result = VirtualFileSystem::the().open(interpreter_path, O_EXEC, 0, current_directory());
if (interp_result.is_error()) {
dbgln("exec({}): Unable to open program interpreter {}", path, interpreter_path);
return interp_result.error();
@ -838,7 +838,7 @@ KResult Process::exec(String path, Vector<String> arguments, Vector<String> envi
// * ET_EXEC binary that just gets loaded
// * ET_DYN binary that requires a program interpreter
//
auto file_or_error = VFS::the().open(path, O_EXEC, 0, current_directory());
auto file_or_error = VirtualFileSystem::the().open(path, O_EXEC, 0, current_directory());
if (file_or_error.is_error())
return file_or_error.error();
auto description = file_or_error.release_value();

View file

@ -59,7 +59,7 @@ KResultOr<FlatPtr> Process::sys$inode_watcher_add_watch(Userspace<const Syscall:
if (path.is_error())
return path.error();
auto custody_or_error = VFS::the().resolve_path(path.value()->view(), current_directory());
auto custody_or_error = VirtualFileSystem::the().resolve_path(path.value()->view(), current_directory());
if (custody_or_error.is_error())
return custody_or_error.error();

View file

@ -22,7 +22,7 @@ KResultOr<FlatPtr> Process::sys$link(Userspace<const Syscall::SC_link_params*> u
auto new_path = copy_string_from_user(params.new_path);
if (new_path.is_null())
return EFAULT;
return VFS::the().link(old_path, new_path, current_directory());
return VirtualFileSystem::the().link(old_path, new_path, current_directory());
}
KResultOr<FlatPtr> Process::sys$symlink(Userspace<const Syscall::SC_symlink_params*> user_params)
@ -37,7 +37,7 @@ KResultOr<FlatPtr> Process::sys$symlink(Userspace<const Syscall::SC_symlink_para
auto linkpath = get_syscall_path_argument(params.linkpath);
if (linkpath.is_error())
return linkpath.error();
return VFS::the().symlink(target.value()->view(), linkpath.value()->view(), current_directory());
return VirtualFileSystem::the().symlink(target.value()->view(), linkpath.value()->view(), current_directory());
}
}

View file

@ -16,6 +16,6 @@ KResultOr<FlatPtr> Process::sys$mkdir(Userspace<const char*> user_path, size_t p
auto path = get_syscall_path_argument(user_path, path_length);
if (path.is_error())
return path.error();
return VFS::the().mkdir(path.value()->view(), mode & ~umask(), current_directory());
return VirtualFileSystem::the().mkdir(path.value()->view(), mode & ~umask(), current_directory());
}
}

View file

@ -21,7 +21,7 @@ KResultOr<FlatPtr> Process::sys$mknod(Userspace<const Syscall::SC_mknod_params*>
auto path = get_syscall_path_argument(params.path);
if (path.is_error())
return path.error();
return VFS::the().mknod(path.value()->view(), params.mode & ~umask(), params.dev, current_directory());
return VirtualFileSystem::the().mknod(path.value()->view(), params.mode & ~umask(), params.dev, current_directory());
}
}

View file

@ -25,7 +25,7 @@ KResultOr<FlatPtr> Process::sys$module_load(Userspace<const char*> user_path, si
auto path = get_syscall_path_argument(user_path, path_length);
if (path.is_error())
return path.error();
auto description_or_error = VFS::the().open(path.value()->view(), O_RDONLY, 0, current_directory());
auto description_or_error = VirtualFileSystem::the().open(path.value()->view(), O_RDONLY, 0, current_directory());
if (description_or_error.is_error())
return description_or_error.error();
auto& description = description_or_error.value();

View file

@ -42,7 +42,7 @@ KResultOr<FlatPtr> Process::sys$mount(Userspace<const Syscall::SC_mount_params*>
else
dbgln("mount {} @ {}", fs_type, target);
auto custody_or_error = VFS::the().resolve_path(target, current_directory());
auto custody_or_error = VirtualFileSystem::the().resolve_path(target, current_directory());
if (custody_or_error.is_error())
return custody_or_error.error();
@ -50,7 +50,7 @@ KResultOr<FlatPtr> Process::sys$mount(Userspace<const Syscall::SC_mount_params*>
if (params.flags & MS_REMOUNT) {
// We're not creating a new mount, we're updating an existing one!
return VFS::the().remount(target_custody, params.flags & ~MS_REMOUNT);
return VirtualFileSystem::the().remount(target_custody, params.flags & ~MS_REMOUNT);
}
if (params.flags & MS_BIND) {
@ -61,7 +61,7 @@ KResultOr<FlatPtr> Process::sys$mount(Userspace<const Syscall::SC_mount_params*>
// We only support bind-mounting inodes, not arbitrary files.
return ENODEV;
}
return VFS::the().bind_mount(*description->custody(), target_custody, params.flags);
return VirtualFileSystem::the().bind_mount(*description->custody(), target_custody, params.flags);
}
RefPtr<FileSystem> fs;
@ -106,7 +106,7 @@ KResultOr<FlatPtr> Process::sys$mount(Userspace<const Syscall::SC_mount_params*>
return ENODEV;
}
auto result = VFS::the().mount(fs.release_nonnull(), target_custody, params.flags);
auto result = VirtualFileSystem::the().mount(fs.release_nonnull(), target_custody, params.flags);
if (!description.is_null())
dbgln("mount: successfully mounted {} on {}", description->absolute_path(), target);
else
@ -125,12 +125,12 @@ KResultOr<FlatPtr> Process::sys$umount(Userspace<const char*> user_mountpoint, s
if (mountpoint.is_error())
return mountpoint.error();
auto custody_or_error = VFS::the().resolve_path(mountpoint.value()->view(), current_directory());
auto custody_or_error = VirtualFileSystem::the().resolve_path(mountpoint.value()->view(), current_directory());
if (custody_or_error.is_error())
return custody_or_error.error();
auto& guest_inode = custody_or_error.value()->inode();
return VFS::the().unmount(guest_inode);
return VirtualFileSystem::the().unmount(guest_inode);
}
}

View file

@ -62,7 +62,7 @@ KResultOr<FlatPtr> Process::sys$open(Userspace<const Syscall::SC_open_params*> u
base = base_description->custody();
}
auto result = VFS::the().open(path.value()->view(), options, mode & ~umask(), *base);
auto result = VirtualFileSystem::the().open(path.value()->view(), options, mode & ~umask(), *base);
if (result.is_error())
return result.error();
auto description = result.value();

View file

@ -23,7 +23,7 @@ KResultOr<FlatPtr> Process::sys$readlink(Userspace<const Syscall::SC_readlink_pa
if (path.is_error())
return path.error();
auto result = VFS::the().open(path.value()->view(), O_RDONLY | O_NOFOLLOW_NOERROR, 0, current_directory());
auto result = VirtualFileSystem::the().open(path.value()->view(), O_RDONLY | O_NOFOLLOW_NOERROR, 0, current_directory());
if (result.is_error())
return result.error();
auto description = result.value();

View file

@ -23,7 +23,7 @@ KResultOr<FlatPtr> Process::sys$realpath(Userspace<const Syscall::SC_realpath_pa
if (path.is_error())
return path.error();
auto custody_or_error = VFS::the().resolve_path(path.value()->view(), current_directory());
auto custody_or_error = VirtualFileSystem::the().resolve_path(path.value()->view(), current_directory());
if (custody_or_error.is_error())
return custody_or_error.error();
auto& custody = custody_or_error.value();

View file

@ -22,7 +22,7 @@ KResultOr<FlatPtr> Process::sys$rename(Userspace<const Syscall::SC_rename_params
auto new_path = get_syscall_path_argument(params.new_path);
if (new_path.is_error())
return new_path.error();
return VFS::the().rename(old_path.value()->view(), new_path.value()->view(), current_directory());
return VirtualFileSystem::the().rename(old_path.value()->view(), new_path.value()->view(), current_directory());
}
}

View file

@ -16,7 +16,7 @@ KResultOr<FlatPtr> Process::sys$rmdir(Userspace<const char*> user_path, size_t p
auto path = get_syscall_path_argument(user_path, path_length);
if (path.is_error())
return path.error();
return VFS::the().rmdir(path.value()->view(), current_directory());
return VirtualFileSystem::the().rmdir(path.value()->view(), current_directory());
}
}

View file

@ -47,7 +47,7 @@ KResultOr<FlatPtr> Process::sys$stat(Userspace<const Syscall::SC_stat_params*> u
return EINVAL;
base = base_description->custody();
}
auto metadata_or_error = VFS::the().lookup_metadata(path.value()->view(), *base, params.follow_symlinks ? 0 : O_NOFOLLOW_NOERROR);
auto metadata_or_error = VirtualFileSystem::the().lookup_metadata(path.value()->view(), *base, params.follow_symlinks ? 0 : O_NOFOLLOW_NOERROR);
if (metadata_or_error.is_error())
return metadata_or_error.error();
stat statbuf;

View file

@ -13,7 +13,7 @@ namespace Kernel {
KResultOr<FlatPtr> Process::do_statvfs(String path, statvfs* buf)
{
auto custody_or_error = VFS::the().resolve_path(path, current_directory(), nullptr, 0);
auto custody_or_error = VirtualFileSystem::the().resolve_path(path, current_directory(), nullptr, 0);
if (custody_or_error.is_error())
return custody_or_error.error();
@ -42,7 +42,7 @@ KResultOr<FlatPtr> Process::do_statvfs(String path, statvfs* buf)
Custody* current_custody = custody;
while (current_custody) {
VFS::the().for_each_mount([&kernelbuf, &current_custody](auto& mount) {
VirtualFileSystem::the().for_each_mount([&kernelbuf, &current_custody](auto& mount) {
if (current_custody) {
if (&current_custody->inode() == &mount.guest()) {
int mountflags = mount.flags();

View file

@ -12,7 +12,7 @@ namespace Kernel {
KResultOr<FlatPtr> Process::sys$sync()
{
REQUIRE_PROMISE(stdio);
VFS::the().sync();
VirtualFileSystem::the().sync();
return 0;
}

View file

@ -16,7 +16,7 @@ KResultOr<FlatPtr> Process::sys$unlink(Userspace<const char*> user_path, size_t
auto path = get_syscall_path_argument(user_path, path_length);
if (path.is_error())
return path.error();
return VFS::the().unlink(path.value()->view(), current_directory());
return VirtualFileSystem::the().unlink(path.value()->view(), current_directory());
}
}

View file

@ -87,7 +87,7 @@ KResultOr<FlatPtr> Process::sys$unveil(Userspace<const Syscall::SC_unveil_params
// If this case is encountered, the parent node of the path is returned and the custody of that inode is used instead.
RefPtr<Custody> parent_custody; // Parent inode in case of ENOENT
OwnPtr<KString> new_unveiled_path;
auto custody_or_error = VFS::the().resolve_path_without_veil(path.view(), root_directory(), &parent_custody);
auto custody_or_error = VirtualFileSystem::the().resolve_path_without_veil(path.view(), root_directory(), &parent_custody);
if (!custody_or_error.is_error()) {
new_unveiled_path = custody_or_error.value()->try_create_absolute_path();
if (!new_unveiled_path)

View file

@ -25,7 +25,7 @@ KResultOr<FlatPtr> Process::sys$utime(Userspace<const char*> user_path, size_t p
// Not a bug!
buf = { now, now };
}
return VFS::the().utime(path.value()->view(), current_directory(), buf.actime, buf.modtime);
return VirtualFileSystem::the().utime(path.value()->view(), current_directory(), buf.actime, buf.modtime);
}
}