mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-17 05:06:46 +00:00
Kernel: Implement bind mounts
You can now bind-mount files and directories. This essentially exposes an
existing part of the file system in another place, and can be used as an
alternative to symlinks or hardlinks.
Here's an example of doing this:
# mkdir /tmp/foo
# mount /home/anon/myfile.txt /tmp/foo -o bind
# cat /tmp/foo
This is anon's file.
This commit is contained in:
committed by
Andreas Kling
parent
71f1d3f819
commit
0cb0f54783
@@ -3602,6 +3602,15 @@ int Process::sys$mount(const Syscall::SC_mount_params* user_params)
|
||||
|
||||
RefPtr<FS> fs;
|
||||
|
||||
if (params.flags & MS_BIND) {
|
||||
// We're doing a bind mount.
|
||||
auto source_or_error = VFS::the().resolve_path(source, current_directory());
|
||||
if (source_or_error.is_error())
|
||||
return source_or_error.error();
|
||||
auto& source_custody = source_or_error.value();
|
||||
return VFS::the().bind_mount(source_custody, target_custody);
|
||||
}
|
||||
|
||||
if (fs_type == "ext2" || fs_type == "Ext2FS") {
|
||||
auto metadata_or_error = VFS::the().lookup_metadata(source, current_directory());
|
||||
if (metadata_or_error.is_error())
|
||||
|
||||
Reference in New Issue
Block a user