| author | |
| committer | |
| log | 0a7502e8869bace1c3ba4f94ac8f1e001a6edb2a |
| tree | f4f4f59a9031ae3bb0d749309477d46b1fe04825 |
| parent | 0874be1492712b1e7660d5e6dfc8473ed2216e6c |
Work towards #2101.16 files changed, 283 insertions(+), 242 deletions(-)
lib/std/debug.zig+1-1| ... | @@ -611,7 +611,7 @@ pub fn defaultPanic( | ... | @@ -611,7 +611,7 @@ pub fn defaultPanic( |
| 611 | // ExitData buffer must be allocated using boot_services.allocatePool (spec: page 220) | 611 | // ExitData buffer must be allocated using boot_services.allocatePool (spec: page 220) |
| 612 | const exit_data: []u16 = uefi.raw_pool_allocator.alloc(u16, exit_msg.len + 1) catch @trap(); | 612 | const exit_data: []u16 = uefi.raw_pool_allocator.alloc(u16, exit_msg.len + 1) catch @trap(); |
| 613 | @memcpy(exit_data, exit_msg[0..exit_data.len]); // Includes null terminator. | 613 | @memcpy(exit_data, exit_msg[0..exit_data.len]); // Includes null terminator. |
| 614 | _ = bs.exit(uefi.handle, .Aborted, exit_data.len, exit_data.ptr); | 614 | _ = bs.exit(uefi.handle, .aborted, exit_data.len, exit_data.ptr); |
| 615 | } | 615 | } |
| 616 | @trap(); | 616 | @trap(); |
| 617 | }, | 617 | }, |
lib/std/os/uefi.zig+3-3| ... | @@ -9,10 +9,10 @@ pub const hii = @import("uefi/hii.zig"); | ... | @@ -9,10 +9,10 @@ pub const hii = @import("uefi/hii.zig"); |
| 9 | pub const Status = @import("uefi/status.zig").Status; | 9 | pub const Status = @import("uefi/status.zig").Status; |
| 10 | pub const tables = @import("uefi/tables.zig"); | 10 | pub const tables = @import("uefi/tables.zig"); |
| 11 | 11 | ||
| 12 | /// The memory type to allocate when using the pool | 12 | /// The memory type to allocate when using the pool. |
| 13 | /// Defaults to .LoaderData, the default data allocation type | 13 | /// Defaults to `.loader_data`, the default data allocation type |
| 14 | /// used by UEFI applications to allocate pool memory. | 14 | /// used by UEFI applications to allocate pool memory. |
| 15 | pub var efi_pool_memory_type: tables.MemoryType = .LoaderData; | 15 | pub var efi_pool_memory_type: tables.MemoryType = .loader_data; |
| 16 | pub const pool_allocator = @import("uefi/pool_allocator.zig").pool_allocator; | 16 | pub const pool_allocator = @import("uefi/pool_allocator.zig").pool_allocator; |
| 17 | pub const raw_pool_allocator = @import("uefi/pool_allocator.zig").raw_pool_allocator; | 17 | pub const raw_pool_allocator = @import("uefi/pool_allocator.zig").raw_pool_allocator; |
| 18 | 18 |
lib/std/os/uefi/device_path.zig+86-86| ... | @@ -230,56 +230,56 @@ pub const DevicePath = union(Type) { | ... | @@ -230,56 +230,56 @@ pub const DevicePath = union(Type) { |
| 230 | }; | 230 | }; |
| 231 | 231 | ||
| 232 | pub const Messaging = union(Subtype) { | 232 | pub const Messaging = union(Subtype) { |
| 233 | Atapi: *const AtapiDevicePath, | 233 | atapi: *const AtapiDevicePath, |
| 234 | Scsi: *const ScsiDevicePath, | 234 | scsi: *const ScsiDevicePath, |
| 235 | FibreChannel: *const FibreChannelDevicePath, | 235 | fibre_channel: *const FibreChannelDevicePath, |
| 236 | FibreChannelEx: *const FibreChannelExDevicePath, | 236 | fibre_channel_ex: *const FibreChannelExDevicePath, |
| 237 | @"1394": *const F1394DevicePath, | 237 | @"1394": *const F1394DevicePath, |
| 238 | Usb: *const UsbDevicePath, | 238 | usb: *const UsbDevicePath, |
| 239 | Sata: *const SataDevicePath, | 239 | sata: *const SataDevicePath, |
| 240 | UsbWwid: *const UsbWwidDevicePath, | 240 | usb_wwid: *const UsbWwidDevicePath, |
| 241 | Lun: *const DeviceLogicalUnitDevicePath, | 241 | lun: *const DeviceLogicalUnitDevicePath, |
| 242 | UsbClass: *const UsbClassDevicePath, | 242 | usb_class: *const UsbClassDevicePath, |
| 243 | I2o: *const I2oDevicePath, | 243 | i2o: *const I2oDevicePath, |
| 244 | MacAddress: *const MacAddressDevicePath, | 244 | mac_address: *const MacAddressDevicePath, |
| 245 | Ipv4: *const Ipv4DevicePath, | 245 | ipv4: *const Ipv4DevicePath, |
| 246 | Ipv6: *const Ipv6DevicePath, | 246 | ipv6: *const Ipv6DevicePath, |
| 247 | Vlan: *const VlanDevicePath, | 247 | vlan: *const VlanDevicePath, |
| 248 | InfiniBand: *const InfiniBandDevicePath, | 248 | infini_band: *const InfiniBandDevicePath, |
| 249 | Uart: *const UartDevicePath, | 249 | uart: *const UartDevicePath, |
| 250 | Vendor: *const VendorDefinedDevicePath, | 250 | vendor: *const VendorDefinedDevicePath, |
| 251 | 251 | ||
| 252 | pub const Subtype = enum(u8) { | 252 | pub const Subtype = enum(u8) { |
| 253 | Atapi = 1, | 253 | atapi = 1, |
| 254 | Scsi = 2, | 254 | scsi = 2, |
| 255 | FibreChannel = 3, | 255 | fibre_channel = 3, |
| 256 | FibreChannelEx = 21, | 256 | fibre_channel_ex = 21, |
| 257 | @"1394" = 4, | 257 | @"1394" = 4, |
| 258 | Usb = 5, | 258 | usb = 5, |
| 259 | Sata = 18, | 259 | sata = 18, |
| 260 | UsbWwid = 16, | 260 | usb_wwid = 16, |
| 261 | Lun = 17, | 261 | lun = 17, |
| 262 | UsbClass = 15, | 262 | usb_class = 15, |
| 263 | I2o = 6, | 263 | i2o = 6, |
| 264 | MacAddress = 11, | 264 | mac_address = 11, |
| 265 | Ipv4 = 12, | 265 | ipv4 = 12, |
| 266 | Ipv6 = 13, | 266 | ipv6 = 13, |
| 267 | Vlan = 20, | 267 | vlan = 20, |
| 268 | InfiniBand = 9, | 268 | infini_band = 9, |
| 269 | Uart = 14, | 269 | uart = 14, |
| 270 | Vendor = 10, | 270 | vendor = 10, |
| 271 | _, | 271 | _, |
| 272 | }; | 272 | }; |
| 273 | 273 | ||
| 274 | pub const AtapiDevicePath = extern struct { | 274 | pub const AtapiDevicePath = extern struct { |
| 275 | const Role = enum(u8) { | 275 | pub const Role = enum(u8) { |
| 276 | Master = 0, | 276 | master = 0, |
| 277 | Slave = 1, | 277 | slave = 1, |
| 278 | }; | 278 | }; |
| 279 | 279 | ||
| 280 | const Rank = enum(u8) { | 280 | pub const Rank = enum(u8) { |
| 281 | Primary = 0, | 281 | primary = 0, |
| 282 | Secondary = 1, | 282 | secondary = 1, |
| 283 | }; | 283 | }; |
| 284 | 284 | ||
| 285 | type: DevicePath.Type, | 285 | type: DevicePath.Type, |
| ... | @@ -528,8 +528,8 @@ pub const DevicePath = union(Type) { | ... | @@ -528,8 +528,8 @@ pub const DevicePath = union(Type) { |
| 528 | 528 | ||
| 529 | pub const Ipv4DevicePath = extern struct { | 529 | pub const Ipv4DevicePath = extern struct { |
| 530 | pub const IpType = enum(u8) { | 530 | pub const IpType = enum(u8) { |
| 531 | Dhcp = 0, | 531 | dhcp = 0, |
| 532 | Static = 1, | 532 | static = 1, |
| 533 | }; | 533 | }; |
| 534 | 534 | ||
| 535 | type: DevicePath.Type, | 535 | type: DevicePath.Type, |
| ... | @@ -564,9 +564,9 @@ pub const DevicePath = union(Type) { | ... | @@ -564,9 +564,9 @@ pub const DevicePath = union(Type) { |
| 564 | 564 | ||
| 565 | pub const Ipv6DevicePath = extern struct { | 565 | pub const Ipv6DevicePath = extern struct { |
| 566 | pub const Origin = enum(u8) { | 566 | pub const Origin = enum(u8) { |
| 567 | Manual = 0, | 567 | manual = 0, |
| 568 | AssignedStateless = 1, | 568 | assigned_stateless = 1, |
| 569 | AssignedStateful = 2, | 569 | assigned_stateful = 2, |
| 570 | }; | 570 | }; |
| 571 | 571 | ||
| 572 | type: DevicePath.Type, | 572 | type: DevicePath.Type, |
| ... | @@ -619,8 +619,8 @@ pub const DevicePath = union(Type) { | ... | @@ -619,8 +619,8 @@ pub const DevicePath = union(Type) { |
| 619 | pub const InfiniBandDevicePath = extern struct { | 619 | pub const InfiniBandDevicePath = extern struct { |
| 620 | pub const ResourceFlags = packed struct(u32) { | 620 | pub const ResourceFlags = packed struct(u32) { |
| 621 | pub const ControllerType = enum(u1) { | 621 | pub const ControllerType = enum(u1) { |
| 622 | Ioc = 0, | 622 | ioc = 0, |
| 623 | Service = 1, | 623 | service = 1, |
| 624 | }; | 624 | }; |
| 625 | 625 | ||
| 626 | ioc_or_service: ControllerType, | 626 | ioc_or_service: ControllerType, |
| ... | @@ -659,20 +659,20 @@ pub const DevicePath = union(Type) { | ... | @@ -659,20 +659,20 @@ pub const DevicePath = union(Type) { |
| 659 | 659 | ||
| 660 | pub const UartDevicePath = extern struct { | 660 | pub const UartDevicePath = extern struct { |
| 661 | pub const Parity = enum(u8) { | 661 | pub const Parity = enum(u8) { |
| 662 | Default = 0, | 662 | default = 0, |
| 663 | None = 1, | 663 | none = 1, |
| 664 | Even = 2, | 664 | even = 2, |
| 665 | Odd = 3, | 665 | odd = 3, |
| 666 | Mark = 4, | 666 | mark = 4, |
| 667 | Space = 5, | 667 | space = 5, |
| 668 | _, | 668 | _, |
| 669 | }; | 669 | }; |
| 670 | 670 | ||
| 671 | pub const StopBits = enum(u8) { | 671 | pub const StopBits = enum(u8) { |
| 672 | Default = 0, | 672 | default = 0, |
| 673 | One = 1, | 673 | one = 1, |
| 674 | OneAndAHalf = 2, | 674 | one_and_a_half = 2, |
| 675 | Two = 3, | 675 | two = 3, |
| 676 | _, | 676 | _, |
| 677 | }; | 677 | }; |
| 678 | 678 | ||
| ... | @@ -719,40 +719,40 @@ pub const DevicePath = union(Type) { | ... | @@ -719,40 +719,40 @@ pub const DevicePath = union(Type) { |
| 719 | }; | 719 | }; |
| 720 | 720 | ||
| 721 | pub const Media = union(Subtype) { | 721 | pub const Media = union(Subtype) { |
| 722 | HardDrive: *const HardDriveDevicePath, | 722 | hard_drive: *const HardDriveDevicePath, |
| 723 | Cdrom: *const CdromDevicePath, | 723 | cdrom: *const CdromDevicePath, |
| 724 | Vendor: *const VendorDevicePath, | 724 | vendor: *const VendorDevicePath, |
| 725 | FilePath: *const FilePathDevicePath, | 725 | file_path: *const FilePathDevicePath, |
| 726 | MediaProtocol: *const MediaProtocolDevicePath, | 726 | media_protocol: *const MediaProtocolDevicePath, |
| 727 | PiwgFirmwareFile: *const PiwgFirmwareFileDevicePath, | 727 | piwg_firmware_file: *const PiwgFirmwareFileDevicePath, |
| 728 | PiwgFirmwareVolume: *const PiwgFirmwareVolumeDevicePath, | 728 | piwg_firmware_volume: *const PiwgFirmwareVolumeDevicePath, |
| 729 | RelativeOffsetRange: *const RelativeOffsetRangeDevicePath, | 729 | relative_offset_range: *const RelativeOffsetRangeDevicePath, |
| 730 | RamDisk: *const RamDiskDevicePath, | 730 | ram_disk: *const RamDiskDevicePath, |
| 731 | 731 | ||
| 732 | pub const Subtype = enum(u8) { | 732 | pub const Subtype = enum(u8) { |
| 733 | HardDrive = 1, | 733 | hard_drive = 1, |
| 734 | Cdrom = 2, | 734 | cdrom = 2, |
| 735 | Vendor = 3, | 735 | vendor = 3, |
| 736 | FilePath = 4, | 736 | file_path = 4, |
| 737 | MediaProtocol = 5, | 737 | media_protocol = 5, |
| 738 | PiwgFirmwareFile = 6, | 738 | piwg_firmware_file = 6, |
| 739 | PiwgFirmwareVolume = 7, | 739 | piwg_firmware_volume = 7, |
| 740 | RelativeOffsetRange = 8, | 740 | relative_offset_range = 8, |
| 741 | RamDisk = 9, | 741 | ram_disk = 9, |
| 742 | _, | 742 | _, |
| 743 | }; | 743 | }; |
| 744 | 744 | ||
| 745 | pub const HardDriveDevicePath = extern struct { | 745 | pub const HardDriveDevicePath = extern struct { |
| 746 | pub const Format = enum(u8) { | 746 | pub const Format = enum(u8) { |
| 747 | LegacyMbr = 0x01, | 747 | legacy_mbr = 0x01, |
| 748 | GuidPartitionTable = 0x02, | 748 | guid_partition_table = 0x02, |
| 749 | }; | 749 | }; |
| 750 | 750 | ||
| 751 | pub const SignatureType = enum(u8) { | 751 | pub const SignatureType = enum(u8) { |
| 752 | NoSignature = 0x00, | 752 | no_signature = 0x00, |
| 753 | /// "32-bit signature from address 0x1b8 of the type 0x01 MBR" | 753 | /// "32-bit signature from address 0x1b8 of the type 0x01 MBR" |
| 754 | MbrSignature = 0x01, | 754 | mbr_signature = 0x01, |
| 755 | GuidSignature = 0x02, | 755 | guid_signature = 0x02, |
| 756 | }; | 756 | }; |
| 757 | 757 | ||
| 758 | type: DevicePath.Type, | 758 | type: DevicePath.Type, |
| ... | @@ -935,10 +935,10 @@ pub const DevicePath = union(Type) { | ... | @@ -935,10 +935,10 @@ pub const DevicePath = union(Type) { |
| 935 | }; | 935 | }; |
| 936 | 936 | ||
| 937 | pub const BiosBootSpecification = union(Subtype) { | 937 | pub const BiosBootSpecification = union(Subtype) { |
| 938 | BBS101: *const BBS101DevicePath, | 938 | bbs101: *const BBS101DevicePath, |
| 939 | 939 | ||
| 940 | pub const Subtype = enum(u8) { | 940 | pub const Subtype = enum(u8) { |
| 941 | BBS101 = 1, | 941 | bbs101 = 1, |
| 942 | _, | 942 | _, |
| 943 | }; | 943 | }; |
| 944 | 944 | ||
| ... | @@ -967,12 +967,12 @@ pub const DevicePath = union(Type) { | ... | @@ -967,12 +967,12 @@ pub const DevicePath = union(Type) { |
| 967 | }; | 967 | }; |
| 968 | 968 | ||
| 969 | pub const End = union(Subtype) { | 969 | pub const End = union(Subtype) { |
| 970 | EndEntire: *const EndEntireDevicePath, | 970 | end_entire: *const EndEntireDevicePath, |
| 971 | EndThisInstance: *const EndThisInstanceDevicePath, | 971 | end_this_instance: *const EndThisInstanceDevicePath, |
| 972 | 972 | ||
| 973 | pub const Subtype = enum(u8) { | 973 | pub const Subtype = enum(u8) { |
| 974 | EndEntire = 0xff, | 974 | end_entire = 0xff, |
| 975 | EndThisInstance = 0x01, | 975 | end_this_instance = 0x01, |
| 976 | _, | 976 | _, |
| 977 | }; | 977 | }; |
| 978 | 978 |
lib/std/os/uefi/pool_allocator.zig+2-2| ... | @@ -29,7 +29,7 @@ const UefiPoolAllocator = struct { | ... | @@ -29,7 +29,7 @@ const UefiPoolAllocator = struct { |
| 29 | const full_len = metadata_len + len; | 29 | const full_len = metadata_len + len; |
| 30 | 30 | ||
| 31 | var unaligned_ptr: [*]align(8) u8 = undefined; | 31 | var unaligned_ptr: [*]align(8) u8 = undefined; |
| 32 | if (uefi.system_table.boot_services.?.allocatePool(uefi.efi_pool_memory_type, full_len, &unaligned_ptr) != .Success) return null; | 32 | if (uefi.system_table.boot_services.?.allocatePool(uefi.efi_pool_memory_type, full_len, &unaligned_ptr) != .success) return null; |
| 33 | 33 | ||
| 34 | const unaligned_addr = @intFromPtr(unaligned_ptr); | 34 | const unaligned_addr = @intFromPtr(unaligned_ptr); |
| 35 | const aligned_addr = mem.alignForward(usize, unaligned_addr + @sizeOf(usize), ptr_align); | 35 | const aligned_addr = mem.alignForward(usize, unaligned_addr + @sizeOf(usize), ptr_align); |
| ... | @@ -118,7 +118,7 @@ fn uefi_alloc( | ... | @@ -118,7 +118,7 @@ fn uefi_alloc( |
| 118 | std.debug.assert(@intFromEnum(alignment) <= 3); | 118 | std.debug.assert(@intFromEnum(alignment) <= 3); |
| 119 | 119 | ||
| 120 | var ptr: [*]align(8) u8 = undefined; | 120 | var ptr: [*]align(8) u8 = undefined; |
| 121 | if (uefi.system_table.boot_services.?.allocatePool(uefi.efi_pool_memory_type, len, &ptr) != .Success) return null; | 121 | if (uefi.system_table.boot_services.?.allocatePool(uefi.efi_pool_memory_type, len, &ptr) != .success) return null; |
| 122 | 122 | ||
| 123 | return ptr; | 123 | return ptr; |
| 124 | } | 124 | } |
lib/std/os/uefi/protocol/device_path.zig+7-7| ... | @@ -24,7 +24,7 @@ pub const DevicePath = extern struct { | ... | @@ -24,7 +24,7 @@ pub const DevicePath = extern struct { |
| 24 | 24 | ||
| 25 | /// Returns the next DevicePath node in the sequence, if any. | 25 | /// Returns the next DevicePath node in the sequence, if any. |
| 26 | pub fn next(self: *DevicePath) ?*DevicePath { | 26 | pub fn next(self: *DevicePath) ?*DevicePath { |
| 27 | if (self.type == .End and @as(uefi.DevicePath.End.Subtype, @enumFromInt(self.subtype)) == .EndEntire) | 27 | if (self.type == .end and @as(uefi.DevicePath.End.Subtype, @enumFromInt(self.subtype)) == .end_entire) |
| 28 | return null; | 28 | return null; |
| 29 | 29 | ||
| 30 | return @as(*DevicePath, @ptrCast(@as([*]u8, @ptrCast(self)) + self.length)); | 30 | return @as(*DevicePath, @ptrCast(@as([*]u8, @ptrCast(self)) + self.length)); |
| ... | @@ -55,8 +55,8 @@ pub const DevicePath = extern struct { | ... | @@ -55,8 +55,8 @@ pub const DevicePath = extern struct { |
| 55 | // as the end node itself is 4 bytes (type: u8 + subtype: u8 + length: u16). | 55 | // as the end node itself is 4 bytes (type: u8 + subtype: u8 + length: u16). |
| 56 | var new = @as(*uefi.DevicePath.Media.FilePathDevicePath, @ptrCast(buf.ptr + path_size - 4)); | 56 | var new = @as(*uefi.DevicePath.Media.FilePathDevicePath, @ptrCast(buf.ptr + path_size - 4)); |
| 57 | 57 | ||
| 58 | new.type = .Media; | 58 | new.type = .media; |
| 59 | new.subtype = .FilePath; | 59 | new.subtype = .file_path; |
| 60 | new.length = @sizeOf(uefi.DevicePath.Media.FilePathDevicePath) + 2 * (@as(u16, @intCast(path.len)) + 1); | 60 | new.length = @sizeOf(uefi.DevicePath.Media.FilePathDevicePath) + 2 * (@as(u16, @intCast(path.len)) + 1); |
| 61 | 61 | ||
| 62 | // The same as new.getPath(), but not const as we're filling it in. | 62 | // The same as new.getPath(), but not const as we're filling it in. |
| ... | @@ -68,8 +68,8 @@ pub const DevicePath = extern struct { | ... | @@ -68,8 +68,8 @@ pub const DevicePath = extern struct { |
| 68 | ptr[path.len] = 0; | 68 | ptr[path.len] = 0; |
| 69 | 69 | ||
| 70 | var end = @as(*uefi.DevicePath.End.EndEntireDevicePath, @ptrCast(@as(*DevicePath, @ptrCast(new)).next().?)); | 70 | var end = @as(*uefi.DevicePath.End.EndEntireDevicePath, @ptrCast(@as(*DevicePath, @ptrCast(new)).next().?)); |
| 71 | end.type = .End; | 71 | end.type = .end; |
| 72 | end.subtype = .EndEntire; | 72 | end.subtype = .end_entire; |
| 73 | end.length = @sizeOf(uefi.DevicePath.End.EndEntireDevicePath); | 73 | end.length = @sizeOf(uefi.DevicePath.End.EndEntireDevicePath); |
| 74 | 74 | ||
| 75 | return @as(*DevicePath, @ptrCast(buf.ptr)); | 75 | return @as(*DevicePath, @ptrCast(buf.ptr)); |
| ... | @@ -84,7 +84,7 @@ pub const DevicePath = extern struct { | ... | @@ -84,7 +84,7 @@ pub const DevicePath = extern struct { |
| 84 | if (self.type == enum_value) { | 84 | if (self.type == enum_value) { |
| 85 | const subtype = self.initSubtype(ufield.type); | 85 | const subtype = self.initSubtype(ufield.type); |
| 86 | if (subtype) |sb| { | 86 | if (subtype) |sb| { |
| 87 | // e.g. return .{ .Hardware = .{ .Pci = @ptrCast(...) } } | 87 | // e.g. return .{ .hardware = .{ .pci = @ptrCast(...) } } |
| 88 | return @unionInit(uefi.DevicePath, ufield.name, sb); | 88 | return @unionInit(uefi.DevicePath, ufield.name, sb); |
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| ... | @@ -102,7 +102,7 @@ pub const DevicePath = extern struct { | ... | @@ -102,7 +102,7 @@ pub const DevicePath = extern struct { |
| 102 | const tag_val: u8 = @intFromEnum(@field(TTag, subtype.name)); | 102 | const tag_val: u8 = @intFromEnum(@field(TTag, subtype.name)); |
| 103 | 103 | ||
| 104 | if (self.subtype == tag_val) { | 104 | if (self.subtype == tag_val) { |
| 105 | // e.g. expr = .{ .Pci = @ptrCast(...) } | 105 | // e.g. expr = .{ .pci = @ptrCast(...) } |
| 106 | return @unionInit(TUnion, subtype.name, @as(subtype.type, @ptrCast(self))); | 106 | return @unionInit(TUnion, subtype.name, @as(subtype.type, @ptrCast(self))); |
| 107 | } | 107 | } |
| 108 | } | 108 | } |
lib/std/os/uefi/protocol/file.zig+10-10| ... | @@ -58,7 +58,7 @@ pub const File = extern struct { | ... | @@ -58,7 +58,7 @@ pub const File = extern struct { |
| 58 | 58 | ||
| 59 | fn readFn(self: *const File, buffer: []u8) ReadError!usize { | 59 | fn readFn(self: *const File, buffer: []u8) ReadError!usize { |
| 60 | var size: usize = buffer.len; | 60 | var size: usize = buffer.len; |
| 61 | if (.Success != self.read(&size, buffer.ptr)) return ReadError.ReadError; | 61 | if (.success != self.read(&size, buffer.ptr)) return ReadError.ReadError; |
| 62 | return size; | 62 | return size; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| ... | @@ -68,7 +68,7 @@ pub const File = extern struct { | ... | @@ -68,7 +68,7 @@ pub const File = extern struct { |
| 68 | 68 | ||
| 69 | fn writeFn(self: *const File, bytes: []const u8) WriteError!usize { | 69 | fn writeFn(self: *const File, bytes: []const u8) WriteError!usize { |
| 70 | var size: usize = bytes.len; | 70 | var size: usize = bytes.len; |
| 71 | if (.Success != self.write(&size, bytes.ptr)) return WriteError.WriteError; | 71 | if (.success != self.write(&size, bytes.ptr)) return WriteError.WriteError; |
| 72 | return size; | 72 | return size; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| ... | @@ -78,7 +78,7 @@ pub const File = extern struct { | ... | @@ -78,7 +78,7 @@ pub const File = extern struct { |
| 78 | 78 | ||
| 79 | fn getPos(self: *const File) GetSeekPosError!u64 { | 79 | fn getPos(self: *const File) GetSeekPosError!u64 { |
| 80 | var pos: u64 = undefined; | 80 | var pos: u64 = undefined; |
| 81 | if (.Success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError; | 81 | if (.success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError; |
| 82 | return pos; | 82 | return pos; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| ... | @@ -86,13 +86,13 @@ pub const File = extern struct { | ... | @@ -86,13 +86,13 @@ pub const File = extern struct { |
| 86 | // preserve the old file position | 86 | // preserve the old file position |
| 87 | var pos: u64 = undefined; | 87 | var pos: u64 = undefined; |
| 88 | var end_pos: u64 = undefined; | 88 | var end_pos: u64 = undefined; |
| 89 | if (.Success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError; | 89 | if (.success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError; |
| 90 | // seek to end of file to get position = file size | 90 | // seek to end of file to get position = file size |
| 91 | if (.Success != self.setPosition(efi_file_position_end_of_file)) return GetSeekPosError.GetSeekPosError; | 91 | if (.success != self.setPosition(efi_file_position_end_of_file)) return GetSeekPosError.GetSeekPosError; |
| 92 | // get the position | 92 | // get the position |
| 93 | if (.Success != self.getPosition(&end_pos)) return GetSeekPosError.GetSeekPosError; | 93 | if (.success != self.getPosition(&end_pos)) return GetSeekPosError.GetSeekPosError; |
| 94 | // restore the old position | 94 | // restore the old position |
| 95 | if (.Success != self.setPosition(pos)) return GetSeekPosError.GetSeekPosError; | 95 | if (.success != self.setPosition(pos)) return GetSeekPosError.GetSeekPosError; |
| 96 | // return the file size = position | 96 | // return the file size = position |
| 97 | return end_pos; | 97 | return end_pos; |
| 98 | } | 98 | } |
| ... | @@ -102,13 +102,13 @@ pub const File = extern struct { | ... | @@ -102,13 +102,13 @@ pub const File = extern struct { |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | fn seekTo(self: *const File, pos: u64) SeekError!void { | 104 | fn seekTo(self: *const File, pos: u64) SeekError!void { |
| 105 | if (.Success != self.setPosition(pos)) return SeekError.SeekError; | 105 | if (.success != self.setPosition(pos)) return SeekError.SeekError; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | fn seekBy(self: *const File, offset: i64) SeekError!void { | 108 | fn seekBy(self: *const File, offset: i64) SeekError!void { |
| 109 | // save the old position and calculate the delta | 109 | // save the old position and calculate the delta |
| 110 | var pos: u64 = undefined; | 110 | var pos: u64 = undefined; |
| 111 | if (.Success != self.getPosition(&pos)) return SeekError.SeekError; | 111 | if (.success != self.getPosition(&pos)) return SeekError.SeekError; |
| 112 | const seek_back = offset < 0; | 112 | const seek_back = offset < 0; |
| 113 | const amt = @abs(offset); | 113 | const amt = @abs(offset); |
| 114 | if (seek_back) { | 114 | if (seek_back) { |
| ... | @@ -116,7 +116,7 @@ pub const File = extern struct { | ... | @@ -116,7 +116,7 @@ pub const File = extern struct { |
| 116 | } else { | 116 | } else { |
| 117 | pos -= amt; | 117 | pos -= amt; |
| 118 | } | 118 | } |
| 119 | if (.Success != self.setPosition(pos)) return SeekError.SeekError; | 119 | if (.success != self.setPosition(pos)) return SeekError.SeekError; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | pub fn getInfo(self: *const File, information_type: *align(8) const Guid, buffer_size: *usize, buffer: [*]u8) Status { | 122 | pub fn getInfo(self: *const File, information_type: *align(8) const Guid, buffer_size: *usize, buffer: [*]u8) Status { |
lib/std/os/uefi/protocol/graphics_output.zig+9-9| ... | @@ -53,10 +53,10 @@ pub const GraphicsOutput = extern struct { | ... | @@ -53,10 +53,10 @@ pub const GraphicsOutput = extern struct { |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | pub const PixelFormat = enum(u32) { | 55 | pub const PixelFormat = enum(u32) { |
| 56 | RedGreenBlueReserved8BitPerColor, | 56 | red_green_blue_reserved_8_bit_per_color, |
| 57 | BlueGreenRedReserved8BitPerColor, | 57 | blue_green_red_reserved_8_bit_per_color, |
| 58 | BitMask, | 58 | bit_mask, |
| 59 | BltOnly, | 59 | blt_only, |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | pub const PixelBitmask = extern struct { | 62 | pub const PixelBitmask = extern struct { |
| ... | @@ -74,10 +74,10 @@ pub const GraphicsOutput = extern struct { | ... | @@ -74,10 +74,10 @@ pub const GraphicsOutput = extern struct { |
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | pub const BltOperation = enum(u32) { | 76 | pub const BltOperation = enum(u32) { |
| 77 | BltVideoFill, | 77 | blt_video_fill, |
| 78 | BltVideoToBltBuffer, | 78 | blt_video_to_blt_buffer, |
| 79 | BltBufferToVideo, | 79 | blt_buffer_to_video, |
| 80 | BltVideoToVideo, | 80 | blt_video_to_video, |
| 81 | GraphicsOutputBltOperationMax, | 81 | graphics_output_blt_operation_max, |
| 82 | }; | 82 | }; |
| 83 | }; | 83 | }; |
lib/std/os/uefi/protocol/hii_popup.zig+11-11| ... | @@ -25,22 +25,22 @@ pub const HiiPopup = extern struct { | ... | @@ -25,22 +25,22 @@ pub const HiiPopup = extern struct { |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | pub const PopupStyle = enum(u32) { | 27 | pub const PopupStyle = enum(u32) { |
| 28 | Info, | 28 | info, |
| 29 | Warning, | 29 | warning, |
| 30 | Error, | 30 | @"error", |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | pub const PopupType = enum(u32) { | 33 | pub const PopupType = enum(u32) { |
| 34 | Ok, | 34 | ok, |
| 35 | Cancel, | 35 | cancel, |
| 36 | YesNo, | 36 | yes_no, |
| 37 | YesNoCancel, | 37 | yes_no_cancel, |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | pub const PopupSelection = enum(u32) { | 40 | pub const PopupSelection = enum(u32) { |
| 41 | Ok, | 41 | ok, |
| 42 | Cancel, | 42 | cancel, |
| 43 | Yes, | 43 | yes, |
| 44 | No, | 44 | no, |
| 45 | }; | 45 | }; |
| 46 | }; | 46 | }; |
lib/std/os/uefi/protocol/ip6.zig+5-5| ... | @@ -120,11 +120,11 @@ pub const Ip6 = extern struct { | ... | @@ -120,11 +120,11 @@ pub const Ip6 = extern struct { |
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | pub const NeighborState = enum(u32) { | 122 | pub const NeighborState = enum(u32) { |
| 123 | Incomplete, | 123 | incomplete, |
| 124 | Reachable, | 124 | reachable, |
| 125 | Stale, | 125 | stale, |
| 126 | Delay, | 126 | delay, |
| 127 | Probe, | 127 | probe, |
| 128 | }; | 128 | }; |
| 129 | 129 | ||
| 130 | pub const NeighborCache = extern struct { | 130 | pub const NeighborCache = extern struct { |
lib/std/os/uefi/protocol/ip6_config.zig+7-7| ... | @@ -37,12 +37,12 @@ pub const Ip6Config = extern struct { | ... | @@ -37,12 +37,12 @@ pub const Ip6Config = extern struct { |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | pub const DataType = enum(u32) { | 39 | pub const DataType = enum(u32) { |
| 40 | InterfaceInfo, | 40 | interface_info, |
| 41 | AltInterfaceId, | 41 | alt_interface_id, |
| 42 | Policy, | 42 | policy, |
| 43 | DupAddrDetectTransmits, | 43 | dup_addr_detect_transmits, |
| 44 | ManualAddress, | 44 | manual_address, |
| 45 | Gateway, | 45 | gateway, |
| 46 | DnsServer, | 46 | dns_server, |
| 47 | }; | 47 | }; |
| 48 | }; | 48 | }; |
lib/std/os/uefi/protocol/serial_io.zig+10-10| ... | @@ -55,19 +55,19 @@ pub const SerialIo = extern struct { | ... | @@ -55,19 +55,19 @@ pub const SerialIo = extern struct { |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | pub const ParityType = enum(u32) { | 57 | pub const ParityType = enum(u32) { |
| 58 | DefaultParity, | 58 | default_parity, |
| 59 | NoParity, | 59 | no_parity, |
| 60 | EvenParity, | 60 | even_parity, |
| 61 | OddParity, | 61 | odd_parity, |
| 62 | MarkParity, | 62 | mark_parity, |
| 63 | SpaceParity, | 63 | space_parity, |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | pub const StopBitsType = enum(u32) { | 66 | pub const StopBitsType = enum(u32) { |
| 67 | DefaultStopBits, | 67 | default_stop_bits, |
| 68 | OneStopBit, | 68 | one_stop_bit, |
| 69 | OneFiveStopBits, | 69 | one_five_stop_bits, |
| 70 | TwoStopBits, | 70 | two_stop_bits, |
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | pub const Mode = extern struct { | 73 | pub const Mode = extern struct { |
lib/std/os/uefi/protocol/simple_network.zig+3-3| ... | @@ -131,9 +131,9 @@ pub const SimpleNetwork = extern struct { | ... | @@ -131,9 +131,9 @@ pub const SimpleNetwork = extern struct { |
| 131 | }; | 131 | }; |
| 132 | 132 | ||
| 133 | pub const State = enum(u32) { | 133 | pub const State = enum(u32) { |
| 134 | Stopped, | 134 | stopped, |
| 135 | Started, | 135 | started, |
| 136 | Initialized, | 136 | initialized, |
| 137 | }; | 137 | }; |
| 138 | 138 | ||
| 139 | pub const Statistics = extern struct { | 139 | pub const Statistics = extern struct { |
lib/std/os/uefi/status.zig+96-55| ... | @@ -4,141 +4,141 @@ const high_bit = 1 << @typeInfo(usize).int.bits - 1; | ... | @@ -4,141 +4,141 @@ const high_bit = 1 << @typeInfo(usize).int.bits - 1; |
| 4 | 4 | ||
| 5 | pub const Status = enum(usize) { | 5 | pub const Status = enum(usize) { |
| 6 | /// The operation completed successfully. | 6 | /// The operation completed successfully. |
| 7 | Success = 0, | 7 | success = 0, |
| 8 | 8 | ||
| 9 | /// The image failed to load. | 9 | /// The image failed to load. |
| 10 | LoadError = high_bit | 1, | 10 | load_error = high_bit | 1, |
| 11 | 11 | ||
| 12 | /// A parameter was incorrect. | 12 | /// A parameter was incorrect. |
| 13 | InvalidParameter = high_bit | 2, | 13 | invalid_parameter = high_bit | 2, |
| 14 | 14 | ||
| 15 | /// The operation is not supported. | 15 | /// The operation is not supported. |
| 16 | Unsupported = high_bit | 3, | 16 | unsupported = high_bit | 3, |
| 17 | 17 | ||
| 18 | /// The buffer was not the proper size for the request. | 18 | /// The buffer was not the proper size for the request. |
| 19 | BadBufferSize = high_bit | 4, | 19 | bad_buffer_size = high_bit | 4, |
| 20 | 20 | ||
| 21 | /// 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. | 21 | /// 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. |
| 22 | BufferTooSmall = high_bit | 5, | 22 | buffer_too_small = high_bit | 5, |
| 23 | 23 | ||
| 24 | /// There is no data pending upon return. | 24 | /// There is no data pending upon return. |
| 25 | NotReady = high_bit | 6, | 25 | not_ready = high_bit | 6, |
| 26 | 26 | ||
| 27 | /// The physical device reported an error while attempting the operation. | 27 | /// The physical device reported an error while attempting the operation. |
| 28 | DeviceError = high_bit | 7, | 28 | device_error = high_bit | 7, |
| 29 | 29 | ||
| 30 | /// The device cannot be written to. | 30 | /// The device cannot be written to. |
| 31 | WriteProtected = high_bit | 8, | 31 | write_protected = high_bit | 8, |
| 32 | 32 | ||
| 33 | /// A resource has run out. | 33 | /// A resource has run out. |
| 34 | OutOfResources = high_bit | 9, | 34 | out_of_resources = high_bit | 9, |
| 35 | 35 | ||
| 36 | /// An inconstancy was detected on the file system causing the operating to fail. | 36 | /// An inconstancy was detected on the file system causing the operating to fail. |
| 37 | VolumeCorrupted = high_bit | 10, | 37 | volume_corrupted = high_bit | 10, |
| 38 | 38 | ||
| 39 | /// There is no more space on the file system. | 39 | /// There is no more space on the file system. |
| 40 | VolumeFull = high_bit | 11, | 40 | volume_full = high_bit | 11, |
| 41 | 41 | ||
| 42 | /// The device does not contain any medium to perform the operation. | 42 | /// The device does not contain any medium to perform the operation. |
| 43 | NoMedia = high_bit | 12, | 43 | no_media = high_bit | 12, |
| 44 | 44 | ||
| 45 | /// The medium in the device has changed since the last access. | 45 | /// The medium in the device has changed since the last access. |
| 46 | MediaChanged = high_bit | 13, | 46 | media_changed = high_bit | 13, |
| 47 | 47 | ||
| 48 | /// The item was not found. | 48 | /// The item was not found. |
| 49 | NotFound = high_bit | 14, | 49 | not_found = high_bit | 14, |
| 50 | 50 | ||
| 51 | /// Access was denied. | 51 | /// Access was denied. |
| 52 | AccessDenied = high_bit | 15, | 52 | access_denied = high_bit | 15, |
| 53 | 53 | ||
| 54 | /// The server was not found or did not respond to the request. | 54 | /// The server was not found or did not respond to the request. |
| 55 | NoResponse = high_bit | 16, | 55 | no_response = high_bit | 16, |
| 56 | 56 | ||
| 57 | /// A mapping to a device does not exist. | 57 | /// A mapping to a device does not exist. |
| 58 | NoMapping = high_bit | 17, | 58 | no_mapping = high_bit | 17, |
| 59 | 59 | ||
| 60 | /// The timeout time expired. | 60 | /// The timeout time expired. |
| 61 | Timeout = high_bit | 18, | 61 | timeout = high_bit | 18, |
| 62 | 62 | ||
| 63 | /// The protocol has not been started. | 63 | /// The protocol has not been started. |
| 64 | NotStarted = high_bit | 19, | 64 | not_started = high_bit | 19, |
| 65 | 65 | ||
| 66 | /// The protocol has already been started. | 66 | /// The protocol has already been started. |
| 67 | AlreadyStarted = high_bit | 20, | 67 | already_started = high_bit | 20, |
| 68 | 68 | ||
| 69 | /// The operation was aborted. | 69 | /// The operation was aborted. |
| 70 | Aborted = high_bit | 21, | 70 | aborted = high_bit | 21, |
| 71 | 71 | ||
| 72 | /// An ICMP error occurred during the network operation. | 72 | /// An ICMP error occurred during the network operation. |
| 73 | IcmpError = high_bit | 22, | 73 | icmp_error = high_bit | 22, |
| 74 | 74 | ||
| 75 | /// A TFTP error occurred during the network operation. | 75 | /// A TFTP error occurred during the network operation. |
| 76 | TftpError = high_bit | 23, | 76 | tftp_error = high_bit | 23, |
| 77 | 77 | ||
| 78 | /// A protocol error occurred during the network operation. | 78 | /// A protocol error occurred during the network operation. |
| 79 | ProtocolError = high_bit | 24, | 79 | protocol_error = high_bit | 24, |
| 80 | 80 | ||
| 81 | /// The function encountered an internal version that was incompatible with a version requested by the caller. | 81 | /// The function encountered an internal version that was incompatible with a version requested by the caller. |
| 82 | IncompatibleVersion = high_bit | 25, | 82 | incompatible_version = high_bit | 25, |
| 83 | 83 | ||
| 84 | /// The function was not performed due to a security violation. | 84 | /// The function was not performed due to a security violation. |
| 85 | SecurityViolation = high_bit | 26, | 85 | security_violation = high_bit | 26, |
| 86 | 86 | ||
| 87 | /// A CRC error was detected. | 87 | /// A CRC error was detected. |
| 88 | CrcError = high_bit | 27, | 88 | crc_error = high_bit | 27, |
| 89 | 89 | ||
| 90 | /// Beginning or end of media was reached | 90 | /// Beginning or end of media was reached |
| 91 | EndOfMedia = high_bit | 28, | 91 | end_of_media = high_bit | 28, |
| 92 | 92 | ||
| 93 | /// The end of the file was reached. | 93 | /// The end of the file was reached. |
| 94 | EndOfFile = high_bit | 31, | 94 | end_of_file = high_bit | 31, |
| 95 | 95 | ||
| 96 | /// The language specified was invalid. | 96 | /// The language specified was invalid. |
| 97 | InvalidLanguage = high_bit | 32, | 97 | invalid_language = high_bit | 32, |
| 98 | 98 | ||
| 99 | /// The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status. | 99 | /// The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status. |
| 100 | CompromisedData = high_bit | 33, | 100 | compromised_data = high_bit | 33, |
| 101 | 101 | ||
| 102 | /// There is an address conflict address allocation | 102 | /// There is an address conflict address allocation |
| 103 | IpAddressConflict = high_bit | 34, | 103 | ip_address_conflict = high_bit | 34, |
| 104 | 104 | ||
| 105 | /// A HTTP error occurred during the network operation. | 105 | /// A HTTP error occurred during the network operation. |
| 106 | HttpError = high_bit | 35, | 106 | http_error = high_bit | 35, |
| 107 | 107 | ||
| 108 | NetworkUnreachable = high_bit | 100, | 108 | network_unreachable = high_bit | 100, |
| 109 | 109 | ||
| 110 | HostUnreachable = high_bit | 101, | 110 | host_unreachable = high_bit | 101, |
| 111 | 111 | ||
| 112 | ProtocolUnreachable = high_bit | 102, | 112 | protocol_unreachable = high_bit | 102, |
| 113 | 113 | ||
| 114 | PortUnreachable = high_bit | 103, | 114 | port_unreachable = high_bit | 103, |
| 115 | 115 | ||
| 116 | ConnectionFin = high_bit | 104, | 116 | connection_fin = high_bit | 104, |
| 117 | 117 | ||
| 118 | ConnectionReset = high_bit | 105, | 118 | connection_reset = high_bit | 105, |
| 119 | 119 | ||
| 120 | ConnectionRefused = high_bit | 106, | 120 | connection_refused = high_bit | 106, |
| 121 | 121 | ||
| 122 | /// The string contained one or more characters that the device could not render and were skipped. | 122 | /// The string contained one or more characters that the device could not render and were skipped. |
| 123 | WarnUnknownGlyph = 1, | 123 | warn_unknown_glyph = 1, |
| 124 | 124 | ||
| 125 | /// The handle was closed, but the file was not deleted. | 125 | /// The handle was closed, but the file was not deleted. |
| 126 | WarnDeleteFailure = 2, | 126 | warn_delete_failure = 2, |
| 127 | 127 | ||
| 128 | /// The handle was closed, but the data to the file was not flushed properly. | 128 | /// The handle was closed, but the data to the file was not flushed properly. |
| 129 | WarnWriteFailure = 3, | 129 | warn_write_failure = 3, |
| 130 | 130 | ||
| 131 | /// The resulting buffer was too small, and the data was truncated to the buffer size. | 131 | /// The resulting buffer was too small, and the data was truncated to the buffer size. |
| 132 | WarnBufferTooSmall = 4, | 132 | warn_buffer_too_small = 4, |
| 133 | 133 | ||
| 134 | /// The data has not been updated within the timeframe set by localpolicy for this type of data. | 134 | /// The data has not been updated within the timeframe set by localpolicy for this type of data. |
| 135 | WarnStaleData = 5, | 135 | warn_stale_data = 5, |
| 136 | 136 | ||
| 137 | /// The resulting buffer contains UEFI-compliant file system. | 137 | /// The resulting buffer contains UEFI-compliant file system. |
| 138 | WarnFileSystem = 6, | 138 | warn_file_system = 6, |
| 139 | 139 | ||
| 140 | /// The operation will be processed across a system reset. | 140 | /// The operation will be processed across a system reset. |
| 141 | WarnResetRequired = 7, | 141 | warn_reset_required = 7, |
| 142 | 142 | ||
| 143 | _, | 143 | _, |
| 144 | 144 | ||
| ... | @@ -186,19 +186,60 @@ pub const Status = enum(usize) { | ... | @@ -186,19 +186,60 @@ pub const Status = enum(usize) { |
| 186 | }; | 186 | }; |
| 187 | 187 | ||
| 188 | pub fn err(self: Status) EfiError!void { | 188 | pub fn err(self: Status) EfiError!void { |
| 189 | inline for (@typeInfo(EfiError).error_set.?) |efi_err| { | 189 | switch (self) { |
| 190 | if (self == @field(Status, efi_err.name)) { | 190 | .load_error => return error.LoadError, |
| 191 | return @field(EfiError, efi_err.name); | 191 | .invalid_parameter => return error.InvalidParameter, |
| 192 | } | 192 | .unsupported => return error.Unsupported, |
| 193 | .bad_buffer_size => return error.BadBufferSize, | ||
| 194 | .buffer_too_small => return error.BufferTooSmall, | ||
| 195 | .not_ready => return error.NotReady, | ||
| 196 | .device_error => return error.DeviceError, | ||
| 197 | .write_protected => return error.WriteProtected, | ||
| 198 | .out_of_resources => return error.OutOfResources, | ||
| 199 | .volume_corrupted => return error.VolumeCorrupted, | ||
| 200 | .volume_full => return error.VolumeFull, | ||
| 201 | .no_media => return error.NoMedia, | ||
| 202 | .media_changed => return error.MediaChanged, | ||
| 203 | .not_found => return error.NotFound, | ||
| 204 | .access_denied => return error.AccessDenied, | ||
| 205 | .no_response => return error.NoResponse, | ||
| 206 | .no_mapping => return error.NoMapping, | ||
| 207 | .timeout => return error.Timeout, | ||
| 208 | .not_started => return error.NotStarted, | ||
| 209 | .already_started => return error.AlreadyStarted, | ||
| 210 | .aborted => return error.Aborted, | ||
| 211 | .icmp_error => return error.IcmpError, | ||
| 212 | .tftp_error => return error.TftpError, | ||
| 213 | .protocol_error => return error.ProtocolError, | ||
| 214 | .incompatible_version => return error.IncompatibleVersion, | ||
| 215 | .security_violation => return error.SecurityViolation, | ||
| 216 | .crc_error => return error.CrcError, | ||
| 217 | .end_of_media => return error.EndOfMedia, | ||
| 218 | .end_of_file => return error.EndOfFile, | ||
| 219 | .invalid_language => return error.InvalidLanguage, | ||
| 220 | .compromised_data => return error.CompromisedData, | ||
| 221 | .ip_address_conflict => return error.IpAddressConflict, | ||
| 222 | .http_error => return error.HttpError, | ||
| 223 | .network_unreachable => return error.NetworkUnreachable, | ||
| 224 | .host_unreachable => return error.HostUnreachable, | ||
| 225 | .protocol_unreachable => return error.ProtocolUnreachable, | ||
| 226 | .port_unreachable => return error.PortUnreachable, | ||
| 227 | .connection_fin => return error.ConnectionFin, | ||
| 228 | .connection_reset => return error.ConnectionReset, | ||
| 229 | .connection_refused => return error.ConnectionRefused, | ||
| 230 | // success, warn_*, _ | ||
| 231 | else => {}, | ||
| 193 | } | 232 | } |
| 194 | // self is .Success or Warning | ||
| 195 | } | 233 | } |
| 196 | }; | 234 | }; |
| 197 | 235 | ||
| 198 | test "status" { | 236 | test "status" { |
| 199 | var st: Status = .DeviceError; | 237 | var st: Status = .device_error; |
| 200 | try testing.expectError(error.DeviceError, st.err()); | 238 | try testing.expectError(error.DeviceError, st.err()); |
| 201 | 239 | ||
| 202 | st = .Success; | 240 | st = .success; |
| 241 | try st.err(); | ||
| 242 | |||
| 243 | st = .warn_unknown_glyph; | ||
| 203 | try st.err(); | 244 | try st.err(); |
| 204 | } | 245 | } |
lib/std/os/uefi/tables.zig+30-30| ... | @@ -7,28 +7,28 @@ pub const TableHeader = @import("tables/table_header.zig").TableHeader; | ... | @@ -7,28 +7,28 @@ pub const TableHeader = @import("tables/table_header.zig").TableHeader; |
| 7 | pub const EfiEventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(cc) void; | 7 | pub const EfiEventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(cc) void; |
| 8 | 8 | ||
| 9 | pub const TimerDelay = enum(u32) { | 9 | pub const TimerDelay = enum(u32) { |
| 10 | TimerCancel, | 10 | timer_cancel, |
| 11 | TimerPeriodic, | 11 | timer_periodic, |
| 12 | TimerRelative, | 12 | timer_relative, |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | pub const MemoryType = enum(u32) { | 15 | pub const MemoryType = enum(u32) { |
| 16 | ReservedMemoryType, | 16 | reserved_memory_type, |
| 17 | LoaderCode, | 17 | loader_code, |
| 18 | LoaderData, | 18 | loader_data, |
| 19 | BootServicesCode, | 19 | boot_services_code, |
| 20 | BootServicesData, | 20 | boot_services_data, |
| 21 | RuntimeServicesCode, | 21 | runtime_services_code, |
| 22 | RuntimeServicesData, | 22 | runtime_services_data, |
| 23 | ConventionalMemory, | 23 | conventional_memory, |
| 24 | UnusableMemory, | 24 | unusable_memory, |
| 25 | ACPIReclaimMemory, | 25 | acpi_reclaim_memory, |
| 26 | ACPIMemoryNVS, | 26 | acpi_memory_nvs, |
| 27 | MemoryMappedIO, | 27 | memory_mapped_io, |
| 28 | MemoryMappedIOPortSpace, | 28 | memory_mapped_io_port_space, |
| 29 | PalCode, | 29 | pal_code, |
| 30 | PersistentMemory, | 30 | persistent_memory, |
| 31 | MaxMemoryType, | 31 | max_memory_type, |
| 32 | _, | 32 | _, |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| ... | @@ -60,9 +60,9 @@ pub const MemoryDescriptor = extern struct { | ... | @@ -60,9 +60,9 @@ pub const MemoryDescriptor = extern struct { |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | pub const LocateSearchType = enum(u32) { | 62 | pub const LocateSearchType = enum(u32) { |
| 63 | AllHandles, | 63 | all_handles, |
| 64 | ByRegisterNotify, | 64 | by_register_notify, |
| 65 | ByProtocol, | 65 | by_protocol, |
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | pub const OpenProtocolAttributes = packed struct(u32) { | 68 | pub const OpenProtocolAttributes = packed struct(u32) { |
| ... | @@ -83,13 +83,13 @@ pub const ProtocolInformationEntry = extern struct { | ... | @@ -83,13 +83,13 @@ pub const ProtocolInformationEntry = extern struct { |
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | pub const EfiInterfaceType = enum(u32) { | 85 | pub const EfiInterfaceType = enum(u32) { |
| 86 | EfiNativeInterface, | 86 | efi_native_interface, |
| 87 | }; | 87 | }; |
| 88 | 88 | ||
| 89 | pub const AllocateType = enum(u32) { | 89 | pub const AllocateType = enum(u32) { |
| 90 | AllocateAnyPages, | 90 | allocate_any_pages, |
| 91 | AllocateMaxAddress, | 91 | allocate_max_address, |
| 92 | AllocateAddress, | 92 | allocate_address, |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | pub const EfiPhysicalAddress = u64; | 95 | pub const EfiPhysicalAddress = u64; |
| ... | @@ -110,10 +110,10 @@ pub const UefiCapsuleBlockDescriptor = extern struct { | ... | @@ -110,10 +110,10 @@ pub const UefiCapsuleBlockDescriptor = extern struct { |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | pub const ResetType = enum(u32) { | 112 | pub const ResetType = enum(u32) { |
| 113 | ResetCold, | 113 | reset_cold, |
| 114 | ResetWarm, | 114 | reset_warm, |
| 115 | ResetShutdown, | 115 | reset_shutdown, |
| 116 | ResetPlatformSpecific, | 116 | reset_platform_specific, |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | pub const global_variable align(8) = Guid{ | 119 | pub const global_variable align(8) = Guid{ |
lib/std/posix.zig+1-1| ... | @@ -775,7 +775,7 @@ pub fn exit(status: u8) noreturn { | ... | @@ -775,7 +775,7 @@ pub fn exit(status: u8) noreturn { |
| 775 | _ = bs.exit(uefi.handle, @enumFromInt(status), 0, null); | 775 | _ = bs.exit(uefi.handle, @enumFromInt(status), 0, null); |
| 776 | } | 776 | } |
| 777 | // If we can't exit, reboot the system instead. | 777 | // If we can't exit, reboot the system instead. |
| 778 | uefi.system_table.runtime_services.resetSystem(.ResetCold, @enumFromInt(status), 0, null); | 778 | uefi.system_table.runtime_services.resetSystem(.reset_cold, @enumFromInt(status), 0, null); |
| 779 | } | 779 | } |
| 780 | system.exit(status); | 780 | system.exit(status); |
| 781 | } | 781 | } |
lib/std/time.zig+2-2| ... | @@ -64,7 +64,7 @@ pub fn nanoTimestamp() i128 { | ... | @@ -64,7 +64,7 @@ pub fn nanoTimestamp() i128 { |
| 64 | .uefi => { | 64 | .uefi => { |
| 65 | var value: std.os.uefi.Time = undefined; | 65 | var value: std.os.uefi.Time = undefined; |
| 66 | const status = std.os.uefi.system_table.runtime_services.getTime(&value, null); | 66 | const status = std.os.uefi.system_table.runtime_services.getTime(&value, null); |
| 67 | assert(status == .Success); | 67 | assert(status == .success); |
| 68 | return value.toEpoch(); | 68 | return value.toEpoch(); |
| 69 | }, | 69 | }, |
| 70 | else => { | 70 | else => { |
| ... | @@ -153,7 +153,7 @@ pub const Instant = struct { | ... | @@ -153,7 +153,7 @@ pub const Instant = struct { |
| 153 | .uefi => { | 153 | .uefi => { |
| 154 | var value: std.os.uefi.Time = undefined; | 154 | var value: std.os.uefi.Time = undefined; |
| 155 | const status = std.os.uefi.system_table.runtime_services.getTime(&value, null); | 155 | const status = std.os.uefi.system_table.runtime_services.getTime(&value, null); |
| 156 | if (status != .Success) return error.Unsupported; | 156 | if (status != .success) return error.Unsupported; |
| 157 | return Instant{ .timestamp = value.toEpoch() }; | 157 | return Instant{ .timestamp = value.toEpoch() }; |
| 158 | }, | 158 | }, |
| 159 | // On darwin, use UPTIME_RAW instead of MONOTONIC as it ticks while | 159 | // On darwin, use UPTIME_RAW instead of MONOTONIC as it ticks while |