blob: 0e9a53deac32d42d5b99852e01821d6aaac1e2cf (
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
29
|
#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 found =
std::ranges::find_if(m_mounts, [&](auto const & mount) { return mount->get_dentry().get() == dentry.get(); });
if (found != m_mounts.end())
{
return *found;
}
kapi::system::panic("[FILESYSTEM] dentry has mount flag set but no corresponding mount found.");
}
} // namespace filesystem
|