|
const testing = @import("std").testing; const high_bit = 1 << @typeInfo(usize).Int.bits - 1; |
Status |
pub const Status = enum(usize) { Success = 0, LoadError = high_bit | 1, InvalidParameter = high_bit | 2, Unsupported = high_bit | 3, BadBufferSize = high_bit | 4, BufferTooSmall = high_bit | 5, NotReady = high_bit | 6, DeviceError = high_bit | 7, WriteProtected = high_bit | 8, OutOfResources = high_bit | 9, VolumeCorrupted = high_bit | 10, VolumeFull = high_bit | 11, NoMedia = high_bit | 12, MediaChanged = high_bit | 13, NotFound = high_bit | 14, AccessDenied = high_bit | 15, NoResponse = high_bit | 16, NoMapping = high_bit | 17, Timeout = high_bit | 18, NotStarted = high_bit | 19, AlreadyStarted = high_bit | 20, Aborted = high_bit | 21, IcmpError = high_bit | 22, TftpError = high_bit | 23, ProtocolError = high_bit | 24, IncompatibleVersion = high_bit | 25, SecurityViolation = high_bit | 26, CrcError = high_bit | 27, EndOfMedia = high_bit | 28, EndOfFile = high_bit | 31, InvalidLanguage = high_bit | 32, CompromisedData = high_bit | 33, IpAddressConflict = high_bit | 34, HttpError = high_bit | 35, NetworkUnreachable = high_bit | 100, HostUnreachable = high_bit | 101, ProtocolUnreachable = high_bit | 102, PortUnreachable = high_bit | 103, ConnectionFin = high_bit | 104, ConnectionReset = high_bit | 105, ConnectionRefused = high_bit | 106, WarnUnknownGlyph = 1, WarnDeleteFailure = 2, WarnWriteFailure = 3, WarnBufferTooSmall = 4, WarnStaleData = 5, WarnFileSystem = 6, WarnResetRequired = 7, _, pub const EfiError = error{ LoadError, InvalidParameter, Unsupported, BadBufferSize, BufferTooSmall, NotReady, DeviceError, WriteProtected, OutOfResources, VolumeCorrupted, VolumeFull, NoMedia, MediaChanged, NotFound, AccessDenied, NoResponse, NoMapping, Timeout, NotStarted, AlreadyStarted, Aborted, IcmpError, TftpError, ProtocolError, IncompatibleVersion, SecurityViolation, CrcError, EndOfMedia, EndOfFile, InvalidLanguage, CompromisedData, IpAddressConflict, HttpError, NetworkUnreachable, HostUnreachable, ProtocolUnreachable, PortUnreachable, ConnectionFin, ConnectionReset, ConnectionRefused, }; |
err()The operation completed successfully. The image failed to load. A parameter was incorrect. The operation is not supported. The buffer was not the proper size for the request. The buffer is not large enough to hold the requested data. The required buffer size is returned in the appropriate parameter when this error occurs. There is no data pending upon return. The physical device reported an error while attempting the operation. The device cannot be written to. A resource has run out. An inconstancy was detected on the file system causing the operating to fail. There is no more space on the file system. The device does not contain any medium to perform the operation. The medium in the device has changed since the last access. The item was not found. Access was denied. The server was not found or did not respond to the request. A mapping to a device does not exist. The timeout time expired. The protocol has not been started. The protocol has already been started. The operation was aborted. An ICMP error occurred during the network operation. A TFTP error occurred during the network operation. A protocol error occurred during the network operation. The function encountered an internal version that was incompatible with a version requested by the caller. The function was not performed due to a security violation. A CRC error was detected. Beginning or end of media was reached The end of the file was reached. The language specified was invalid. The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status. There is an address conflict address allocation A HTTP error occurred during the network operation. The string contained one or more characters that the device could not render and were skipped. The handle was closed, but the file was not deleted. The handle was closed, but the data to the file was not flushed properly. The resulting buffer was too small, and the data was truncated to the buffer size. The data has not been updated within the timeframe set by localpolicy for this type of data. The resulting buffer contains UEFI-compliant file system. The operation will be processed across a system reset. |
pub fn err(self: Status) EfiError!void { inline for (@typeInfo(EfiError).ErrorSet.?) |efi_err| { if (self == @field(Status, efi_err.name)) { return @field(EfiError, efi_err.name); } } // self is .Success or Warning } }; |
Test:status |
test "status" { var st: Status = .DeviceError; try testing.expectError(error.DeviceError, st.err()); st = .Success; try st.err(); } |
Generated by zstd-browse2 on 2023-11-04 14:12:38 -0400. |