aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kapi/kapi/filesystem.hpp8
-rw-r--r--kernel/kapi/filesystem.cpp6
2 files changed, 14 insertions, 0 deletions
diff --git a/kapi/kapi/filesystem.hpp b/kapi/kapi/filesystem.hpp
index 56bb295f..4b0971f6 100644
--- a/kapi/kapi/filesystem.hpp
+++ b/kapi/kapi/filesystem.hpp
@@ -86,6 +86,14 @@ namespace kapi::filesystem
//! @return A populated file status object on success, an error otherwise.
auto status(std::string_view path) -> kstd::result<file_status>;
+ //! Create a persistent device node at the given path
+ //!
+ //! @param path The path to the device node
+ //! @param type The type of device referenced by the new node.
+ //! @param number The number of the reference device.
+ //! @return Nothing on success, an error on failure
+ auto create_device_node(std::string_view path, file_type type, device_number number) -> kstd::result<void>;
+
//! @}
} // namespace kapi::filesystem
diff --git a/kernel/kapi/filesystem.cpp b/kernel/kapi/filesystem.cpp
index 10c9835a..b0de244e 100644
--- a/kernel/kapi/filesystem.cpp
+++ b/kernel/kapi/filesystem.cpp
@@ -10,6 +10,7 @@
#include <kstd/units.hpp>
#include <cstddef>
+#include <cstdint>
#include <expected>
#include <span>
#include <string_view>
@@ -73,4 +74,9 @@ namespace kapi::filesystem
return kernel::filesystem::vfs::get().status(path);
}
+ auto create_device_node(std::string_view path, file_type type, device_number number) -> kstd::result<void>
+ {
+ return kernel::filesystem::vfs::get().create_device_node(path, static_cast<std::uint32_t>(type), number);
+ }
+
} // namespace kapi::filesystem \ No newline at end of file