diff options
Diffstat (limited to 'kernel/kernel/filesystem/dentry.hpp')
| -rw-r--r-- | kernel/kernel/filesystem/dentry.hpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/kernel/kernel/filesystem/dentry.hpp b/kernel/kernel/filesystem/dentry.hpp index a33ff22d..f7897764 100644 --- a/kernel/kernel/filesystem/dentry.hpp +++ b/kernel/kernel/filesystem/dentry.hpp @@ -15,6 +15,9 @@ namespace kernel::filesystem //! A directory entry in the filesystem. struct dentry { + using dentry_ptr = kstd::shared_ptr<dentry>; + using inode_ptr = kstd::shared_ptr<kernel::filesystem::inode>; + //! Flags for the dentry. enum class dentry_flags : uint32_t { @@ -28,17 +31,17 @@ namespace kernel::filesystem //! @param parent The parent directory entry, if any. //! @param inode The associated inode for this dentry. //! @param name The name of the dentry. - dentry(kstd::shared_ptr<dentry> const & parent, kstd::shared_ptr<inode> const & inode, std::string_view name); + dentry(dentry_ptr const & parent, inode_ptr const & inode, std::string_view name); //! Get this entrys associated inode. //! //! @return The inode associated with this directory entry. - [[nodiscard]] auto get_inode() const -> kstd::shared_ptr<inode> const &; + [[nodiscard]] auto inode() const -> inode_ptr const &; //! Get this entrys parent directory entry. //! //! @return The parent directory entry, or @p nullptr if this entry has no parent. - [[nodiscard]] auto parent() const -> kstd::shared_ptr<dentry>; + [[nodiscard]] auto parent() const -> dentry_ptr; //! Get this entrys name. //! @@ -56,7 +59,7 @@ namespace kernel::filesystem //! Add a child to this entry. //! //! @param child The child directory entry to add. - auto add_child(kstd::shared_ptr<dentry> const & child) -> void; + auto add_child(dentry_ptr const & child) -> void; //! Find a child entry with the given name. //! @@ -65,7 +68,7 @@ namespace kernel::filesystem //! //! @param name The name of the child directory entry to find. //! @return A pointer to the child dentry if it exists, a null pointer otherwise. - [[nodiscard]] auto find_child(std::string_view name) const -> kstd::shared_ptr<dentry>; + [[nodiscard]] auto find_child(std::string_view name) const -> dentry_ptr; //! Set a flag for this entry. //! @@ -86,8 +89,8 @@ namespace kernel::filesystem private: kstd::string m_name; kstd::weak_ptr<dentry> m_parent; - kstd::vector<kstd::shared_ptr<dentry>> m_children; - kstd::shared_ptr<inode> m_inode; + kstd::vector<dentry_ptr> m_children; + inode_ptr m_inode; uint32_t m_flags; }; } // namespace kernel::filesystem |
