boot: Use UEFI protocol struct names

These are somewhat pointless gnu-efi typedefs. Using the names from the
UEFI spec makes things clearer.

The one exception left is EFI_FILE as we use it a lot and
EFI_FILE_PROTOCOL is quite a handful.
This commit is contained in:
Jan Janssen 2022-07-07 10:24:14 +02:00
parent 04f316f0ee
commit b30a43dfd7
8 changed files with 18 additions and 18 deletions

View file

@ -1935,7 +1935,7 @@ static EFI_STATUS boot_windows_bitlocker(void) {
/* Look for BitLocker magic string on all block drives. */
bool found = false;
for (UINTN i = 0; i < n_handles; i++) {
EFI_BLOCK_IO *block_io;
EFI_BLOCK_IO_PROTOCOL *block_io;
err = BS->HandleProtocol(handles[i], &BlockIoProtocol, (void **) &block_io);
if (err != EFI_SUCCESS || block_io->Media->BlockSize < 512 || block_io->Media->BlockSize > 4096)
continue;
@ -2328,7 +2328,7 @@ static EFI_STATUS image_start(
if (err != EFI_SUCCESS)
return log_error_status_stall(err, L"Error registering initrd: %r", err);
EFI_LOADED_IMAGE *loaded_image;
EFI_LOADED_IMAGE_PROTOCOL *loaded_image;
err = BS->HandleProtocol(image, &LoadedImageProtocol, (void **) &loaded_image);
if (err != EFI_SUCCESS)
return log_error_status_stall(err, L"Error getting LoadedImageProtocol handle: %r", err);
@ -2430,7 +2430,7 @@ static void save_selected_entry(const Config *config, const ConfigEntry *entry)
}
static void export_variables(
EFI_LOADED_IMAGE *loaded_image,
EFI_LOADED_IMAGE_PROTOCOL *loaded_image,
const char16_t *loaded_image_path,
uint64_t init_usec) {
@ -2472,7 +2472,7 @@ static void export_variables(
static void config_load_all_entries(
Config *config,
EFI_LOADED_IMAGE *loaded_image,
EFI_LOADED_IMAGE_PROTOCOL *loaded_image,
const char16_t *loaded_image_path,
EFI_FILE *root_dir) {
@ -2527,7 +2527,7 @@ static void config_load_all_entries(
}
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
EFI_LOADED_IMAGE *loaded_image;
EFI_LOADED_IMAGE_PROTOCOL *loaded_image;
_cleanup_(file_closep) EFI_FILE *root_dir = NULL;
_cleanup_(config_free) Config config = {};
char16_t *loaded_image_path;

View file

@ -305,7 +305,7 @@ static EFI_STATUS pack_cpio_trailer(
}
EFI_STATUS pack_cpio(
EFI_LOADED_IMAGE *loaded_image,
EFI_LOADED_IMAGE_PROTOCOL *loaded_image,
const char16_t *dropin_dir,
const char16_t *match_suffix,
const char *target_dir_prefix,

View file

@ -5,7 +5,7 @@
#include <uchar.h>
EFI_STATUS pack_cpio(
EFI_LOADED_IMAGE *loaded_image,
EFI_LOADED_IMAGE_PROTOCOL *loaded_image,
const char16_t *dropin_dir,
const char16_t *match_suffix,
const char *target_dir_prefix,

View file

@ -8,7 +8,7 @@
static EFI_STATUS load_one_driver(
EFI_HANDLE parent_image,
EFI_LOADED_IMAGE *loaded_image,
EFI_LOADED_IMAGE_PROTOCOL *loaded_image,
const char16_t *fname) {
_cleanup_(unload_imagep) EFI_HANDLE image = NULL;
@ -74,7 +74,7 @@ static EFI_STATUS reconnect(void) {
EFI_STATUS load_drivers(
EFI_HANDLE parent_image,
EFI_LOADED_IMAGE *loaded_image,
EFI_LOADED_IMAGE_PROTOCOL *loaded_image,
EFI_FILE *root_dir) {
_cleanup_(file_closep) EFI_FILE *drivers_dir = NULL;

View file

@ -5,5 +5,5 @@
EFI_STATUS load_drivers(
EFI_HANDLE parent_image,
EFI_LOADED_IMAGE *loaded_image,
EFI_LOADED_IMAGE_PROTOCOL *loaded_image,
EFI_FILE *root_dir);

View file

@ -16,7 +16,7 @@
#include "pe.h"
#include "util.h"
static EFI_LOADED_IMAGE * loaded_image_free(EFI_LOADED_IMAGE *img) {
static EFI_LOADED_IMAGE_PROTOCOL *loaded_image_free(EFI_LOADED_IMAGE_PROTOCOL *img) {
if (!img)
return NULL;
mfree(img->LoadOptions);
@ -28,7 +28,7 @@ static EFI_STATUS loaded_image_register(
const void *linux_buffer, UINTN linux_length,
EFI_HANDLE *ret_image) {
EFI_LOADED_IMAGE *loaded_image = NULL;
EFI_LOADED_IMAGE_PROTOCOL *loaded_image = NULL;
EFI_STATUS err;
assert(cmdline || cmdline_len > 0);
@ -36,8 +36,8 @@ static EFI_STATUS loaded_image_register(
assert(ret_image);
/* create and install new LoadedImage Protocol */
loaded_image = xnew(EFI_LOADED_IMAGE, 1);
*loaded_image = (EFI_LOADED_IMAGE) {
loaded_image = xnew(EFI_LOADED_IMAGE_PROTOCOL, 1);
*loaded_image = (EFI_LOADED_IMAGE_PROTOCOL) {
.ImageBase = (void *) linux_buffer,
.ImageSize = linux_length
};

View file

@ -101,7 +101,7 @@ static EFI_STATUS combine_initrd(
return EFI_SUCCESS;
}
static void export_variables(EFI_LOADED_IMAGE *loaded_image) {
static void export_variables(EFI_LOADED_IMAGE_PROTOCOL *loaded_image) {
char16_t uuid[37];
assert(loaded_image);
@ -173,7 +173,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
_cleanup_freepool_ void *sysext_initrd = NULL;
EFI_PHYSICAL_ADDRESS linux_base, initrd_base, dt_base;
_cleanup_(devicetree_cleanup) struct devicetree_state dt_state = {};
EFI_LOADED_IMAGE *loaded_image;
EFI_LOADED_IMAGE_PROTOCOL *loaded_image;
UINTN addrs[_SECTION_MAX] = {};
UINTN szs[_SECTION_MAX] = {};
char *cmdline = NULL;

View file

@ -85,7 +85,7 @@ static bool verify_gpt(union GptHeaderBuffer *gpt_header_buffer, EFI_LBA lba_exp
}
static EFI_STATUS try_gpt(
EFI_BLOCK_IO *block_io,
EFI_BLOCK_IO_PROTOCOL *block_io,
EFI_LBA lba,
EFI_LBA *ret_backup_lba, /* May be changed even on error! */
HARDDRIVE_DEVICE_PATH *ret_hd) {
@ -195,7 +195,7 @@ static EFI_STATUS find_device(EFI_HANDLE *device, EFI_DEVICE_PATH **ret_device_p
EFI_DEVICE_PATH *p = disk_path = path_chop(partition_path, part_node);
EFI_HANDLE disk_handle;
EFI_BLOCK_IO *block_io;
EFI_BLOCK_IO_PROTOCOL *block_io;
err = BS->LocateDevicePath(&BlockIoProtocol, &p, &disk_handle);
if (err != EFI_SUCCESS)
return err;