aboutsummaryrefslogtreecommitdiff
path: root/kernel/include
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/kernel/filesystem/type.hpp33
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