Kernel+LibC: Add support for mount flags

At the moment, the actual flags are ignored, but we correctly propagate them all
the way from the original mount() syscall to each custody that resides on the
mounted FS.
This commit is contained in:
Sergey Bugaev 2020-01-11 18:25:26 +03:00 committed by Andreas Kling
commit 4566c2d811
Notes: sideshowbarker 2024-07-19 10:11:57 +09:00
10 changed files with 54 additions and 34 deletions

View file

@ -3642,7 +3642,7 @@ int Process::sys$mount(const Syscall::SC_mount_params* user_params)
return -ENODEV;
}
auto result = VFS::the().mount(fs.release_nonnull(), target_custody);
auto result = VFS::the().mount(fs.release_nonnull(), target_custody, params.flags);
dbg() << "mount: successfully mounted " << source << " on " << target;
return result;
}
@ -4170,8 +4170,9 @@ int Process::sys$chroot(const char* user_path, size_t path_length)
auto directory_or_error = VFS::the().open_directory(path.value(), current_directory());
if (directory_or_error.is_error())
return directory_or_error.error();
m_root_directory_for_procfs = directory_or_error.value();
set_root_directory(Custody::create(nullptr, "", directory_or_error.value()->inode()));
auto directory = directory_or_error.value();
m_root_directory_for_procfs = directory;
set_root_directory(Custody::create(nullptr, "", directory->inode(), directory->mount_flags()));
return 0;
}