blob: 3176d6d3848170a666e4ae735383c1995c362ef8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include "kernel/filesystem/mount_table.hpp"
#include "kapi/system.hpp"
#include "kernel/filesystem/dentry.hpp"
#include "kernel/filesystem/mount.hpp"
#include <kstd/memory>
#include <algorithm>
namespace filesystem
{
void mount_table::add_mount(kstd::shared_ptr<mount> mount)
{
m_mounts.push_back(mount);
}
auto mount_table::find_mount_by_dentry(kstd::shared_ptr<dentry> const & dentry) -> kstd::shared_ptr<mount>
{
auto it = std::ranges::find_if(m_mounts, [&](auto const & mount) { return mount->get_dentry() == dentry; });
if (it != m_mounts.end())
{
return *it;
}
kapi::system::panic("[FILESYSTEM] dentry has mount flag set but no corresponding mount found.");
}
} // namespace filesystem
|