mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:05:07 +00:00
Kernel: Some improvements to the mount syscall
- You must now have superuser privileges to use mount(). - We now verify that the mount point is a valid path first, before trying to find a filesystem on the specified device. - Convert some dbgprintf() to dbg().
This commit is contained in:
parent
c76668644b
commit
31de5dee26
3 changed files with 33 additions and 19 deletions
|
@ -36,21 +36,25 @@ InodeIdentifier VFS::root_inode_id() const
|
|||
return m_root_inode->identifier();
|
||||
}
|
||||
|
||||
bool VFS::mount(NonnullRefPtr<FS>&& file_system, StringView path)
|
||||
KResult VFS::mount(NonnullRefPtr<FS>&& file_system, Custody& mount_point)
|
||||
{
|
||||
auto& inode = mount_point.inode();
|
||||
dbg() << "VFS: Mounting " << file_system->class_name() << " at " << mount_point.absolute_path() << " (inode: " << inode.identifier() << ")";
|
||||
// FIXME: check that this is not already a mount point
|
||||
auto mount = make<Mount>(mount_point, move(file_system));
|
||||
m_mounts.append(move(mount));
|
||||
mount_point.did_mount_on({});
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
KResult VFS::mount(NonnullRefPtr<FS>&& file_system, StringView path)
|
||||
{
|
||||
auto result = resolve_path(path, root_custody());
|
||||
if (result.is_error()) {
|
||||
dbg() << "VFS: mount can't resolve mount point '" << path << "'";
|
||||
return false;
|
||||
return result.error();
|
||||
}
|
||||
auto& inode = result.value()->inode();
|
||||
dbg() << "VFS: Mounting " << file_system->class_name() << " at " << path << " (inode: " << inode.identifier() << ")";
|
||||
// FIXME: check that this is not already a mount point
|
||||
auto mount = make<Mount>(*result.value(), move(file_system));
|
||||
m_mounts.append(move(mount));
|
||||
|
||||
result.value()->did_mount_on({});
|
||||
return true;
|
||||
return mount(move(file_system), result.value());
|
||||
}
|
||||
|
||||
bool VFS::mount_root(NonnullRefPtr<FS>&& file_system)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue