diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-07-22 18:20:10 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-07-22 18:20:10 +0200 |
| commit | dca8a58dc140481ea1b6cf88ab60f06b88db31ba (patch) | |
| tree | dfc818c629e20c3975435a41f91ceb471918692f | |
| parent | de0e337412f4aff65195bc69e7f4e13fb2ee73c6 (diff) | |
| download | kernel-dca8a58dc140481ea1b6cf88ab60f06b88db31ba.tar.xz kernel-dca8a58dc140481ea1b6cf88ab60f06b88db31ba.zip | |
kapi: expose create_device_node
| -rw-r--r-- | kapi/kapi/filesystem.hpp | 8 | ||||
| -rw-r--r-- | kernel/kapi/filesystem.cpp | 6 |
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 |
