diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-07-24 19:37:41 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-07-24 19:38:00 +0200 |
| commit | 1eec1ed62987f34a8473db0ff2b89f82dd92ff4d (patch) | |
| tree | 0d4b97c6161e856c97154aa9ef6237a2dc34319e /kapi | |
| parent | 40c91984152a238351529d2611fe627040f6a618 (diff) | |
| download | kernel-1eec1ed62987f34a8473db0ff2b89f82dd92ff4d.tar.xz kernel-1eec1ed62987f34a8473db0ff2b89f82dd92ff4d.zip | |
kapi: rename interface to interface_id
Diffstat (limited to 'kapi')
| -rw-r--r-- | kapi/kapi/boot_modules/bus.hpp | 6 | ||||
| -rw-r--r-- | kapi/kapi/devices.hpp | 2 | ||||
| -rw-r--r-- | kapi/kapi/devices/block_device.hpp | 4 | ||||
| -rw-r--r-- | kapi/kapi/devices/character_device.hpp | 4 | ||||
| -rw-r--r-- | kapi/kapi/devices/device.hpp | 10 | ||||
| -rw-r--r-- | kapi/kapi/devices/driver.hpp | 4 | ||||
| -rw-r--r-- | kapi/kapi/devices/interface_id.hpp (renamed from kapi/kapi/devices/interface.hpp) | 6 | ||||
| -rw-r--r-- | kapi/kapi/devices/interface_registry.hpp | 18 |
8 files changed, 27 insertions, 27 deletions
diff --git a/kapi/kapi/boot_modules/bus.hpp b/kapi/kapi/boot_modules/bus.hpp index 2c52677e..3e982d85 100644 --- a/kapi/kapi/boot_modules/bus.hpp +++ b/kapi/kapi/boot_modules/bus.hpp @@ -18,7 +18,7 @@ namespace kapi::boot_modules struct boot_module_identification { - constexpr auto static id = devices::interface{"boot_module_identification"}; + constexpr auto static id = devices::interface_id{"boot_module_identification"}; virtual ~boot_module_identification() = default; @@ -29,7 +29,7 @@ namespace kapi::boot_modules struct boot_module_driver_identification { - constexpr auto static id = devices::interface{"boot_module_driver_identification"}; + constexpr auto static id = devices::interface_id{"boot_module_driver_identification"}; virtual ~boot_module_driver_identification() = default; @@ -45,7 +45,7 @@ namespace kapi::boot_modules [[nodiscard]] auto module() const -> struct module const & override; protected: - auto query_interface(kapi::devices::interface interface) -> void * override; + auto query_interface(kapi::devices::interface_id interface) -> void * override; private: struct module m_module; diff --git a/kapi/kapi/devices.hpp b/kapi/kapi/devices.hpp index ed082bed..c1e7e9f4 100644 --- a/kapi/kapi/devices.hpp +++ b/kapi/kapi/devices.hpp @@ -11,7 +11,7 @@ #include <kapi/devices/driver.hpp> // IWYU pragma: export #include <kapi/devices/driver_registry.hpp> // IWYU pragma: export #include <kapi/devices/error.hpp> // IWYU pragma: export -#include <kapi/devices/interface.hpp> // IWYU pragma: export +#include <kapi/devices/interface_id.hpp> // IWYU pragma: export #include <kapi/devices/interface_registry.hpp> // IWYU pragma: export #include <kstd/memory.hpp> diff --git a/kapi/kapi/devices/block_device.hpp b/kapi/kapi/devices/block_device.hpp index dfd08899..e606188e 100644 --- a/kapi/kapi/devices/block_device.hpp +++ b/kapi/kapi/devices/block_device.hpp @@ -3,7 +3,7 @@ // IWYU pragma: private, include <kapi/devices.hpp> -#include <kapi/devices/interface.hpp> +#include <kapi/devices/interface_id.hpp> #include <kstd/result.hpp> #include <kstd/units.hpp> @@ -15,7 +15,7 @@ namespace kapi::devices struct block_device { - constexpr auto static id = interface{"block"}; + constexpr auto static id = interface_id{"block"}; //! Virtual destructor to enable clean deletes through base pointers. virtual ~block_device() = default; diff --git a/kapi/kapi/devices/character_device.hpp b/kapi/kapi/devices/character_device.hpp index 7e7e8d6d..40921940 100644 --- a/kapi/kapi/devices/character_device.hpp +++ b/kapi/kapi/devices/character_device.hpp @@ -3,7 +3,7 @@ // IWYU pragma: private, include <kapi/devices.hpp> -#include <kapi/devices/interface.hpp> +#include <kapi/devices/interface_id.hpp> #include <kstd/result.hpp> #include <kstd/units.hpp> @@ -16,7 +16,7 @@ namespace kapi::devices struct character_device { - constexpr auto static id = interface{"char"}; + constexpr auto static id = interface_id{"char"}; //! Virtual destructor to enable clean deletes through base pointers. virtual ~character_device() = default; diff --git a/kapi/kapi/devices/device.hpp b/kapi/kapi/devices/device.hpp index 2c799d5d..c8b32b8b 100644 --- a/kapi/kapi/devices/device.hpp +++ b/kapi/kapi/devices/device.hpp @@ -4,7 +4,7 @@ // IWYU pragma: private, include <kapi/devices.hpp> #include <kapi/devices/driver.hpp> -#include <kapi/devices/interface.hpp> +#include <kapi/devices/interface_id.hpp> #include <kstd/memory.hpp> #include <kstd/string.hpp> @@ -40,9 +40,9 @@ namespace kapi::devices */ virtual ~device() = default; - [[nodiscard]] auto as(interface interface) noexcept -> void *; + [[nodiscard]] auto as(interface_id interface) noexcept -> void *; - [[nodiscard]] auto as(interface interface) const noexcept -> void const *; + [[nodiscard]] auto as(interface_id interface) const noexcept -> void const *; template<typename InterfaceType> [[nodiscard]] auto as() -> InterfaceType * @@ -56,7 +56,7 @@ namespace kapi::devices return static_cast<InterfaceType const *>(as(InterfaceType::id)); } - [[nodiscard]] auto is_a(interface interface) const noexcept -> bool; + [[nodiscard]] auto is_a(interface_id interface) const noexcept -> bool; template<typename InterfaceType> [[nodiscard]] auto is_a() const noexcept -> bool @@ -94,7 +94,7 @@ namespace kapi::devices auto set_driver_data(kstd::shared_ptr<void> data) -> void; protected: - auto virtual query_interface(interface interface) -> void *; + auto virtual query_interface(interface_id interface) -> void *; private: friend struct bus; diff --git a/kapi/kapi/devices/driver.hpp b/kapi/kapi/devices/driver.hpp index 837b47e4..b8646573 100644 --- a/kapi/kapi/devices/driver.hpp +++ b/kapi/kapi/devices/driver.hpp @@ -3,7 +3,7 @@ // IWYU pragma: private, include <kapi/devices.hpp> -#include <kapi/devices/interface.hpp> +#include <kapi/devices/interface_id.hpp> #include <kstd/result.hpp> @@ -81,7 +81,7 @@ namespace kapi::devices protected: //! Return a pointer to the implementation of the given interface if this driver supports it. - virtual auto query_interface(interface interface) -> void *; + virtual auto query_interface(interface_id interface) -> void *; }; //! @} diff --git a/kapi/kapi/devices/interface.hpp b/kapi/kapi/devices/interface_id.hpp index f5198691..6c472e59 100644 --- a/kapi/kapi/devices/interface.hpp +++ b/kapi/kapi/devices/interface_id.hpp @@ -9,10 +9,10 @@ namespace kapi::devices { //! A tag to mark that a given devices provides a specific device capability interface. - struct interface + struct interface_id { //! Construct a new interface with a given name. - constexpr explicit interface(std::string_view name) + constexpr explicit interface_id(std::string_view name) : m_name{name} {} @@ -20,7 +20,7 @@ namespace kapi::devices [[nodiscard]] constexpr auto name() const noexcept -> std::string_view const &; //! Check if this interface is equal to another one. - constexpr auto operator==(interface const &) const noexcept -> bool = default; + constexpr auto operator==(interface_id const &) const noexcept -> bool = default; private: std::string_view m_name; diff --git a/kapi/kapi/devices/interface_registry.hpp b/kapi/kapi/devices/interface_registry.hpp index 155a23cd..9df76f6d 100644 --- a/kapi/kapi/devices/interface_registry.hpp +++ b/kapi/kapi/devices/interface_registry.hpp @@ -4,7 +4,7 @@ // IWYU pragma: private, include <kapi/devices.hpp> #include <kapi/devices/device.hpp> -#include <kapi/devices/interface.hpp> +#include <kapi/devices/interface_id.hpp> #include <kstd/memory.hpp> #include <kstd/result.hpp> @@ -22,7 +22,7 @@ namespace kapi::devices { struct entry { - constexpr entry(kstd::shared_ptr<struct device> device, kstd::string name, interface interface, + constexpr entry(kstd::shared_ptr<struct device> device, kstd::string name, interface_id interface, void * implementation) : m_device{device} , m_name{name} @@ -40,7 +40,7 @@ namespace kapi::devices return m_name; } - [[nodiscard]] constexpr auto interface() const noexcept -> interface + [[nodiscard]] constexpr auto interface() const noexcept -> interface_id { return m_interface; } @@ -65,7 +65,7 @@ namespace kapi::devices private: kstd::weak_ptr<struct device> m_device; kstd::string m_name; - struct interface m_interface; + struct interface_id m_interface; void * m_implementation; }; @@ -107,24 +107,24 @@ namespace kapi::devices //! //! @param device The device to withdraw the interface for. //! @param interface The interface to withdraw for the given device. - auto unpublish(device const & device, interface interface) -> void; + auto unpublish(device const & device, interface_id interface) -> void; //! Get all devices implementing a given interface. //! //! @param interface The interface for which to get the implementing devices. - [[nodiscard]] auto all(interface interface) const -> kstd::vector<entry>; + [[nodiscard]] auto all(interface_id interface) const -> kstd::vector<entry>; //! Attempt to resolve a given device, by name, to a given interface implementation //! //! @param interface The interface to look for. //! @param name The stable name of the device to look for. - [[nodiscard]] auto resolve(interface interface, std::string_view name) -> void *; + [[nodiscard]] auto resolve(interface_id interface, std::string_view name) -> void *; //! Attempt to resolve a given device to a given interface implementation //! //! @param interface The interface to look for. //! @param device The device to look for. - [[nodiscard]] auto resolve(interface interface, device & device) -> void *; + [[nodiscard]] auto resolve(interface_id interface, device & device) -> void *; //! Attempt to resolve a given device, by name, to a given interface implementation //! @@ -153,7 +153,7 @@ namespace kapi::devices //! @param name A stable name for the device. //! @param interface The capability interface to be published for the device. //! @param implementation The implementation of the interface for the device. - auto do_publish(kstd::shared_ptr<device> device, kstd::string name, interface interface, void * implementation) + auto do_publish(kstd::shared_ptr<device> device, kstd::string name, interface_id interface, void * implementation) -> kstd::result<void>; kstd::vector<entry> m_entries; |
