From 782b3c8563b2aacfe8f48a49fc6de7cbc26c4861 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 30 Jul 2026 13:59:59 +0200 Subject: kernel: implement dev zero and null --- kernel/kapi/devices/device_registry.cpp | 10 +++++++++- kernel/kapi/devices/error.cpp | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'kernel/kapi') diff --git a/kernel/kapi/devices/device_registry.cpp b/kernel/kapi/devices/device_registry.cpp index 80ddde65..080ae39b 100644 --- a/kernel/kapi/devices/device_registry.cpp +++ b/kernel/kapi/devices/device_registry.cpp @@ -1,5 +1,6 @@ #include +#include #include #include @@ -48,7 +49,14 @@ namespace kapi::devices return false; } - kstd::println("[OS:DEV] Registering device {}", device->name()); + if (device->facet()) + { + kstd::println("[OS:DEV] Registering bus {}", device->name()); + } + else + { + kstd::println("[OS:DEV] Registering device {}", device->name()); + } auto added = false; { diff --git a/kernel/kapi/devices/error.cpp b/kernel/kapi/devices/error.cpp index 9d814fbe..40320551 100644 --- a/kernel/kapi/devices/error.cpp +++ b/kernel/kapi/devices/error.cpp @@ -3,7 +3,6 @@ #include #include -#include namespace kapi::devices { @@ -23,6 +22,10 @@ namespace kapi::devices { case driver_match_errc::no_match: return "driver does not match this device"; + case driver_match_errc::no_device_signature: + return "missing device signature"; + case driver_match_errc::invalid_device_signature: + return "device signature is invalid"; default: return "unknown driver matching error"; } @@ -30,11 +33,17 @@ namespace kapi::devices [[nodiscard]] auto default_error_condition(int value) const noexcept -> kstd::error_condition override { - if (value == std::to_underlying(driver_match_errc::no_match)) + switch (static_cast(value)) { - return make_error_condition(kstd::errc::not_supported); + case driver_match_errc::no_match: + case driver_match_errc::no_device_signature: + return make_error_condition(kstd::errc::not_supported); + break; + case driver_match_errc::invalid_device_signature: + return make_error_condition(kstd::errc::invalid_argument); + default: + return kstd::error_category::default_error_condition(value); } - return kstd::error_category::default_error_condition(value); } } constexpr driver_match_category_instance{}; -- cgit v1.2.3