Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/uefi-raw/src/status.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / uefi-raw / src / status.rs` 133 lines ยท 5637 bytes Raw Blame History 1 // SPDX-License-Identifier: MIT OR Apache-2.0 2 3 use crate::newtype_enum; 4 use core::fmt; 5 use core::fmt::Debug; 6 7 newtype_enum! { 8 /// UEFI uses status codes in order to report successes, errors, and warnings. 9 /// 10 /// The spec allows implementation-specific status codes, so the `Status` 11 /// constants are not a comprehensive list of all possible values. 12 #[must_use] 13 pub enum Status: usize => { 14 /// The operation completed successfully. 15 SUCCESS = 0, 16 17 /// The string contained characters that could not be rendered and were skipped. 18 WARN_UNKNOWN_GLYPH = 1, 19 /// The handle was closed, but the file was not deleted. 20 WARN_DELETE_FAILURE = 2, 21 /// The handle was closed, but the data to the file was not flushed properly. 22 WARN_WRITE_FAILURE = 3, 23 /// The resulting buffer was too small, and the data was truncated. 24 WARN_BUFFER_TOO_SMALL = 4, 25 /// The data has not been updated within the timeframe set by local policy. 26 WARN_STALE_DATA = 5, 27 /// The resulting buffer contains UEFI-compliant file system. 28 WARN_FILE_SYSTEM = 6, 29 /// The operation will be processed across a system reset. 30 WARN_RESET_REQUIRED = 7, 31 32 /// The image failed to load. 33 LOAD_ERROR = Self::ERROR_BIT | 1, 34 /// A parameter was incorrect. 35 INVALID_PARAMETER = Self::ERROR_BIT | 2, 36 /// The operation is not supported. 37 UNSUPPORTED = Self::ERROR_BIT | 3, 38 /// The buffer was not the proper size for the request. 39 BAD_BUFFER_SIZE = Self::ERROR_BIT | 4, 40 /// The buffer is not large enough to hold the requested data. 41 /// The required buffer size is returned in the appropriate parameter. 42 BUFFER_TOO_SMALL = Self::ERROR_BIT | 5, 43 /// There is no data pending upon return. 44 NOT_READY = Self::ERROR_BIT | 6, 45 /// The physical device reported an error while attempting the operation. 46 DEVICE_ERROR = Self::ERROR_BIT | 7, 47 /// The device cannot be written to. 48 WRITE_PROTECTED = Self::ERROR_BIT | 8, 49 /// A resource has run out. 50 OUT_OF_RESOURCES = Self::ERROR_BIT | 9, 51 /// An inconsistency was detected on the file system. 52 VOLUME_CORRUPTED = Self::ERROR_BIT | 10, 53 /// There is no more space on the file system. 54 VOLUME_FULL = Self::ERROR_BIT | 11, 55 /// The device does not contain any medium to perform the operation. 56 NO_MEDIA = Self::ERROR_BIT | 12, 57 /// The medium in the device has changed since the last access. 58 MEDIA_CHANGED = Self::ERROR_BIT | 13, 59 /// The item was not found. 60 NOT_FOUND = Self::ERROR_BIT | 14, 61 /// Access was denied. 62 ACCESS_DENIED = Self::ERROR_BIT | 15, 63 /// The server was not found or did not respond to the request. 64 NO_RESPONSE = Self::ERROR_BIT | 16, 65 /// A mapping to a device does not exist. 66 NO_MAPPING = Self::ERROR_BIT | 17, 67 /// The timeout time expired. 68 TIMEOUT = Self::ERROR_BIT | 18, 69 /// The protocol has not been started. 70 NOT_STARTED = Self::ERROR_BIT | 19, 71 /// The protocol has already been started. 72 ALREADY_STARTED = Self::ERROR_BIT | 20, 73 /// The operation was aborted. 74 ABORTED = Self::ERROR_BIT | 21, 75 /// An ICMP error occurred during the network operation. 76 ICMP_ERROR = Self::ERROR_BIT | 22, 77 /// A TFTP error occurred during the network operation. 78 TFTP_ERROR = Self::ERROR_BIT | 23, 79 /// A protocol error occurred during the network operation. 80 PROTOCOL_ERROR = Self::ERROR_BIT | 24, 81 /// The function encountered an internal version that was 82 /// incompatible with a version requested by the caller. 83 INCOMPATIBLE_VERSION = Self::ERROR_BIT | 25, 84 /// The function was not performed due to a security violation. 85 SECURITY_VIOLATION = Self::ERROR_BIT | 26, 86 /// A CRC error was detected. 87 CRC_ERROR = Self::ERROR_BIT | 27, 88 /// Beginning or end of media was reached 89 END_OF_MEDIA = Self::ERROR_BIT | 28, 90 /// The end of the file was reached. 91 END_OF_FILE = Self::ERROR_BIT | 31, 92 /// The language specified was invalid. 93 INVALID_LANGUAGE = Self::ERROR_BIT | 32, 94 /// The security status of the data is unknown or compromised and 95 /// the data must be updated or replaced to restore a valid security status. 96 COMPROMISED_DATA = Self::ERROR_BIT | 33, 97 /// There is an address conflict address allocation 98 IP_ADDRESS_CONFLICT = Self::ERROR_BIT | 34, 99 /// A HTTP error occurred during the network operation. 100 HTTP_ERROR = Self::ERROR_BIT | 35, 101 }} 102 103 impl Status { 104 /// Bit indicating that a UEFI status code is an error. 105 pub const ERROR_BIT: usize = 1 << (usize::BITS - 1); 106 107 /// Returns true if status code indicates success. 108 #[inline] 109 #[must_use] 110 pub fn is_success(self) -> bool { 111 self == Self::SUCCESS 112 } 113 114 /// Returns true if status code indicates a warning. 115 #[inline] 116 #[must_use] 117 pub fn is_warning(self) -> bool { 118 (self != Self::SUCCESS) && (self.0 & Self::ERROR_BIT == 0) 119 } 120 121 /// Returns true if the status code indicates an error. 122 #[inline] 123 #[must_use] 124 pub const fn is_error(self) -> bool { 125 self.0 & Self::ERROR_BIT != 0 126 } 127 } 128 129 impl fmt::Display for Status { 130 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 131 Debug::fmt(self, f) 132 } 133 }