aboutsummaryrefslogtreecommitdiff
path: root/kernel/kernel/filesystem/filesystem.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/kernel/filesystem/filesystem.hpp')
-rw-r--r--kernel/kernel/filesystem/filesystem.hpp82
1 files changed, 39 insertions, 43 deletions
diff --git a/kernel/kernel/filesystem/filesystem.hpp b/kernel/kernel/filesystem/filesystem.hpp
index b5017c24..668fd06e 100644
--- a/kernel/kernel/filesystem/filesystem.hpp
+++ b/kernel/kernel/filesystem/filesystem.hpp
@@ -16,68 +16,64 @@
namespace kernel::filesystem
{
- /**
- @brief A base class for implementing filesystems in the kernel. This class provides a common interface for managing
- files and directories within the virtual filesystem.
- */
+ //! The base class for all filesystems.
+ //!
+ //! This class provides a common interface for managing files and directories within the virtual filesystem.
+ //! Filesystem implementations must derive from this class.
struct filesystem
{
- /**
- @brief Virtual destructor for the filesystem.
- */
+ //! Virtual destructor enabling polymorphic destruction.
virtual ~filesystem() = default;
- /**
- @brief Probes the given @p backing_inode to determine if it contains a recognizable filesystem, and if so, mounts it
- and returns a pointer to the mounted filesystem instance. This method iterates through known filesystem types and
- attempts to initialize it with the backing inode until the mount was successful or all types have been tried.
- @param backing_inode The inode to probe and mount.
- @return A pointer to the mounted filesystem instance if successful, an error otherwise.
- @warning Panics if @p backing_inode is null.
- */
+ //! Probes the given inode to determine if it contains a recognizable filesystem, and if so, mount it.
+ //!
+ //! @warning This function panics if @p backing_inode is null.
+ //!
+ //! @param backing_inode The inode to probe and mount.
+ //! @return A pointer to the mounted filesystem instance on success, an error otherwise.
auto static probe_and_mount(kstd::shared_ptr<inode> const & backing_inode)
-> kstd::result<kstd::shared_ptr<filesystem>>;
- /**
- @brief Initializes the filesystem with the given @p backing_inode.
- @param backing_inode The inode to use as the backing inode for the filesystem. (This is typically the inode
- representing the block device or another inode which contains the filesystem data.)
- @return Nothing on success, and error otherwise.
- */
+ //! Initializes the filesystem with the given inode.
+ //!
+ //! Typically, the backing inode is the inode representing the block device or another inode which contains the
+ //! filesystem data (e.g. a file on an already mounted filesystem).
+ //!
+ //! @param backing_inode The inode to use as the backing inode for the filesystem.
+ //! @return Nothing on success, and error otherwise.
virtual auto mount(kstd::shared_ptr<inode> const & backing_inode) -> kstd::result<void>;
- /**
- @brief Looks up a child inode within the given @p parent inode with the specified @p name. This method must be
- implemented by concrete filesystem subclasses to provide the logic for traversing the filesystem structure and
- finding the requested inode.
- @param parent The parent inode.
- @param name The name of the child inode to look up.
- @return A pointer to the requested child inode, an error otherwise.
- */
+ //! Find a child inode below the given parent inode with the specified name.
+ //!
+ //! This method must be implemented by concrete filesystem subclasses to provide the logic for traversing the
+ //! filesystem structure and finding the requested inode.
+ //!
+ //! @param parent The parent inode.
+ //! @param name The name of the child inode to look up.
+ //! @return A pointer to the requested child inode on success, an error otherwise.
[[nodiscard]] virtual auto lookup(kstd::shared_ptr<inode> const & parent, std::string_view name) const
-> kstd::result<kstd::shared_ptr<inode>> = 0;
- /**
- @brief Creates a new inode with @p name within a @p parent directory.
- @param parent The parent directory inode.
- @param name The name of the inode to create.
- @param inode_type The type of inode to be created.
- @param raw_device The device number the new inode should represent.
- @return A pointer to the created inode, or a null pointer if creation failed.
- */
+ //! Create a new inode with the given name below a given parent inode.
+ //!
+ //! @param parent The parent inode.
+ //! @param name The name of the inode to create.
+ //! @param inode_type The type of inode to be created.
+ //! @param raw_device The device number the new inode should represent, if any.
+ //! @return A pointer to the created inode on success, an error otherwise.
[[nodiscard]] virtual auto create_inode(kstd::shared_ptr<inode> const & parent, std::string_view name,
vfs_types::inode_type inode_type,
std::optional<kapi::filesystem::device_number> raw_device = std::nullopt)
-> kstd::result<kstd::shared_ptr<inode>> = 0;
- /**
- @brief Returns a reference to the root inode of the filesystem.
- */
+ //! Get the root inode of the file system.
+ //!
+ //! @return A reference to the root inode.
[[nodiscard]] auto root_inode() const -> kstd::shared_ptr<inode> const &;
- /**
- @brief Returns a reference to the backing inode of the filesystem.
- */
+ //! Get the backing inode of the file system.
+ //!
+ //! @return A reference to the backing inode.
[[nodiscard]] auto backing_inode() const -> kstd::shared_ptr<inode> const &;
protected: