std.os.uefi.status.high_bit
常量
std.os.uefi.status.Status
容器
字段
success = 0操作成功完成。
load_error = high_bit | 1映像加载失败。
invalid_parameter = high_bit | 2参数不正确。
unsupported = high_bit | 3不支持该操作。
bad_buffer_size = high_bit | 4缓冲区大小不符合请求要求。
buffer_too_small = high_bit | 5缓冲区不足以容纳请求的数据。发生此错误时,会在相应参数中返回所需缓冲区大小。
not_ready = high_bit | 6返回时没有待处理数据。
device_error = high_bit | 7物理设备尝试执行操作时报告错误。
write_protected = high_bit | 8无法写入该设备。
out_of_resources = high_bit | 9资源耗尽。
volume_corrupted = high_bit | 10检测到文件系统不一致,导致操作失败。
volume_full = high_bit | 11文件系统没有更多空间。
no_media = high_bit | 12设备中没有可用于执行操作的介质。
media_changed = high_bit | 13自上次访问以来,设备中的介质已更换。
not_found = high_bit | 14未找到条目。
access_denied = high_bit | 15访问被拒绝。
no_response = high_bit | 16未找到服务器,或服务器未响应请求。
no_mapping = high_bit | 17不存在到此设备的映射。
timeout = high_bit | 18等待已超时。
not_started = high_bit | 19协议尚未启动。
already_started = high_bit | 20协议已启动。
aborted = high_bit | 21操作已中止。
icmp_error = high_bit | 22网络操作期间发生 ICMP 错误。
tftp_error = high_bit | 23网络操作期间发生 TFTP 错误。
protocol_error = high_bit | 24网络操作期间发生协议错误。
incompatible_version = high_bit | 25函数遇到了与调用方请求版本不兼容的内部版本。
security_violation = high_bit | 26由于安全违规,未执行此函数。
crc_error = high_bit | 27检测到 CRC 错误。
end_of_media = high_bit | 28已到达介质起点或末尾
end_of_file = high_bit | 31已到达文件末尾。
invalid_language = high_bit | 32指定的语言无效。
compromised_data = high_bit | 33数据的安全状态未知或已受损,必须更新或替换数据,才能恢复有效的安全状态。
ip_address_conflict = high_bit | 34地址分配存在地址冲突。
http_error = high_bit | 35网络操作期间发生 HTTP 错误。
network_unreachable = high_bit | 100
host_unreachable = high_bit | 101
protocol_unreachable = high_bit | 102
port_unreachable = high_bit | 103
connection_fin = high_bit | 104
connection_reset = high_bit | 105
connection_refused = high_bit | 106
warn_unknown_glyph = 1字符串含有设备无法呈现的一个或多个字符,这些字符已被跳过。
warn_delete_failure = 2句柄已关闭,但文件未删除。
warn_write_failure = 3句柄已关闭,但文件数据未正确刷新。
warn_buffer_too_small = 4结果缓冲区过小,数据已截断至缓冲区大小。
warn_stale_data = 5数据未在本地策略对此类数据规定的时间范围内更新。
warn_file_system = 6生成的缓冲区包含符合 UEFI 规范的文件系统。
warn_reset_required = 7此操作将在系统重置过程中处理。
_
std.os.uefi.status.Status.err
函数
pub fn err(self: Status) Error!void
参数
self: Status
错误
- Aborted
- AccessDenied
- AlreadyStarted
- BadBufferSize
- BufferTooSmall
- CompromisedData
- ConnectionFin
- ConnectionRefused
- ConnectionReset
- CrcError
- DeviceError
- EndOfFile
- EndOfMedia
- HostUnreachable
- HttpError
- IcmpError
- IncompatibleVersion
- InvalidLanguage
- InvalidParameter
- IpAddressConflict
- LoadError
- MediaChanged
- NetworkUnreachable
- NoMapping
- NoMedia
- NoResponse
- NotFound
- NotReady
- NotStarted
- OutOfResources
- PortUnreachable
- ProtocolError
- ProtocolUnreachable
- SecurityViolation
- TftpError
- Timeout
- Unsupported
- VolumeCorrupted
- VolumeFull
- WriteProtected
std.os.uefi.status.Status.Error
错误集合
错误
- Aborted
- AccessDenied
- AlreadyStarted
- BadBufferSize
- BufferTooSmall
- CompromisedData
- ConnectionFin
- ConnectionRefused
- ConnectionReset
- CrcError
- DeviceError
- EndOfFile
- EndOfMedia
- HostUnreachable
- HttpError
- IcmpError
- IncompatibleVersion
- InvalidLanguage
- InvalidParameter
- IpAddressConflict
- LoadError
- MediaChanged
- NetworkUnreachable
- NoMapping
- NoMedia
- NoResponse
- NotFound
- NotReady
- NotStarted
- OutOfResources
- PortUnreachable
- ProtocolError
- ProtocolUnreachable
- SecurityViolation
- TftpError
- Timeout
- Unsupported
- VolumeCorrupted
- VolumeFull
- WriteProtected
std.os.uefi.status.Status.fromError
函数
pub fn fromError(e: Error) Status
参数
e: Error
std.os.uefi.status.testing
别名
别名目标 std.testing
源码
std/os/uefi/status.zig
const testing = @import("std").testing;
const high_bit = 1 << @typeInfo(usize).int.bits - 1;
pub const Status = enum(usize) {
/// 操作成功完成。
success = 0,
/// 映像加载失败。
load_error = high_bit | 1,
/// 参数不正确。
invalid_parameter = high_bit | 2,
/// 不支持该操作。
unsupported = high_bit | 3,
/// 缓冲区大小不符合请求要求。
bad_buffer_size = high_bit | 4,
/// 缓冲区不足以容纳请求的数据。发生此错误时,会在相应参数中返回所需缓冲区大小。
buffer_too_small = high_bit | 5,
/// 返回时没有待处理数据。
not_ready = high_bit | 6,
/// 物理设备尝试执行操作时报告错误。
device_error = high_bit | 7,
/// 无法写入该设备。
write_protected = high_bit | 8,
/// 资源耗尽。
out_of_resources = high_bit | 9,
/// 检测到文件系统不一致,导致操作失败。
volume_corrupted = high_bit | 10,
/// 文件系统没有更多空间。
volume_full = high_bit | 11,
/// 设备中没有可用于执行操作的介质。
no_media = high_bit | 12,
/// 自上次访问以来,设备中的介质已更换。
media_changed = high_bit | 13,
/// 未找到条目。
not_found = high_bit | 14,
/// 访问被拒绝。
access_denied = high_bit | 15,
/// 未找到服务器,或服务器未响应请求。
no_response = high_bit | 16,
/// 不存在到此设备的映射。
no_mapping = high_bit | 17,
/// 等待已超时。
timeout = high_bit | 18,
/// 协议尚未启动。
not_started = high_bit | 19,
/// 协议已启动。
already_started = high_bit | 20,
/// 操作已中止。
aborted = high_bit | 21,
/// 网络操作期间发生 ICMP 错误。
icmp_error = high_bit | 22,
/// 网络操作期间发生 TFTP 错误。
tftp_error = high_bit | 23,
/// 网络操作期间发生协议错误。
protocol_error = high_bit | 24,
/// 函数遇到了与调用方请求版本不兼容的内部版本。
incompatible_version = high_bit | 25,
/// 由于安全违规,未执行此函数。
security_violation = high_bit | 26,
/// 检测到 CRC 错误。
crc_error = high_bit | 27,
/// 已到达介质起点或末尾
end_of_media = high_bit | 28,
/// 已到达文件末尾。
end_of_file = high_bit | 31,
/// 指定的语言无效。
invalid_language = high_bit | 32,
/// 数据的安全状态未知或已受损,必须更新或替换数据,才能恢复有效的安全状态。
compromised_data = high_bit | 33,
/// 地址分配存在地址冲突。
ip_address_conflict = high_bit | 34,
/// 网络操作期间发生 HTTP 错误。
http_error = high_bit | 35,
network_unreachable = high_bit | 100,
host_unreachable = high_bit | 101,
protocol_unreachable = high_bit | 102,
port_unreachable = high_bit | 103,
connection_fin = high_bit | 104,
connection_reset = high_bit | 105,
connection_refused = high_bit | 106,
/// 字符串含有设备无法呈现的一个或多个字符,这些字符已被跳过。
warn_unknown_glyph = 1,
/// 句柄已关闭,但文件未删除。
warn_delete_failure = 2,
/// 句柄已关闭,但文件数据未正确刷新。
warn_write_failure = 3,
/// 结果缓冲区过小,数据已截断至缓冲区大小。
warn_buffer_too_small = 4,
/// 数据未在本地策略对此类数据规定的时间范围内更新。
warn_stale_data = 5,
/// 生成的缓冲区包含符合 UEFI 规范的文件系统。
warn_file_system = 6,
/// 此操作将在系统重置过程中处理。
warn_reset_required = 7,
_,
pub const Error = 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,
};
pub fn err(self: Status) Error!void {
switch (self) {
.load_error => return error.LoadError,
.invalid_parameter => return error.InvalidParameter,
.unsupported => return error.Unsupported,
.bad_buffer_size => return error.BadBufferSize,
.buffer_too_small => return error.BufferTooSmall,
.not_ready => return error.NotReady,
.device_error => return error.DeviceError,
.write_protected => return error.WriteProtected,
.out_of_resources => return error.OutOfResources,
.volume_corrupted => return error.VolumeCorrupted,
.volume_full => return error.VolumeFull,
.no_media => return error.NoMedia,
.media_changed => return error.MediaChanged,
.not_found => return error.NotFound,
.access_denied => return error.AccessDenied,
.no_response => return error.NoResponse,
.no_mapping => return error.NoMapping,
.timeout => return error.Timeout,
.not_started => return error.NotStarted,
.already_started => return error.AlreadyStarted,
.aborted => return error.Aborted,
.icmp_error => return error.IcmpError,
.tftp_error => return error.TftpError,
.protocol_error => return error.ProtocolError,
.incompatible_version => return error.IncompatibleVersion,
.security_violation => return error.SecurityViolation,
.crc_error => return error.CrcError,
.end_of_media => return error.EndOfMedia,
.end_of_file => return error.EndOfFile,
.invalid_language => return error.InvalidLanguage,
.compromised_data => return error.CompromisedData,
.ip_address_conflict => return error.IpAddressConflict,
.http_error => return error.HttpError,
.network_unreachable => return error.NetworkUnreachable,
.host_unreachable => return error.HostUnreachable,
.protocol_unreachable => return error.ProtocolUnreachable,
.port_unreachable => return error.PortUnreachable,
.connection_fin => return error.ConnectionFin,
.connection_reset => return error.ConnectionReset,
.connection_refused => return error.ConnectionRefused,
// 成功、warn_*、_
else => {},
}
}
pub fn fromError(e: Error) Status {
return switch (e) {
Error.Aborted => .aborted,
Error.AccessDenied => .access_denied,
Error.AlreadyStarted => .already_started,
Error.BadBufferSize => .bad_buffer_size,
Error.BufferTooSmall => .buffer_too_small,
Error.CompromisedData => .compromised_data,
Error.ConnectionFin => .connection_fin,
Error.ConnectionRefused => .connection_refused,
Error.ConnectionReset => .connection_reset,
Error.CrcError => .crc_error,
Error.DeviceError => .device_error,
Error.EndOfFile => .end_of_file,
Error.EndOfMedia => .end_of_media,
Error.HostUnreachable => .host_unreachable,
Error.HttpError => .http_error,
Error.IcmpError => .icmp_error,
Error.IncompatibleVersion => .incompatible_version,
Error.InvalidLanguage => .invalid_language,
Error.InvalidParameter => .invalid_parameter,
Error.IpAddressConflict => .ip_address_conflict,
Error.LoadError => .load_error,
Error.MediaChanged => .media_changed,
Error.NetworkUnreachable => .network_unreachable,
Error.NoMapping => .no_mapping,
Error.NoMedia => .no_media,
Error.NoResponse => .no_response,
Error.NotFound => .not_found,
Error.NotReady => .not_ready,
Error.NotStarted => .not_started,
Error.OutOfResources => .out_of_resources,
Error.PortUnreachable => .port_unreachable,
Error.ProtocolError => .protocol_error,
Error.ProtocolUnreachable => .protocol_unreachable,
Error.SecurityViolation => .security_violation,
Error.TftpError => .tftp_error,
Error.Timeout => .timeout,
Error.Unsupported => .unsupported,
Error.VolumeCorrupted => .volume_corrupted,
Error.VolumeFull => .volume_full,
Error.WriteProtected => .write_protected,
};
}
};
test "status" {
var st: Status = .device_error;
try testing.expectError(error.DeviceError, st.err());
try testing.expectEqual(st, Status.fromError(st.err()));
st = .success;
try st.err();
st = .warn_unknown_glyph;
try st.err();
}