aboutsummaryrefslogtreecommitdiff
path: root/kapi
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-07-24 23:49:56 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-07-24 23:49:56 +0200
commit40b8dcdbc77d5d845f9eaeb9fa4440a799727c6a (patch)
treed393bf34f912fd5ca17df457336487eeab4c0060 /kapi
parent6eda6f0649bf325a29bb891287aa95c5814be982 (diff)
downloadkernel-40b8dcdbc77d5d845f9eaeb9fa4440a799727c6a.tar.xz
kernel-40b8dcdbc77d5d845f9eaeb9fa4440a799727c6a.zip
kapi: move interface_id
Diffstat (limited to 'kapi')
-rw-r--r--kapi/kapi/capabilities/interface_id.hpp31
-rw-r--r--kapi/kapi/devices/interface_id.hpp28
-rw-r--r--kapi/kapi/devices/interface_registry.hpp2
-rw-r--r--kapi/kapi/filesystem.hpp1
-rw-r--r--kapi/kapi/filesystem/block_special_file.hpp4
-rw-r--r--kapi/kapi/filesystem/character_special_file.hpp4
-rw-r--r--kapi/kapi/filesystem/interface_id.hpp15
7 files changed, 58 insertions, 27 deletions
diff --git a/kapi/kapi/capabilities/interface_id.hpp b/kapi/kapi/capabilities/interface_id.hpp
new file mode 100644
index 00000000..5ddae585
--- /dev/null
+++ b/kapi/kapi/capabilities/interface_id.hpp
@@ -0,0 +1,31 @@
+#ifndef TEACHOS_KAPI_CAPABILITIES_INTERFACE_HPP
+#define TEACHOS_KAPI_CAPABILITIES_INTERFACE_HPP
+
+// IWYU pragma: private
+
+#include <string_view>
+
+namespace kapi::capabilities
+{
+
+ //! A tag to mark that a given devices provides a specific device capability interface.
+ struct interface_id
+ {
+ //! Construct a new interface with a given name.
+ constexpr explicit interface_id(std::string_view name)
+ : m_name{name}
+ {}
+
+ //! Get the name of this interface.
+ [[nodiscard]] constexpr auto name() const noexcept -> std::string_view const &;
+
+ //! Check if this interface is equal to another one.
+ constexpr auto operator==(interface_id const &) const noexcept -> bool = default;
+
+ private:
+ std::string_view m_name;
+ };
+
+} // namespace kapi::capabilities
+
+#endif
diff --git a/kapi/kapi/devices/interface_id.hpp b/kapi/kapi/devices/interface_id.hpp
index 6c472e59..0698d2fd 100644
--- a/kapi/kapi/devices/interface_id.hpp
+++ b/kapi/kapi/devices/interface_id.hpp
@@ -1,31 +1,15 @@
-#ifndef TEACHOS_KAPI_DEVICES_INTERFACE_HPP
-#define TEACHOS_KAPI_DEVICES_INTERFACE_HPP
+#ifndef TEACHOS_KAPI_DEVICES_INTERFACE_ID_HPP
+#define TEACHOS_KAPI_DEVICES_INTERFACE_ID_HPP
-// IWYU pragma: private, include <kapi/devices.hpp>
+// IWYU pragma: private
-#include <string_view>
+#include <kapi/capabilities/interface_id.hpp>
namespace kapi::devices
{
- //! A tag to mark that a given devices provides a specific device capability interface.
- struct interface_id
- {
- //! Construct a new interface with a given name.
- constexpr explicit interface_id(std::string_view name)
- : m_name{name}
- {}
+ using interface_id = kapi::capabilities::interface_id;
- //! Get the name of this interface.
- [[nodiscard]] constexpr auto name() const noexcept -> std::string_view const &;
-
- //! Check if this interface is equal to another one.
- constexpr auto operator==(interface_id const &) const noexcept -> bool = default;
-
- private:
- std::string_view m_name;
- };
-
-} // namespace kapi::devices
+}
#endif
diff --git a/kapi/kapi/devices/interface_registry.hpp b/kapi/kapi/devices/interface_registry.hpp
index 9df76f6d..25a8b90f 100644
--- a/kapi/kapi/devices/interface_registry.hpp
+++ b/kapi/kapi/devices/interface_registry.hpp
@@ -65,7 +65,7 @@ namespace kapi::devices
private:
kstd::weak_ptr<struct device> m_device;
kstd::string m_name;
- struct interface_id m_interface;
+ interface_id m_interface;
void * m_implementation;
};
diff --git a/kapi/kapi/filesystem.hpp b/kapi/kapi/filesystem.hpp
index 161a1019..52bc22bc 100644
--- a/kapi/kapi/filesystem.hpp
+++ b/kapi/kapi/filesystem.hpp
@@ -6,6 +6,7 @@
#include <kapi/filesystem/device_number.hpp> // IWYU pragma: export
#include <kapi/filesystem/file_status.hpp> // IWYU pragma: export
#include <kapi/filesystem/file_type.hpp> // IWYU pragma: export
+#include <kapi/filesystem/interface_id.hpp> // IWYU pragma: export
#include <kstd/result.hpp>
#include <kstd/system_error.hpp>
diff --git a/kapi/kapi/filesystem/block_special_file.hpp b/kapi/kapi/filesystem/block_special_file.hpp
index 6e125117..c7f3ac51 100644
--- a/kapi/kapi/filesystem/block_special_file.hpp
+++ b/kapi/kapi/filesystem/block_special_file.hpp
@@ -3,7 +3,7 @@
// IWYU pragma: private, include <kapi/filesystem.hpp>
-#include <kapi/devices/interface_id.hpp>
+#include <kapi/filesystem/interface_id.hpp>
#include <kstd/result.hpp>
#include <kstd/units.hpp>
@@ -15,7 +15,7 @@ namespace kapi::filesystem
struct block_special_file
{
- constexpr auto static id = kapi::devices::interface_id{"block"};
+ constexpr auto static id = interface_id{"block"};
//! Virtual destructor to enable clean deletes through base pointers.
virtual ~block_special_file() = default;
diff --git a/kapi/kapi/filesystem/character_special_file.hpp b/kapi/kapi/filesystem/character_special_file.hpp
index d7bc8c64..7ce5fdaa 100644
--- a/kapi/kapi/filesystem/character_special_file.hpp
+++ b/kapi/kapi/filesystem/character_special_file.hpp
@@ -3,7 +3,7 @@
// IWYU pragma: private, include <kapi/filesystem.hpp>
-#include <kapi/devices/interface_id.hpp>
+#include <kapi/filesystem/interface_id.hpp>
#include <kstd/result.hpp>
#include <kstd/units.hpp>
@@ -16,7 +16,7 @@ namespace kapi::filesystem
struct character_special_file
{
- constexpr auto static id = kapi::devices::interface_id{"char"};
+ constexpr auto static id = interface_id{"char"};
//! Virtual destructor to enable clean deletes through base pointers.
virtual ~character_special_file() = default;
diff --git a/kapi/kapi/filesystem/interface_id.hpp b/kapi/kapi/filesystem/interface_id.hpp
new file mode 100644
index 00000000..18e0fbc4
--- /dev/null
+++ b/kapi/kapi/filesystem/interface_id.hpp
@@ -0,0 +1,15 @@
+#ifndef TEACHOS_KAPI_FILESYSTEM_INTERFACE_ID_HPP
+#define TEACHOS_KAPI_FILESYSTEM_INTERFACE_ID_HPP
+
+// IWYU pragma: private
+
+#include <kapi/capabilities/interface_id.hpp>
+
+namespace kapi::filesystem
+{
+
+ using interface_id = kapi::capabilities::interface_id;
+
+}
+
+#endif