Commit 0660f5b521

Linus Groh <mail@linusgroh.de>
2025-02-09 03:30:32
std.os.uefi: Drop 'Efi' prefix from type names
The UEFI spec only does this because C doesn't have namespaces, we don't have that problem. Most type names were already omitting the prefix.
1 parent 0a7502e
Changed files (5)
lib/std/os/uefi/protocol/block_io.zig
@@ -7,7 +7,7 @@ pub const BlockIo = extern struct {
     const Self = @This();
 
     revision: u64,
-    media: *EfiBlockMedia,
+    media: *BlockMedia,
 
     _reset: *const fn (*BlockIo, extended_verification: bool) callconv(cc) Status,
     _read_blocks: *const fn (*BlockIo, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(cc) Status,
@@ -43,7 +43,7 @@ pub const BlockIo = extern struct {
         .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b },
     };
 
-    pub const EfiBlockMedia = extern struct {
+    pub const BlockMedia = extern struct {
         /// The current media ID. If the media changes, this value is changed.
         media_id: u32,
 
lib/std/os/uefi/tables/boot_services.zig
@@ -10,11 +10,11 @@ const AllocateType = uefi.tables.AllocateType;
 const MemoryType = uefi.tables.MemoryType;
 const MemoryDescriptor = uefi.tables.MemoryDescriptor;
 const TimerDelay = uefi.tables.TimerDelay;
-const EfiInterfaceType = uefi.tables.EfiInterfaceType;
+const InterfaceType = uefi.tables.InterfaceType;
 const LocateSearchType = uefi.tables.LocateSearchType;
 const OpenProtocolAttributes = uefi.tables.OpenProtocolAttributes;
 const ProtocolInformationEntry = uefi.tables.ProtocolInformationEntry;
-const EfiEventNotify = uefi.tables.EfiEventNotify;
+const EventNotify = uefi.tables.EventNotify;
 const cc = uefi.cc;
 
 /// Boot services are services provided by the system's firmware until the operating system takes
@@ -73,7 +73,7 @@ pub const BootServices = extern struct {
     /// Installs a protocol interface on a device handle. If the handle does not exist, it is created
     /// and added to the list of handles in the system. installMultipleProtocolInterfaces()
     /// performs more error checking than installProtocolInterface(), so its use is recommended over this.
-    installProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface_type: EfiInterfaceType, interface: *anyopaque) callconv(cc) Status,
+    installProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface_type: InterfaceType, interface: *anyopaque) callconv(cc) Status,
 
     /// Reinstalls a protocol interface on a device handle
     reinstallProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, old_interface: *anyopaque, new_interface: *anyopaque) callconv(cc) Status,
@@ -165,7 +165,7 @@ pub const BootServices = extern struct {
     setMem: *const fn (buffer: [*]u8, size: usize, value: u8) callconv(cc) void,
 
     /// Creates an event in a group.
-    createEventEx: *const fn (type: u32, notify_tpl: usize, notify_func: EfiEventNotify, notify_ctx: *const anyopaque, event_group: *align(8) const Guid, event: *Event) callconv(cc) Status,
+    createEventEx: *const fn (type: u32, notify_tpl: usize, notify_func: EventNotify, notify_ctx: *const anyopaque, event_group: *align(8) const Guid, event: *Event) callconv(cc) Status,
 
     /// Opens a protocol with a structure as the loaded image for a UEFI application
     pub fn openProtocolSt(self: *BootServices, comptime protocol: type, handle: Handle) !*protocol {
lib/std/os/uefi/tables/runtime_services.zig
@@ -8,7 +8,7 @@ const Status = uefi.Status;
 const MemoryDescriptor = uefi.tables.MemoryDescriptor;
 const ResetType = uefi.tables.ResetType;
 const CapsuleHeader = uefi.tables.CapsuleHeader;
-const EfiPhysicalAddress = uefi.tables.EfiPhysicalAddress;
+const PhysicalAddress = uefi.tables.PhysicalAddress;
 const cc = uefi.cc;
 
 /// Runtime services are provided by the firmware before and after exitBootServices has been called.
@@ -60,7 +60,7 @@ pub const RuntimeServices = extern struct {
     /// If the payload should persist across a system reset, the reset value returned from
     /// `queryCapsuleCapabilities` must be passed into resetSystem and will cause the capsule
     /// to be processed by the firmware as part of the reset process.
-    updateCapsule: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: EfiPhysicalAddress) callconv(cc) Status,
+    updateCapsule: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: PhysicalAddress) callconv(cc) Status,
 
     /// Returns if the capsule can be supported via `updateCapsule`
     queryCapsuleCapabilities: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, maximum_capsule_size: *usize, reset_type: ResetType) callconv(cc) Status,
lib/std/os/uefi/status.zig
@@ -142,7 +142,7 @@ pub const Status = enum(usize) {
 
     _,
 
-    pub const EfiError = error{
+    pub const Error = error{
         LoadError,
         InvalidParameter,
         Unsupported,
@@ -185,7 +185,7 @@ pub const Status = enum(usize) {
         ConnectionRefused,
     };
 
-    pub fn err(self: Status) EfiError!void {
+    pub fn err(self: Status) Error!void {
         switch (self) {
             .load_error => return error.LoadError,
             .invalid_parameter => return error.InvalidParameter,
lib/std/os/uefi/tables.zig
@@ -4,7 +4,7 @@ pub const ConfigurationTable = @import("tables/configuration_table.zig").Configu
 pub const SystemTable = @import("tables/system_table.zig").SystemTable;
 pub const TableHeader = @import("tables/table_header.zig").TableHeader;
 
-pub const EfiEventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(cc) void;
+pub const EventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(cc) void;
 
 pub const TimerDelay = enum(u32) {
     timer_cancel,
@@ -82,7 +82,7 @@ pub const ProtocolInformationEntry = extern struct {
     open_count: u32,
 };
 
-pub const EfiInterfaceType = enum(u32) {
+pub const InterfaceType = enum(u32) {
     efi_native_interface,
 };
 
@@ -92,7 +92,7 @@ pub const AllocateType = enum(u32) {
     allocate_address,
 };
 
-pub const EfiPhysicalAddress = u64;
+pub const PhysicalAddress = u64;
 
 pub const CapsuleHeader = extern struct {
     capsule_guid: Guid align(8),
@@ -104,8 +104,8 @@ pub const CapsuleHeader = extern struct {
 pub const UefiCapsuleBlockDescriptor = extern struct {
     length: u64,
     address: extern union {
-        data_block: EfiPhysicalAddress,
-        continuation_pointer: EfiPhysicalAddress,
+        data_block: PhysicalAddress,
+        continuation_pointer: PhysicalAddress,
     },
 };