summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_file.c
diff options
context:
space:
mode:
authorMichael Brown2025-03-24 15:24:47 +0100
committerMichael Brown2025-03-24 16:43:56 +0100
commit32a9408217810498deeeae3d2564ab15468c9c39 (patch)
treee39162f48abd5a12dd664af9ba057bb6131bb626 /src/interface/efi/efi_file.c
parent[efi] Eliminate uses of HandleProtocol() (diff)
downloadipxe-32a9408217810498deeeae3d2564ab15468c9c39.tar.gz
ipxe-32a9408217810498deeeae3d2564ab15468c9c39.tar.xz
ipxe-32a9408217810498deeeae3d2564ab15468c9c39.zip
[efi] Allow use of typed pointers for efi_open() et al
Provide wrapper macros to allow efi_open() and related functions to accept a pointer to any pointer type as the "interface" argument, in order to allow a substantial amount of type adjustment boilerplate to be removed. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_file.c')
-rw-r--r--src/interface/efi/efi_file.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/interface/efi/efi_file.c b/src/interface/efi/efi_file.c
index d8b9f819c..b7b97aee7 100644
--- a/src/interface/efi/efi_file.c
+++ b/src/interface/efi/efi_file.c
@@ -982,9 +982,9 @@ static EFI_DISK_IO_PROTOCOL efi_disk_io_protocol = {
*/
static int efi_file_path_claim ( struct efi_file_path *file ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ EFI_DEVICE_PATH_PROTOCOL *old;
EFI_DEVICE_PATH_PROTOCOL *end;
EFI_HANDLE handle;
- VOID *old;
EFI_STATUS efirc;
int rc;
@@ -1116,10 +1116,7 @@ static void efi_file_path_uninstall ( struct efi_file_path *file ) {
*/
int efi_file_install ( EFI_HANDLE handle ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
- union {
- EFI_DISK_IO_PROTOCOL *diskio;
- void *interface;
- } diskio;
+ EFI_DISK_IO_PROTOCOL *diskio;
struct image *image;
EFI_STATUS efirc;
int rc;
@@ -1168,13 +1165,13 @@ int efi_file_install ( EFI_HANDLE handle ) {
* shell. I have no idea why this is.
*/
if ( ( rc = efi_open_by_driver ( handle, &efi_disk_io_protocol_guid,
- &diskio.interface ) ) != 0 ) {
+ &diskio ) ) != 0 ) {
DBGC ( handle, "Could not open disk I/O protocol: %s\n",
strerror ( rc ) );
DBGC_EFI_OPENERS ( handle, handle, &efi_disk_io_protocol_guid );
goto err_open;
}
- assert ( diskio.diskio == &efi_disk_io_protocol );
+ assert ( diskio == &efi_disk_io_protocol );
/* Claim Linux initrd fixed device path */
if ( ( rc = efi_file_path_claim ( &efi_file_initrd ) ) != 0 )