blob: e498b52d6887cafbc195cf38ba798e5b21f07330 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include "kernel/filesystem/dentry.hpp"
#include "kapi/system.hpp"
#include "kernel/filesystem/inode.hpp"
#include <kstd/memory>
#include <cstdint>
namespace filesystem
{
dentry::dentry(kstd::shared_ptr<dentry> const & parent, kstd::shared_ptr<inode> const & node)
: m_parent(parent)
, m_inode(node)
{
if (!m_inode)
{
kapi::system::panic("[FILESYSTEM] dentry constructed with null inode.");
}
}
auto dentry::get_inode() const -> kstd::shared_ptr<inode> const &
{
return m_inode;
}
auto dentry::get_parent() const -> kstd::shared_ptr<dentry> const &
{
return m_parent;
}
auto dentry::set_flag(dentry_flags flag) -> void
{
m_flags |= static_cast<uint32_t>(flag);
}
auto dentry::unset_flag(dentry_flags flag) -> void
{
m_flags &= ~static_cast<uint32_t>(flag);
}
auto dentry::has_flag(dentry_flags flag) const -> bool
{
return (m_flags & static_cast<uint32_t>(flag)) != 0;
}
} // namespace filesystem
|