1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

Kernel+Userland: Split bind-mounting and re-mounting from mount syscall

These 2 are an actual separate types of syscalls, so let's stop using
special flags for bind mounting or re-mounting and instead let userspace
calling directly for this kind of actions.
This commit is contained in:
Liav A 2023-02-25 19:30:28 +02:00 committed by Andrew Kaster
parent 04b44a827a
commit 0bbd9040ef
10 changed files with 204 additions and 42 deletions

View file

@ -232,6 +232,33 @@ ErrorOr<void> ptrace_peekbuf(pid_t tid, void const* tracee_addr, Bytes destinati
HANDLE_SYSCALL_RETURN_VALUE("ptrace_peekbuf", rc, {});
}
ErrorOr<void> bindmount(int source_fd, StringView target, int flags)
{
if (target.is_null())
return Error::from_errno(EFAULT);
Syscall::SC_bindmount_params params {
{ target.characters_without_null_termination(), target.length() },
source_fd,
flags,
};
int rc = syscall(SC_bindmount, &params);
HANDLE_SYSCALL_RETURN_VALUE("bindmount", rc, {});
}
ErrorOr<void> remount(StringView target, int flags)
{
if (target.is_null())
return Error::from_errno(EFAULT);
Syscall::SC_remount_params params {
{ target.characters_without_null_termination(), target.length() },
flags
};
int rc = syscall(SC_remount, &params);
HANDLE_SYSCALL_RETURN_VALUE("remount", rc, {});
}
ErrorOr<void> mount(int source_fd, StringView target, StringView fs_type, int flags)
{
if (target.is_null() || fs_type.is_null())