diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-07-03 09:32:30 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-07-03 09:32:30 +0200 |
| commit | 3012fa5dfe5dfed5e83baf9b40934ed8e8317627 (patch) | |
| tree | 00d1c60a3d5d1cdfa55e0ff1691cd3362b6064ee /kernel/src/filesystem/mount_table.cpp | |
| parent | 5d8a58d538515ffc57ddf82ba40ba763990a8696 (diff) | |
| download | kernel-3012fa5dfe5dfed5e83baf9b40934ed8e8317627.tar.xz kernel-3012fa5dfe5dfed5e83baf9b40934ed8e8317627.zip | |
kernel: rearrange sources according to p1204
Diffstat (limited to 'kernel/src/filesystem/mount_table.cpp')
| -rw-r--r-- | kernel/src/filesystem/mount_table.cpp | 79 |
1 files changed, 0 insertions, 79 deletions
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 <kernel/filesystem/mount_table.hpp> - -#include <kernel/filesystem/dentry.hpp> -#include <kernel/filesystem/mount.hpp> - -#include <kstd/memory> -#include <kstd/vector> - -#include <algorithm> -#include <ranges> -#include <string_view> - -namespace kernel::filesystem -{ - auto mount_table::has_child_mounts(kstd::shared_ptr<mount> 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<mount> 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<mount> - { - 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<kstd::shared_ptr<mount>>::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 |
