From 32a9408217810498deeeae3d2564ab15468c9c39 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 24 Mar 2025 14:24:47 +0000 Subject: [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 --- src/interface/efi/efi_file.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/interface/efi/efi_file.c') 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 ) -- cgit v1.2.3-55-g7522