diff options
Diffstat (limited to 'kernel/include')
5 files changed, 30 insertions, 36 deletions
diff --git a/kernel/include/kernel/filesystem/devfs/filesystem.hpp b/kernel/include/kernel/filesystem/devfs/filesystem.hpp index 137eca3..3a52403 100644 --- a/kernel/include/kernel/filesystem/devfs/filesystem.hpp +++ b/kernel/include/kernel/filesystem/devfs/filesystem.hpp @@ -1,8 +1,6 @@ #ifndef TEACH_OS_KERNEL_FILESYSTEM_DEVFS_FILESYSTEM_HPP #define TEACH_OS_KERNEL_FILESYSTEM_DEVFS_FILESYSTEM_HPP -#include "kapi/devices/device.hpp" - #include "kernel/filesystem/filesystem.hpp" #include "kernel/filesystem/inode.hpp" @@ -23,10 +21,10 @@ namespace kernel::filesystem::devfs { /** @brief Initializes the devfs instance and builds the device inode table. - @param device Backing device passed by the generic filesystem interface (not required by devfs). + @param backing_inode Backing inode passed by the vfs (not required by devfs). @return The result of the mount operation. */ - auto mount(kstd::shared_ptr<kapi::devices::device> const & device) -> operation_result override; + auto mount(kstd::shared_ptr<kernel::filesystem::inode> const & backing_inode) -> operation_result override; /** @brief Looks up an inode by @p name within a @p parent directory. diff --git a/kernel/include/kernel/filesystem/ext2/filesystem.hpp b/kernel/include/kernel/filesystem/ext2/filesystem.hpp index a71385f..9112866 100644 --- a/kernel/include/kernel/filesystem/ext2/filesystem.hpp +++ b/kernel/include/kernel/filesystem/ext2/filesystem.hpp @@ -1,8 +1,6 @@ #ifndef TEACH_OS_KERNEL_FILESYSTEM_EXT2_FILESYSTEM_HPP #define TEACH_OS_KERNEL_FILESYSTEM_EXT2_FILESYSTEM_HPP -#include "kapi/devices/device.hpp" - #include "kernel/filesystem/ext2/block_group_descriptor.hpp" #include "kernel/filesystem/ext2/inode.hpp" #include "kernel/filesystem/ext2/superblock.hpp" @@ -46,11 +44,11 @@ namespace kernel::filesystem::ext2 struct filesystem : kernel::filesystem::filesystem { /** - @brief Initializes the ext2 filesystem with the given @p device. - @param device The device to mount. + @brief Initializes the ext2 filesystem with the given @p backing_inode. + @param backing_inode The backing inode to mount. @return The result of the mount operation. */ - auto mount(kstd::shared_ptr<kapi::devices::device> const & device) -> operation_result override; + auto mount(kstd::shared_ptr<kernel::filesystem::inode> const & backing_inode) -> operation_result override; /** @brief Looks up an inode by @p name within a @p parent directory. diff --git a/kernel/include/kernel/filesystem/filesystem.hpp b/kernel/include/kernel/filesystem/filesystem.hpp index ef6929a..099caee 100644 --- a/kernel/include/kernel/filesystem/filesystem.hpp +++ b/kernel/include/kernel/filesystem/filesystem.hpp @@ -1,8 +1,6 @@ #ifndef TEACH_OS_KERNEL_FILESYSTEM_FILESYSTEM_HPP #define TEACH_OS_KERNEL_FILESYSTEM_FILESYSTEM_HPP -#include "kapi/devices/device.hpp" - #include "kernel/filesystem/inode.hpp" #include <kstd/memory> @@ -32,22 +30,23 @@ namespace kernel::filesystem virtual ~filesystem() = default; /** - @brief Probes the given @p device 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 device until the mount was successful or all types have been tried. - @param device The device to probe and mount. + @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, or a null pointer if no recognizable filesystem - is found on the device. - @warning Panics if @p device is null. + is found on the backing inode. + @warning Panics if @p backing_inode is null. */ - auto static probe_and_mount(kstd::shared_ptr<kapi::devices::device> const & device) -> kstd::shared_ptr<filesystem>; + auto static probe_and_mount(kstd::shared_ptr<inode> const & backing_inode) -> kstd::shared_ptr<filesystem>; /** - @brief Initializes the filesystem with the given @p device. - @param device The device to mount. + @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 The result of the mount operation. */ - virtual auto mount(kstd::shared_ptr<kapi::devices::device> const & device) -> operation_result; + virtual auto mount(kstd::shared_ptr<inode> const & backing_inode) -> operation_result; /** @brief Looks up a child inode within the given @p parent inode with the specified @p name. This method must be @@ -65,13 +64,13 @@ namespace kernel::filesystem [[nodiscard]] auto root_inode() const -> kstd::shared_ptr<inode> const &; /** - @brief Returns a reference to the device associated with the filesystem. + @brief Returns a reference to the backing inode of the filesystem. */ - [[nodiscard]] auto device() const -> kstd::shared_ptr<kapi::devices::device> const &; + [[nodiscard]] auto backing_inode() const -> kstd::shared_ptr<inode> const &; protected: kstd::shared_ptr<inode> m_root_inode{}; - kstd::shared_ptr<kapi::devices::device> m_device{}; + kstd::shared_ptr<inode> m_backing_inode{}; kstd::vector<kstd::shared_ptr<inode>> m_inodes{}; }; diff --git a/kernel/include/kernel/filesystem/rootfs/filesystem.hpp b/kernel/include/kernel/filesystem/rootfs/filesystem.hpp index 0155c41..e14a1ee 100644 --- a/kernel/include/kernel/filesystem/rootfs/filesystem.hpp +++ b/kernel/include/kernel/filesystem/rootfs/filesystem.hpp @@ -1,8 +1,6 @@ #ifndef TEACH_OS_KERNEL_FILESYSTEM_ROOTFS_FILESYSTEM_HPP #define TEACH_OS_KERNEL_FILESYSTEM_ROOTFS_FILESYSTEM_HPP -#include "kapi/devices/device.hpp" - #include "kernel/filesystem/filesystem.hpp" #include "kernel/filesystem/inode.hpp" @@ -23,11 +21,11 @@ namespace kernel::filesystem::rootfs struct filesystem : kernel::filesystem::filesystem { /** - @brief Initializes the rootfs filesystem with the given @p device. - @param device The device to mount (not required by rootfs). + @brief Initializes the rootfs filesystem with the given @p backing_inode. + @param backing_inode The backing inode to mount (not required by rootfs). @return The result of the mount operation. */ - auto mount(kstd::shared_ptr<kapi::devices::device> const & device) -> operation_result override; + auto mount(kstd::shared_ptr<kernel::filesystem::inode> const & backing_inode) -> operation_result override; /** @brief Looks up an inode by @p name within a @p parent directory. diff --git a/kernel/include/kernel/filesystem/vfs.hpp b/kernel/include/kernel/filesystem/vfs.hpp index 4dd2a83..2a9d5f7 100644 --- a/kernel/include/kernel/filesystem/vfs.hpp +++ b/kernel/include/kernel/filesystem/vfs.hpp @@ -27,9 +27,10 @@ namespace kernel::filesystem { success = 0, invalid_path = -1, - mount_point_not_found = -2, - filesystem_null = -3, - unmount_failed = -4 + non_existent_path = -2, + mount_point_not_found = -3, + unmount_failed = -4, + invalid_filesystem = -5, }; /** @@ -58,12 +59,12 @@ namespace kernel::filesystem auto open(std::string_view path) -> kstd::shared_ptr<open_file_description>; /** - @brief Mount a @p filesystem at a specific @p path. - @param path The path where the filesystem should be mounted. - @param filesystem The filesystem to mount. + @brief Mount a @p source path to a specific @p target path. + @param source The source of the filesystem to mount. + @param target The path where the filesystem should be mounted. @return The result of the mount operation. */ - auto do_mount(std::string_view path, kstd::shared_ptr<filesystem> const & filesystem) -> operation_result; + auto do_mount(std::string_view source, std::string_view target) -> operation_result; /** @brief Unmount the filesystem mounted at the specified @p path. |
