diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index c7ddb99d90..fb62e19dc1 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -94,12 +94,6 @@ UNMAP_AFTER_INIT VirtualFileSystem::VirtualFileSystem() UNMAP_AFTER_INIT VirtualFileSystem::~VirtualFileSystem() = default; -InodeIdentifier VirtualFileSystem::root_inode_id() const -{ - VERIFY(m_root_inode); - return m_root_inode->identifier(); -} - bool VirtualFileSystem::check_matching_absolute_path_hierarchy(Custody const& first_custody, Custody const& second_custody) { // Are both custodies the root mount? @@ -251,7 +245,7 @@ ErrorOr VirtualFileSystem::remount(Custody& mount_point, int new_flags) { dbgln("VirtualFileSystem: Remounting inode {}", mount_point.inode().identifier()); - auto* mount = find_mount_for_guest(mount_point.inode().identifier()); + auto* mount = find_mount_for_host_custody(mount_point); if (!mount) return ENODEV; @@ -400,22 +394,6 @@ auto VirtualFileSystem::find_mount_for_host_custody(Custody const& current_custo }); } -auto VirtualFileSystem::find_mount_for_guest(InodeIdentifier id) -> Mount* -{ - return m_mounts.with([&](auto& mounts) -> Mount* { - for (auto& mount : mounts) { - if (mount.guest().identifier() == id) - return &mount; - } - return nullptr; - }); -} - -bool VirtualFileSystem::is_vfs_root(InodeIdentifier inode) const -{ - return inode == root_inode_id(); -} - ErrorOr VirtualFileSystem::traverse_directory_inode(Inode& dir_inode, Function(FileSystem::DirectoryEntryView const&)> callback) { return dir_inode.traverse_as_directory([&](auto& entry) -> ErrorOr { diff --git a/Kernel/FileSystem/VirtualFileSystem.h b/Kernel/FileSystem/VirtualFileSystem.h index 103c346f7e..ad7c7afb3d 100644 --- a/Kernel/FileSystem/VirtualFileSystem.h +++ b/Kernel/FileSystem/VirtualFileSystem.h @@ -88,8 +88,6 @@ public: ErrorOr for_each_mount(Function(Mount const&)>) const; - InodeIdentifier root_inode_id() const; - void sync_filesystems(); void lock_all_filesystems(); @@ -111,16 +109,13 @@ private: ErrorOr add_file_system_to_mount_table(FileSystem& file_system, Custody& mount_point, int flags); - bool is_vfs_root(InodeIdentifier) const; - ErrorOr traverse_directory_inode(Inode&, Function(FileSystem::DirectoryEntryView const&)>); static bool check_matching_absolute_path_hierarchy(Custody const& first_custody, Custody const& second_custody); bool mount_point_exists_at_custody(Custody& mount_point); - // FIXME: These functions are totally unsafe as someone could unmount the returned Mount underneath us. + // FIXME: This function is totally unsafe as someone could unmount the returned Mount underneath us. Mount* find_mount_for_host_custody(Custody const& current_custody); - Mount* find_mount_for_guest(InodeIdentifier); RefPtr m_root_inode;