diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-07-30 13:59:59 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-07-30 13:59:59 +0200 |
| commit | 782b3c8563b2aacfe8f48a49fc6de7cbc26c4861 (patch) | |
| tree | 50ed26cbad7c9796f02a21d19bce1946fe0cb1d7 /kernel/kapi/devices/error.cpp | |
| parent | 2b542cb4d5f2302f41d478892694124472cde8b0 (diff) | |
| download | kernel-782b3c8563b2aacfe8f48a49fc6de7cbc26c4861.tar.xz kernel-782b3c8563b2aacfe8f48a49fc6de7cbc26c4861.zip | |
kernel: implement dev zero and null
Diffstat (limited to 'kernel/kapi/devices/error.cpp')
| -rw-r--r-- | kernel/kapi/devices/error.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
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 <kstd/system_error.hpp> #include <string_view> -#include <utility> 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<driver_match_errc>(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{}; |
