aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--kernel/kapi/devices/driver.tests.cpp4
-rw-r--r--kernel/kernel/filesystem/file_type_bindings.hpp3
9 files changed, 61 insertions, 31 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
diff --git a/kernel/kapi/devices/driver.tests.cpp b/kernel/kapi/devices/driver.tests.cpp
index ea351cca..dcf26336 100644
--- a/kernel/kapi/devices/driver.tests.cpp
+++ b/kernel/kapi/devices/driver.tests.cpp
@@ -76,14 +76,14 @@ namespace
struct leaf_identification
{
- constexpr kapi::devices::interface_id static id{"stacking_test_leaf_identification"};
+ constexpr auto static id = kapi::devices::interface_id{"stacking_test_leaf_identification"};
virtual ~leaf_identification() = default;
[[nodiscard]] virtual auto leaf_name() const -> std::string_view = 0;
};
struct leaf_driver_identification
{
- constexpr kapi::devices::interface_id static id{"stacking_test_leaf_driver_identification"};
+ constexpr auto static id = kapi::devices::interface_id{"stacking_test_leaf_driver_identification"};
virtual ~leaf_driver_identification() = default;
[[nodiscard]] virtual auto supported_names() const -> std::span<std::string_view const> = 0;
};
diff --git a/kernel/kernel/filesystem/file_type_bindings.hpp b/kernel/kernel/filesystem/file_type_bindings.hpp
index 9c76b3d8..d771f49c 100644
--- a/kernel/kernel/filesystem/file_type_bindings.hpp
+++ b/kernel/kernel/filesystem/file_type_bindings.hpp
@@ -4,7 +4,6 @@
#include <kernel/filesystem/file_type.hpp>
#include <kernel/filesystem/reserved_numbers.hpp>
-#include <kapi/devices.hpp>
#include <kapi/filesystem.hpp>
#include <array>
@@ -15,7 +14,7 @@ namespace kernel::filesystem
//! A binding between an interface, a posix special file type
struct file_type_binding // NOLINT(cppcoreguidelines-pro-type-member-init)
{
- kapi::devices::interface_id interface;
+ kapi::filesystem::interface_id interface;
file_type posix_type;
};