aboutsummaryrefslogtreecommitdiff
path: root/kernel/kapi
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-07-24 19:37:41 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-07-24 19:38:00 +0200
commit1eec1ed62987f34a8473db0ff2b89f82dd92ff4d (patch)
tree0d4b97c6161e856c97154aa9ef6237a2dc34319e /kernel/kapi
parent40c91984152a238351529d2611fe627040f6a618 (diff)
downloadkernel-1eec1ed62987f34a8473db0ff2b89f82dd92ff4d.tar.xz
kernel-1eec1ed62987f34a8473db0ff2b89f82dd92ff4d.zip
kapi: rename interface to interface_id
Diffstat (limited to 'kernel/kapi')
-rw-r--r--kernel/kapi/boot_module/bus.cpp2
-rw-r--r--kernel/kapi/devices/device.cpp8
-rw-r--r--kernel/kapi/devices/driver.cpp2
-rw-r--r--kernel/kapi/devices/driver.tests.cpp16
-rw-r--r--kernel/kapi/devices/driver_registry.tests.cpp4
-rw-r--r--kernel/kapi/devices/interface_registry.cpp10
-rw-r--r--kernel/kapi/devices/interface_registry.tests.cpp8
7 files changed, 25 insertions, 25 deletions
diff --git a/kernel/kapi/boot_module/bus.cpp b/kernel/kapi/boot_module/bus.cpp
index 95264d00..17052629 100644
--- a/kernel/kapi/boot_module/bus.cpp
+++ b/kernel/kapi/boot_module/bus.cpp
@@ -43,7 +43,7 @@ namespace kapi::boot_modules
return m_module;
}
- auto boot_module_device::query_interface(kapi::devices::interface interface) -> void *
+ auto boot_module_device::query_interface(kapi::devices::interface_id interface) -> void *
{
if (interface == boot_module_identification::id)
{
diff --git a/kernel/kapi/devices/device.cpp b/kernel/kapi/devices/device.cpp
index 3eb9aaac..01096165 100644
--- a/kernel/kapi/devices/device.cpp
+++ b/kernel/kapi/devices/device.cpp
@@ -12,17 +12,17 @@ namespace kapi::devices
: m_name(name)
{}
- auto device::as(interface interface) noexcept -> void *
+ auto device::as(interface_id interface) noexcept -> void *
{
return query_interface(interface);
}
- auto device::as(interface interface) const noexcept -> void const *
+ auto device::as(interface_id interface) const noexcept -> void const *
{
return const_cast<device *>(this)->query_interface(interface);
}
- auto device::is_a(interface interface) const noexcept -> bool
+ auto device::is_a(interface_id interface) const noexcept -> bool
{
return const_cast<device *>(this)->query_interface(interface) != nullptr;
}
@@ -67,7 +67,7 @@ namespace kapi::devices
m_driver_data = data;
}
- auto device::query_interface(interface) -> void *
+ auto device::query_interface(interface_id) -> void *
{
return nullptr;
}
diff --git a/kernel/kapi/devices/driver.cpp b/kernel/kapi/devices/driver.cpp
index c6b5e056..be2866f0 100644
--- a/kernel/kapi/devices/driver.cpp
+++ b/kernel/kapi/devices/driver.cpp
@@ -11,7 +11,7 @@ namespace kapi::devices
return std::nullopt;
}
- auto driver::query_interface(interface) -> void *
+ auto driver::query_interface(interface_id) -> void *
{
return nullptr;
}
diff --git a/kernel/kapi/devices/driver.tests.cpp b/kernel/kapi/devices/driver.tests.cpp
index 53c569dd..ea351cca 100644
--- a/kernel/kapi/devices/driver.tests.cpp
+++ b/kernel/kapi/devices/driver.tests.cpp
@@ -16,14 +16,14 @@ namespace
{
struct controller_identification
{
- constexpr auto static id = kapi::devices::interface{"stacking_test_controller_identification"};
+ constexpr auto static id = kapi::devices::interface_id{"stacking_test_controller_identification"};
virtual ~controller_identification() = default;
[[nodiscard]] virtual auto controller_name() const -> std::string_view = 0;
};
struct controller_driver_identification
{
- constexpr auto static id = kapi::devices::interface{"stacking_test_controller_driver_identification"};
+ constexpr auto static id = kapi::devices::interface_id{"stacking_test_controller_driver_identification"};
virtual ~controller_driver_identification() = default;
[[nodiscard]] virtual auto supported_names() const -> std::span<std::string_view const> = 0;
};
@@ -64,7 +64,7 @@ namespace
}
protected:
- auto query_interface(kapi::devices::interface interface) -> void * override
+ auto query_interface(kapi::devices::interface_id interface) -> void * override
{
if (interface == controller_identification::id)
{
@@ -76,14 +76,14 @@ namespace
struct leaf_identification
{
- constexpr kapi::devices::interface static id{"stacking_test_leaf_identification"};
+ constexpr kapi::devices::interface_id static 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 static id{"stacking_test_leaf_driver_identification"};
+ constexpr kapi::devices::interface_id static id{"stacking_test_leaf_driver_identification"};
virtual ~leaf_driver_identification() = default;
[[nodiscard]] virtual auto supported_names() const -> std::span<std::string_view const> = 0;
};
@@ -100,7 +100,7 @@ namespace
}
protected:
- auto query_interface(kapi::devices::interface interface) -> void * override
+ auto query_interface(kapi::devices::interface_id interface) -> void * override
{
if (interface == leaf_identification::id)
{
@@ -158,7 +158,7 @@ namespace
}
protected:
- auto query_interface(kapi::devices::interface interface) -> void * override
+ auto query_interface(kapi::devices::interface_id interface) -> void * override
{
if (interface == controller_driver_identification::id)
{
@@ -185,7 +185,7 @@ namespace
}
protected:
- auto query_interface(kapi::devices::interface interface) -> void * override
+ auto query_interface(kapi::devices::interface_id interface) -> void * override
{
if (interface == leaf_driver_identification::id)
{
diff --git a/kernel/kapi/devices/driver_registry.tests.cpp b/kernel/kapi/devices/driver_registry.tests.cpp
index bf87fb47..662b91bf 100644
--- a/kernel/kapi/devices/driver_registry.tests.cpp
+++ b/kernel/kapi/devices/driver_registry.tests.cpp
@@ -14,7 +14,7 @@ namespace
struct test_identification
{
- constexpr auto static id = kapi::devices::interface{"test_identification"};
+ constexpr auto static id = kapi::devices::interface_id{"test_identification"};
virtual ~test_identification() = default;
@@ -100,7 +100,7 @@ namespace
mutable unsigned probe_calls;
protected:
- auto query_interface(kapi::devices::interface interface) -> void * override
+ auto query_interface(kapi::devices::interface_id interface) -> void * override
{
if (interface == test_identification::id)
{
diff --git a/kernel/kapi/devices/interface_registry.cpp b/kernel/kapi/devices/interface_registry.cpp
index 58364d0a..2ec336ed 100644
--- a/kernel/kapi/devices/interface_registry.cpp
+++ b/kernel/kapi/devices/interface_registry.cpp
@@ -43,7 +43,7 @@ namespace kapi::devices
return *registry;
}
- auto interface_registry::do_publish(kstd::shared_ptr<device> device, kstd::string name, interface interface,
+ auto interface_registry::do_publish(kstd::shared_ptr<device> device, kstd::string name, interface_id interface,
void * implementation) -> kstd::result<void>
{
erase_if(m_entries, [interface](auto e) { return e.interface() == interface && !e.device(); });
@@ -67,7 +67,7 @@ namespace kapi::devices
return kstd::success();
}
- auto interface_registry::unpublish(device const & device, interface interface) -> void
+ auto interface_registry::unpublish(device const & device, interface_id interface) -> void
{
erase_if(m_entries, [&](auto e) {
auto locked_device = e.device();
@@ -75,7 +75,7 @@ namespace kapi::devices
});
}
- auto interface_registry::all(interface interface) const -> kstd::vector<entry>
+ auto interface_registry::all(interface_id interface) const -> kstd::vector<entry>
{
auto filtered = m_entries;
erase_if(filtered, [&](auto e) {
@@ -85,7 +85,7 @@ namespace kapi::devices
return filtered;
}
- auto interface_registry::resolve(interface interface, std::string_view name) -> void *
+ auto interface_registry::resolve(interface_id interface, std::string_view name) -> void *
{
auto found = std::ranges::find_if(m_entries, [&](auto e) { return e.name() == name && e.device(); });
@@ -101,7 +101,7 @@ namespace kapi::devices
return nullptr;
}
- auto interface_registry::resolve(interface interface, device & device) -> void *
+ auto interface_registry::resolve(interface_id interface, device & device) -> void *
{
if (auto by_device = device.as(interface))
{
diff --git a/kernel/kapi/devices/interface_registry.tests.cpp b/kernel/kapi/devices/interface_registry.tests.cpp
index 1982edbf..4d2e2097 100644
--- a/kernel/kapi/devices/interface_registry.tests.cpp
+++ b/kernel/kapi/devices/interface_registry.tests.cpp
@@ -8,7 +8,7 @@ namespace
{
struct probe_device
{
- constexpr auto static id = kapi::devices::interface{"probe"};
+ constexpr auto static id = kapi::devices::interface_id{"probe"};
virtual ~probe_device() = default;
@@ -17,7 +17,7 @@ namespace
struct const_device
{
- constexpr auto static id = kapi::devices::interface{"flip"};
+ constexpr auto static id = kapi::devices::interface_id{"flip"};
virtual ~const_device() = default;
@@ -29,7 +29,7 @@ namespace
struct unimplemented_device
{
- constexpr auto static id = kapi::devices::interface{"unimplemented"};
+ constexpr auto static id = kapi::devices::interface_id{"unimplemented"};
virtual ~unimplemented_device() = default;
};
@@ -47,7 +47,7 @@ namespace
return m_value;
}
- auto query_interface(kapi::devices::interface interface) -> void * override
+ auto query_interface(kapi::devices::interface_id interface) -> void * override
{
if (interface == probe_device::id)
{