From 3012fa5dfe5dfed5e83baf9b40934ed8e8317627 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 3 Jul 2026 09:32:30 +0200 Subject: kernel: rearrange sources according to p1204 --- kernel/src/filesystem/mount_table.cpp | 79 ----------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 kernel/src/filesystem/mount_table.cpp (limited to 'kernel/src/filesystem/mount_table.cpp') diff --git a/kernel/src/filesystem/mount_table.cpp b/kernel/src/filesystem/mount_table.cpp deleted file mode 100644 index e4baac7a..00000000 --- a/kernel/src/filesystem/mount_table.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include - -#include -#include - -#include -#include - -#include -#include -#include - -namespace kernel::filesystem -{ - auto mount_table::has_child_mounts(kstd::shared_ptr const & parent_mount) const -> bool - { - return std::ranges::any_of(m_mounts, - [&parent_mount](auto const & mount) { return mount->parent_mount() == parent_mount; }); - } - - auto mount_table::add_mount(kstd::shared_ptr const & mount) -> void - { - m_mounts.push_back(mount); - - if (auto source_mount = mount->source_mount()) - { - source_mount->increment_ref_count(); - } - - if (auto mount_dentry = mount->mount_dentry()) - { - mount_dentry->set_flag(dentry::dentry_flags::is_mount_point); - } - } - - auto mount_table::remove_mount(std::string_view path) -> operation_result - { - auto mount_it = find_mount_iterator(path); - if (mount_it == m_mounts.end()) - { - return operation_result::mount_not_found; - } - - auto const & mount = *mount_it; - if (!mount->is_ready_to_unmount()) - { - return operation_result::cannot_be_unmounted; - } - if (has_child_mounts(mount)) - { - return operation_result::has_child_mounts; - } - - if (auto source_mount = mount->source_mount()) - { - source_mount->decrement_ref_count(); - } - - if (auto mount_dentry = mount->mount_dentry()) - { - mount_dentry->unset_flag(dentry::dentry_flags::is_mount_point); - } - - m_mounts.erase(mount_it); - return operation_result::removed; - } - - auto mount_table::find_mount(std::string_view path) const -> kstd::shared_ptr - { - auto mount_it = find_mount_iterator(path); - return (mount_it != m_mounts.end()) ? *mount_it : nullptr; - } - - auto mount_table::find_mount_iterator(std::string_view path) const - -> kstd::vector>::const_iterator - { - return std::ranges::find_last_if(m_mounts, [&](auto const & mount) { return mount->mount_path() == path; }).begin(); - } -} // namespace kernel::filesystem \ No newline at end of file -- cgit v1.2.3