diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-05-22 20:18:05 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-06-02 16:30:20 +0200 |
| commit | dc9bd3b44cbbd0235a176f05c27eb15ff31f5e09 (patch) | |
| tree | 03a3c3852489e836750a42915a7de83e68e838f7 /kernel/include | |
| parent | e92df52c599f78f36a278508a2b6be5f3a15f3db (diff) | |
| download | kernel-dc9bd3b44cbbd0235a176f05c27eb15ff31f5e09.tar.xz kernel-dc9bd3b44cbbd0235a176f05c27eb15ff31f5e09.zip | |
kernel/vfs: prepare fs type registration support
Diffstat (limited to 'kernel/include')
| -rw-r--r-- | kernel/include/kernel/filesystem/type.hpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/kernel/include/kernel/filesystem/type.hpp b/kernel/include/kernel/filesystem/type.hpp new file mode 100644 index 0000000..87e466b --- /dev/null +++ b/kernel/include/kernel/filesystem/type.hpp @@ -0,0 +1,33 @@ +#ifndef TEACH_OS_KERNEL_FILESYSTEM_TYPE_HPP +#define TEACH_OS_KERNEL_FILESYSTEM_TYPE_HPP + +#include <kernel/filesystem/filesystem.hpp> + +#include <kstd/memory> + +#include <string_view> + +namespace kernel::filesystem +{ + + //! A type descriptor for a filesystem driver. + //! + //! Each filesystem must expose an instance of a class derived from this type in order to be registered with the vfs + //! filesystem registry. + struct type + { + virtual ~type() = default; + + //! Get the name of the filesystem represented by this descriptor. + [[nodiscard]] virtual auto name() const noexcept -> std::string_view = 0; + + //! Check if filesystems of this type require a device to back them. + [[nodiscard]] virtual auto requires_device() const noexcept -> bool = 0; + + //! Create a new instance of the filesytem represented by this descriptor. + [[nodiscard]] virtual auto make_instance() const -> kstd::shared_ptr<filesystem> = 0; + }; + +} // namespace kernel::filesystem + +#endif |
