sd-boot: Convert VOID -> void
We are already using void in several places and having a screaming typedef for void feels pointless. There are also CONST, IN, OUT and OPTIONAL which we aren't using either. This leaves missing_efi.h to keep it in line with how they are defined in gnu-efi and/or the specs.
This commit is contained in:
+37
-37
@@ -46,7 +46,7 @@ typedef struct {
|
||||
CHAR16 *devicetree;
|
||||
CHAR16 *options;
|
||||
CHAR16 key;
|
||||
EFI_STATUS (*call)(VOID);
|
||||
EFI_STATUS (*call)(void);
|
||||
BOOLEAN no_autoselect;
|
||||
BOOLEAN non_unique;
|
||||
UINTN tries_done;
|
||||
@@ -88,7 +88,7 @@ enum {
|
||||
TIMEOUT_TYPE_MAX = UINT32_MAX,
|
||||
};
|
||||
|
||||
static VOID cursor_left(UINTN *cursor, UINTN *first) {
|
||||
static void cursor_left(UINTN *cursor, UINTN *first) {
|
||||
assert(cursor);
|
||||
assert(first);
|
||||
|
||||
@@ -98,7 +98,7 @@ static VOID cursor_left(UINTN *cursor, UINTN *first) {
|
||||
(*first)--;
|
||||
}
|
||||
|
||||
static VOID cursor_right(
|
||||
static void cursor_right(
|
||||
UINTN *cursor,
|
||||
UINTN *first,
|
||||
UINTN x_max,
|
||||
@@ -428,7 +428,7 @@ static void ps_bool(const CHAR16 *fmt, BOOLEAN value) {
|
||||
Print(fmt, yes_no(value));
|
||||
}
|
||||
|
||||
static VOID print_status(Config *config, CHAR16 *loaded_image_path) {
|
||||
static void print_status(Config *config, CHAR16 *loaded_image_path) {
|
||||
UINT64 key;
|
||||
UINTN x_max, y_max;
|
||||
BOOLEAN setup_mode = FALSE;
|
||||
@@ -440,9 +440,9 @@ static VOID print_status(Config *config, CHAR16 *loaded_image_path) {
|
||||
clear_screen(COLOR_NORMAL);
|
||||
console_query_mode(&x_max, &y_max);
|
||||
|
||||
(VOID) efivar_get(LOADER_GUID, L"LoaderDevicePartUUID", &device_part_uuid);
|
||||
(VOID) efivar_get(LOADER_GUID, L"LoaderEntryDefault", &default_efivar);
|
||||
(VOID) efivar_get_boolean_u8(EFI_GLOBAL_GUID, L"SetupMode", &setup_mode);
|
||||
(void) efivar_get(LOADER_GUID, L"LoaderDevicePartUUID", &device_part_uuid);
|
||||
(void) efivar_get(LOADER_GUID, L"LoaderEntryDefault", &default_efivar);
|
||||
(void) efivar_get_boolean_u8(EFI_GLOBAL_GUID, L"SetupMode", &setup_mode);
|
||||
|
||||
/* We employ some unusual indentation here for readability. */
|
||||
|
||||
@@ -933,7 +933,7 @@ static BOOLEAN menu_run(
|
||||
return run;
|
||||
}
|
||||
|
||||
static VOID config_add_entry(Config *config, ConfigEntry *entry) {
|
||||
static void config_add_entry(Config *config, ConfigEntry *entry) {
|
||||
assert(config);
|
||||
assert(entry);
|
||||
|
||||
@@ -941,13 +941,13 @@ static VOID config_add_entry(Config *config, ConfigEntry *entry) {
|
||||
UINTN i = config->entry_count + 16;
|
||||
config->entries = ReallocatePool(
|
||||
config->entries,
|
||||
sizeof(VOID *) * config->entry_count,
|
||||
sizeof(VOID *) * i);
|
||||
sizeof(void *) * config->entry_count,
|
||||
sizeof(void *) * i);
|
||||
}
|
||||
config->entries[config->entry_count++] = entry;
|
||||
}
|
||||
|
||||
static VOID config_entry_free(ConfigEntry *entry) {
|
||||
static void config_entry_free(ConfigEntry *entry) {
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
@@ -965,7 +965,7 @@ static VOID config_entry_free(ConfigEntry *entry) {
|
||||
FreePool(entry);
|
||||
}
|
||||
|
||||
static inline VOID config_entry_freep(ConfigEntry **entry) {
|
||||
static inline void config_entry_freep(ConfigEntry **entry) {
|
||||
config_entry_free(*entry);
|
||||
}
|
||||
|
||||
@@ -1042,7 +1042,7 @@ skip:
|
||||
return line;
|
||||
}
|
||||
|
||||
static VOID config_defaults_load_from_file(Config *config, CHAR8 *content) {
|
||||
static void config_defaults_load_from_file(Config *config, CHAR8 *content) {
|
||||
CHAR8 *line;
|
||||
UINTN pos = 0;
|
||||
CHAR8 *key, *value;
|
||||
@@ -1134,7 +1134,7 @@ static VOID config_defaults_load_from_file(Config *config, CHAR8 *content) {
|
||||
}
|
||||
}
|
||||
|
||||
static VOID config_entry_parse_tries(
|
||||
static void config_entry_parse_tries(
|
||||
ConfigEntry *entry,
|
||||
const CHAR16 *path,
|
||||
const CHAR16 *file,
|
||||
@@ -1253,7 +1253,7 @@ good:
|
||||
entry->next_name = PoolPrint(L"%s+%u-%u%s", prefix, next_left, next_done, suffix ?: L"");
|
||||
}
|
||||
|
||||
static VOID config_entry_bump_counters(
|
||||
static void config_entry_bump_counters(
|
||||
ConfigEntry *entry,
|
||||
EFI_FILE_HANDLE root_dir) {
|
||||
|
||||
@@ -1306,7 +1306,7 @@ static VOID config_entry_bump_counters(
|
||||
}
|
||||
}
|
||||
|
||||
static VOID config_entry_add_from_file(
|
||||
static void config_entry_add_from_file(
|
||||
Config *config,
|
||||
EFI_HANDLE *device,
|
||||
EFI_FILE *root_dir,
|
||||
@@ -1456,7 +1456,7 @@ static VOID config_entry_add_from_file(
|
||||
TAKE_PTR(entry);
|
||||
}
|
||||
|
||||
static VOID config_load_defaults(Config *config, EFI_FILE *root_dir) {
|
||||
static void config_load_defaults(Config *config, EFI_FILE *root_dir) {
|
||||
_cleanup_freepool_ CHAR8 *content = NULL;
|
||||
UINTN value;
|
||||
EFI_STATUS err;
|
||||
@@ -1499,7 +1499,7 @@ static VOID config_load_defaults(Config *config, EFI_FILE *root_dir) {
|
||||
config->console_mode_efivar = value;
|
||||
}
|
||||
|
||||
static VOID config_load_entries(
|
||||
static void config_load_entries(
|
||||
Config *config,
|
||||
EFI_HANDLE *device,
|
||||
EFI_FILE *root_dir,
|
||||
@@ -1576,7 +1576,7 @@ static INTN config_entry_compare(const ConfigEntry *a, const ConfigEntry *b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static VOID config_sort_entries(Config *config) {
|
||||
static void config_sort_entries(Config *config) {
|
||||
assert(config);
|
||||
|
||||
sort_pointer_array((void**) config->entries, config->entry_count, (compare_pointer_func_t) config_entry_compare);
|
||||
@@ -1593,7 +1593,7 @@ static INTN config_entry_find(Config *config, CHAR16 *id) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static VOID config_default_entry_select(Config *config) {
|
||||
static void config_default_entry_select(Config *config) {
|
||||
_cleanup_freepool_ CHAR16 *entry_default = NULL;
|
||||
EFI_STATUS err;
|
||||
INTN i;
|
||||
@@ -1682,7 +1682,7 @@ static BOOLEAN find_nonunique(ConfigEntry **entries, UINTN entry_count) {
|
||||
}
|
||||
|
||||
/* generate a unique title, avoiding non-distinguishable menu entries */
|
||||
static VOID config_title_generate(Config *config) {
|
||||
static void config_title_generate(Config *config) {
|
||||
assert(config);
|
||||
|
||||
/* set title */
|
||||
@@ -1753,7 +1753,7 @@ static BOOLEAN config_entry_add_call(
|
||||
Config *config,
|
||||
const CHAR16 *id,
|
||||
const CHAR16 *title,
|
||||
EFI_STATUS (*call)(VOID)) {
|
||||
EFI_STATUS (*call)(void)) {
|
||||
|
||||
ConfigEntry *entry;
|
||||
|
||||
@@ -1890,7 +1890,7 @@ static BOOLEAN config_entry_add_loader_auto(
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static VOID config_entry_add_osx(Config *config) {
|
||||
static void config_entry_add_osx(Config *config) {
|
||||
EFI_STATUS err;
|
||||
UINTN handle_count = 0;
|
||||
_cleanup_freepool_ EFI_HANDLE *handles = NULL;
|
||||
@@ -1918,7 +1918,7 @@ static VOID config_entry_add_osx(Config *config) {
|
||||
}
|
||||
}
|
||||
|
||||
static VOID config_entry_add_windows(Config *config, EFI_HANDLE *device, EFI_FILE *root_dir) {
|
||||
static void config_entry_add_windows(Config *config, EFI_HANDLE *device, EFI_FILE *root_dir) {
|
||||
_cleanup_freepool_ CHAR8 *bcd = NULL;
|
||||
const CHAR16 *title = NULL;
|
||||
EFI_STATUS err;
|
||||
@@ -1967,7 +1967,7 @@ static VOID config_entry_add_windows(Config *config, EFI_HANDLE *device, EFI_FIL
|
||||
L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi");
|
||||
}
|
||||
|
||||
static VOID config_entry_add_linux(
|
||||
static void config_entry_add_linux(
|
||||
Config *config,
|
||||
EFI_HANDLE *device,
|
||||
EFI_FILE *root_dir) {
|
||||
@@ -2102,7 +2102,7 @@ static VOID config_entry_add_linux(
|
||||
}
|
||||
}
|
||||
|
||||
static VOID config_load_xbootldr(
|
||||
static void config_load_xbootldr(
|
||||
Config *config,
|
||||
EFI_HANDLE *device) {
|
||||
|
||||
@@ -2159,7 +2159,7 @@ static EFI_STATUS image_start(
|
||||
if (options) {
|
||||
EFI_LOADED_IMAGE *loaded_image;
|
||||
|
||||
err = uefi_call_wrapper(BS->OpenProtocol, 6, image, &LoadedImageProtocol, (VOID **)&loaded_image,
|
||||
err = uefi_call_wrapper(BS->OpenProtocol, 6, image, &LoadedImageProtocol, (void **)&loaded_image,
|
||||
parent_image, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (EFI_ERROR(err)) {
|
||||
log_error_stall(L"Error getting LoadedImageProtocol handle: %r", err);
|
||||
@@ -2169,7 +2169,7 @@ static EFI_STATUS image_start(
|
||||
loaded_image->LoadOptionsSize = StrSize(loaded_image->LoadOptions);
|
||||
|
||||
/* Try to log any options to the TPM, especially to catch manually edited options */
|
||||
(VOID) tpm_log_load_options(options);
|
||||
(void) tpm_log_load_options(options);
|
||||
}
|
||||
|
||||
efivar_set_time_usec(LOADER_GUID, L"LoaderTimeExecUSec", 0);
|
||||
@@ -2179,7 +2179,7 @@ out_unload:
|
||||
return err;
|
||||
}
|
||||
|
||||
static EFI_STATUS reboot_into_firmware(VOID) {
|
||||
static EFI_STATUS reboot_into_firmware(void) {
|
||||
UINT64 old, new;
|
||||
EFI_STATUS err;
|
||||
|
||||
@@ -2197,7 +2197,7 @@ static EFI_STATUS reboot_into_firmware(VOID) {
|
||||
return log_error_status_stall(err, L"Error calling ResetSystem: %r", err);
|
||||
}
|
||||
|
||||
static VOID config_free(Config *config) {
|
||||
static void config_free(Config *config) {
|
||||
assert(config);
|
||||
for (UINTN i = 0; i < config->entry_count; i++)
|
||||
config_entry_free(config->entries[i]);
|
||||
@@ -2207,7 +2207,7 @@ static VOID config_free(Config *config) {
|
||||
FreePool(config->entry_oneshot);
|
||||
}
|
||||
|
||||
static VOID config_write_entries_to_variable(Config *config) {
|
||||
static void config_write_entries_to_variable(Config *config) {
|
||||
_cleanup_freepool_ CHAR8 *buffer = NULL;
|
||||
UINTN sz = 0;
|
||||
CHAR8 *p;
|
||||
@@ -2234,7 +2234,7 @@ static VOID config_write_entries_to_variable(Config *config) {
|
||||
(void) efivar_set_raw(LOADER_GUID, L"LoaderEntries", buffer, sz, 0);
|
||||
}
|
||||
|
||||
static VOID export_variables(
|
||||
static void export_variables(
|
||||
EFI_LOADED_IMAGE *loaded_image,
|
||||
const CHAR16 *loaded_image_path,
|
||||
UINT64 init_usec) {
|
||||
@@ -2275,7 +2275,7 @@ static VOID export_variables(
|
||||
efivar_set(LOADER_GUID, L"LoaderDevicePartUUID", uuid, 0);
|
||||
}
|
||||
|
||||
static VOID config_load_all_entries(
|
||||
static void config_load_all_entries(
|
||||
Config *config,
|
||||
EFI_LOADED_IMAGE *loaded_image,
|
||||
const CHAR16 *loaded_image_path,
|
||||
@@ -2331,7 +2331,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
BS->OpenProtocol, 6,
|
||||
image,
|
||||
&LoadedImageProtocol,
|
||||
(VOID **)&loaded_image,
|
||||
(void **)&loaded_image,
|
||||
image,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
@@ -2354,7 +2354,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
return log_error_status_stall(err, L"Error installing security policy: %r", err);
|
||||
}
|
||||
|
||||
(VOID) load_drivers(image, loaded_image, root_dir);
|
||||
(void) load_drivers(image, loaded_image, root_dir);
|
||||
|
||||
config_load_all_entries(&config, loaded_image, loaded_image_path, root_dir);
|
||||
|
||||
@@ -2416,10 +2416,10 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
config_entry_bump_counters(entry, root_dir);
|
||||
|
||||
/* Export the selected boot entry to the system */
|
||||
(VOID) efivar_set(LOADER_GUID, L"LoaderEntrySelected", entry->id, 0);
|
||||
(void) efivar_set(LOADER_GUID, L"LoaderEntrySelected", entry->id, 0);
|
||||
|
||||
/* Optionally, read a random seed off the ESP and pass it to the OS */
|
||||
(VOID) process_random_seed(root_dir, config.random_seed_mode);
|
||||
(void) process_random_seed(root_dir, config.random_seed_mode);
|
||||
|
||||
err = image_start(root_dir, image, &config, entry);
|
||||
if (EFI_ERROR(err)) {
|
||||
|
||||
@@ -50,7 +50,7 @@ EFI_STATUS console_key_read(UINT64 *key, UINT64 timeout_usec) {
|
||||
assert(key);
|
||||
|
||||
if (!checked) {
|
||||
err = LibLocateProtocol((EFI_GUID*) EFI_SIMPLE_TEXT_INPUT_EX_GUID, (VOID **)&TextInputEx);
|
||||
err = LibLocateProtocol((EFI_GUID*) EFI_SIMPLE_TEXT_INPUT_EX_GUID, (void **)&TextInputEx);
|
||||
if (EFI_ERROR(err) ||
|
||||
uefi_call_wrapper(BS->CheckEvent, 1, TextInputEx->WaitForKeyEx) == EFI_INVALID_PARAMETER)
|
||||
/* If WaitForKeyEx fails here, the firmware pretends it talks this
|
||||
@@ -167,7 +167,7 @@ static INT64 get_auto_mode(void) {
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||
EFI_STATUS err;
|
||||
|
||||
err = LibLocateProtocol(&GraphicsOutputProtocol, (VOID **)&GraphicsOutput);
|
||||
err = LibLocateProtocol(&GraphicsOutputProtocol, (void **)&GraphicsOutput);
|
||||
if (!EFI_ERROR(err) && GraphicsOutput->Mode && GraphicsOutput->Mode->Info) {
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info = GraphicsOutput->Mode->Info;
|
||||
BOOLEAN keep = FALSE;
|
||||
|
||||
+9
-9
@@ -53,12 +53,12 @@ static CHAR8* pad4(CHAR8 *p, const CHAR8* start) {
|
||||
|
||||
static EFI_STATUS pack_cpio_one(
|
||||
const CHAR16 *fname,
|
||||
const VOID *contents,
|
||||
const void *contents,
|
||||
UINTN contents_size,
|
||||
const CHAR8 *target_dir_prefix,
|
||||
UINT32 access_mode,
|
||||
UINT32 *inode_counter,
|
||||
VOID **cpio_buffer,
|
||||
void **cpio_buffer,
|
||||
UINTN *cpio_buffer_size) {
|
||||
|
||||
UINTN l, target_dir_prefix_size, fname_size, q;
|
||||
@@ -167,7 +167,7 @@ static EFI_STATUS pack_cpio_dir(
|
||||
const CHAR8 *path,
|
||||
UINT32 access_mode,
|
||||
UINT32 *inode_counter,
|
||||
VOID **cpio_buffer,
|
||||
void **cpio_buffer,
|
||||
UINTN *cpio_buffer_size) {
|
||||
|
||||
UINTN l, path_size;
|
||||
@@ -238,7 +238,7 @@ static EFI_STATUS pack_cpio_prefix(
|
||||
const CHAR8 *path,
|
||||
UINT32 dir_mode,
|
||||
UINT32 *inode_counter,
|
||||
VOID **cpio_buffer,
|
||||
void **cpio_buffer,
|
||||
UINTN *cpio_buffer_size) {
|
||||
|
||||
EFI_STATUS err;
|
||||
@@ -278,7 +278,7 @@ static EFI_STATUS pack_cpio_prefix(
|
||||
}
|
||||
|
||||
static EFI_STATUS pack_cpio_trailer(
|
||||
VOID **cpio_buffer,
|
||||
void **cpio_buffer,
|
||||
UINTN *cpio_buffer_size) {
|
||||
|
||||
static const char trailer[] =
|
||||
@@ -298,7 +298,7 @@ static EFI_STATUS pack_cpio_trailer(
|
||||
"00000000"
|
||||
"TRAILER!!!\0\0\0"; /* There's a fourth NUL byte appended here, because this is a string */
|
||||
|
||||
VOID *a;
|
||||
void *a;
|
||||
|
||||
/* Generates the cpio trailer record that indicates the end of our initrd cpio archive */
|
||||
|
||||
@@ -325,7 +325,7 @@ EFI_STATUS pack_cpio(
|
||||
UINT32 access_mode,
|
||||
UINTN tpm_pcr,
|
||||
const CHAR16 *tpm_description,
|
||||
VOID **ret_buffer,
|
||||
void **ret_buffer,
|
||||
UINTN *ret_buffer_size) {
|
||||
|
||||
_cleanup_(FileHandleClosep) EFI_FILE_HANDLE root = NULL, extra_dir = NULL;
|
||||
@@ -333,7 +333,7 @@ EFI_STATUS pack_cpio(
|
||||
_cleanup_freepool_ CHAR16 *loaded_image_path = NULL, *j = NULL;
|
||||
_cleanup_freepool_ EFI_FILE_INFO *dirent = NULL;
|
||||
_cleanup_(strv_freep) CHAR16 **items = NULL;
|
||||
_cleanup_freepool_ VOID *buffer = NULL;
|
||||
_cleanup_freepool_ void *buffer = NULL;
|
||||
UINT32 inode = 1; /* inode counter, so that each item gets a new inode */
|
||||
EFI_STATUS err;
|
||||
|
||||
@@ -416,7 +416,7 @@ EFI_STATUS pack_cpio(
|
||||
|
||||
/* Now, sort the files we found, to make this uniform and stable (and to ensure the TPM measurements
|
||||
* are not dependent on read order) */
|
||||
sort_pointer_array((VOID**) items, n_items, (compare_pointer_func_t) StrCmp);
|
||||
sort_pointer_array((void**) items, n_items, (compare_pointer_func_t) StrCmp);
|
||||
|
||||
/* Generate the leading directory inodes right before adding the first files, to the
|
||||
* archive. Otherwise the cpio archive cannot be unpacked, since the leading dirs won't exist. */
|
||||
|
||||
+1
-1
@@ -11,5 +11,5 @@ EFI_STATUS pack_cpio(
|
||||
UINT32 access_mode,
|
||||
UINTN pcr,
|
||||
const CHAR16 *tpm_description,
|
||||
VOID **ret_buffer,
|
||||
void **ret_buffer,
|
||||
UINTN *ret_buffer_size);
|
||||
|
||||
@@ -35,7 +35,7 @@ static EFI_STATUS devicetree_fixup(struct devicetree_state *state, UINTN len) {
|
||||
|
||||
assert(state);
|
||||
|
||||
err = LibLocateProtocol(&EfiDtFixupProtocol, (VOID **)&fixup);
|
||||
err = LibLocateProtocol(&EfiDtFixupProtocol, (void **)&fixup);
|
||||
if (EFI_ERROR(err))
|
||||
return log_error_status_stall(EFI_SUCCESS,
|
||||
L"Could not locate device tree fixup protocol, skipping.");
|
||||
@@ -46,7 +46,7 @@ static EFI_STATUS devicetree_fixup(struct devicetree_state *state, UINTN len) {
|
||||
if (err == EFI_BUFFER_TOO_SMALL) {
|
||||
EFI_PHYSICAL_ADDRESS oldaddr = state->addr;
|
||||
UINTN oldpages = state->pages;
|
||||
VOID *oldptr = PHYSICAL_ADDRESS_TO_POINTER(state->addr);
|
||||
void *oldptr = PHYSICAL_ADDRESS_TO_POINTER(state->addr);
|
||||
|
||||
err = devicetree_allocate(state, size);
|
||||
if (EFI_ERROR(err))
|
||||
@@ -110,7 +110,7 @@ EFI_STATUS devicetree_install(struct devicetree_state *state,
|
||||
}
|
||||
|
||||
EFI_STATUS devicetree_install_from_memory(struct devicetree_state *state,
|
||||
const VOID *dtb_buffer, UINTN dtb_length) {
|
||||
const void *dtb_buffer, UINTN dtb_length) {
|
||||
|
||||
EFI_STATUS err;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
struct devicetree_state {
|
||||
EFI_PHYSICAL_ADDRESS addr;
|
||||
UINTN pages;
|
||||
VOID *orig;
|
||||
void *orig;
|
||||
};
|
||||
|
||||
EFI_STATUS devicetree_install(struct devicetree_state *state, EFI_FILE_HANDLE root_dir, CHAR16 *name);
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include "drivers.h"
|
||||
#include "util.h"
|
||||
|
||||
static VOID efi_unload_image(EFI_HANDLE *h) {
|
||||
static void efi_unload_image(EFI_HANDLE *h) {
|
||||
if (*h)
|
||||
(VOID) uefi_call_wrapper(BS->UnloadImage, 1, *h);
|
||||
(void) uefi_call_wrapper(BS->UnloadImage, 1, *h);
|
||||
}
|
||||
|
||||
static EFI_STATUS load_one_driver(
|
||||
@@ -47,7 +47,7 @@ static EFI_STATUS load_one_driver(
|
||||
BS->HandleProtocol, 3,
|
||||
image,
|
||||
&LoadedImageProtocol,
|
||||
(VOID **)&loaded_image);
|
||||
(void **)&loaded_image);
|
||||
if (EFI_ERROR(err))
|
||||
return log_error_status_stall(err, L"Failed to find protocol in driver image s: %r", fname, err);
|
||||
|
||||
@@ -67,7 +67,7 @@ static EFI_STATUS load_one_driver(
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
static EFI_STATUS reconnect(VOID) {
|
||||
static EFI_STATUS reconnect(void) {
|
||||
_cleanup_freepool_ EFI_HANDLE *handles = NULL;
|
||||
UINTN n_handles = 0;
|
||||
EFI_STATUS err;
|
||||
@@ -144,7 +144,7 @@ EFI_STATUS load_drivers(
|
||||
}
|
||||
|
||||
if (n_succeeded > 0)
|
||||
(VOID) reconnect();
|
||||
(void) reconnect();
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ EFI_STATUS graphics_mode(BOOLEAN on) {
|
||||
BOOLEAN stdin_locked;
|
||||
EFI_STATUS err;
|
||||
|
||||
err = LibLocateProtocol((EFI_GUID*) EFI_CONSOLE_CONTROL_GUID, (VOID **)&ConsoleControl);
|
||||
err = LibLocateProtocol((EFI_GUID*) EFI_CONSOLE_CONTROL_GUID, (void **)&ConsoleControl);
|
||||
if (EFI_ERROR(err))
|
||||
/* console control protocol is nonstandard and might not exist. */
|
||||
return err == EFI_NOT_FOUND ? EFI_SUCCESS : err;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
/* extend LoadFileProtocol */
|
||||
struct initrd_loader {
|
||||
EFI_LOAD_FILE_PROTOCOL load_file;
|
||||
const VOID *address;
|
||||
const void *address;
|
||||
UINTN length;
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ EFIAPI EFI_STATUS initrd_load_file(
|
||||
EFI_DEVICE_PATH *file_path,
|
||||
BOOLEAN boot_policy,
|
||||
UINTN *buffer_size,
|
||||
VOID *buffer) {
|
||||
void *buffer) {
|
||||
|
||||
struct initrd_loader *loader;
|
||||
|
||||
@@ -66,7 +66,7 @@ EFIAPI EFI_STATUS initrd_load_file(
|
||||
}
|
||||
|
||||
EFI_STATUS initrd_register(
|
||||
const VOID *initrd_address,
|
||||
const void *initrd_address,
|
||||
UINTN initrd_length,
|
||||
EFI_HANDLE *ret_initrd_handle) {
|
||||
|
||||
@@ -121,7 +121,7 @@ EFI_STATUS initrd_unregister(EFI_HANDLE initrd_handle) {
|
||||
/* get the LoadFile2 protocol that we allocated earlier */
|
||||
err = uefi_call_wrapper(
|
||||
BS->OpenProtocol, 6,
|
||||
initrd_handle, &EfiLoadFile2Protocol, (VOID **) &loader,
|
||||
initrd_handle, &EfiLoadFile2Protocol, (void **) &loader,
|
||||
NULL, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (EFI_ERROR(err))
|
||||
return err;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <efi.h>
|
||||
|
||||
EFI_STATUS initrd_register(
|
||||
const VOID *initrd_address,
|
||||
const void *initrd_address,
|
||||
UINTN initrd_length,
|
||||
EFI_HANDLE *ret_initrd_handle);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ static EFI_LOADED_IMAGE * loaded_image_free(EFI_LOADED_IMAGE *img) {
|
||||
|
||||
static EFI_STATUS loaded_image_register(
|
||||
const CHAR8 *cmdline, UINTN cmdline_len,
|
||||
const VOID *linux_buffer, UINTN linux_length,
|
||||
const void *linux_buffer, UINTN linux_length,
|
||||
EFI_HANDLE *ret_image) {
|
||||
|
||||
EFI_LOADED_IMAGE *loaded_image = NULL;
|
||||
@@ -42,7 +42,7 @@ static EFI_STATUS loaded_image_register(
|
||||
|
||||
/* provide the image base address and size */
|
||||
*loaded_image = (EFI_LOADED_IMAGE) {
|
||||
.ImageBase = (VOID *) linux_buffer,
|
||||
.ImageBase = (void *) linux_buffer,
|
||||
.ImageSize = linux_length
|
||||
};
|
||||
|
||||
@@ -77,7 +77,7 @@ static EFI_STATUS loaded_image_unregister(EFI_HANDLE loaded_image_handle) {
|
||||
/* get the LoadedImage protocol that we allocated earlier */
|
||||
err = uefi_call_wrapper(
|
||||
BS->OpenProtocol, 6,
|
||||
loaded_image_handle, &LoadedImageProtocol, (VOID **) &loaded_image,
|
||||
loaded_image_handle, &LoadedImageProtocol, (void **) &loaded_image,
|
||||
NULL, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (EFI_ERROR(err))
|
||||
return err;
|
||||
@@ -123,15 +123,15 @@ static inline void cleanup_pages(struct pages *p) {
|
||||
EFI_STATUS linux_exec(
|
||||
EFI_HANDLE image,
|
||||
const CHAR8 *cmdline, UINTN cmdline_len,
|
||||
const VOID *linux_buffer, UINTN linux_length,
|
||||
const VOID *initrd_buffer, UINTN initrd_length) {
|
||||
const void *linux_buffer, UINTN linux_length,
|
||||
const void *initrd_buffer, UINTN initrd_length) {
|
||||
|
||||
_cleanup_(cleanup_initrd) EFI_HANDLE initrd_handle = NULL;
|
||||
_cleanup_(cleanup_loaded_image) EFI_HANDLE loaded_image_handle = NULL;
|
||||
UINT32 kernel_alignment, kernel_size_of_image, kernel_entry_address;
|
||||
EFI_IMAGE_ENTRY_POINT kernel_entry;
|
||||
_cleanup_(cleanup_pages) struct pages kernel = {};
|
||||
VOID *new_buffer;
|
||||
void *new_buffer;
|
||||
EFI_STATUS err;
|
||||
|
||||
assert(image);
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
EFI_STATUS linux_exec(
|
||||
EFI_HANDLE image,
|
||||
const CHAR8 *cmdline, UINTN cmdline_len,
|
||||
const VOID *linux_buffer, UINTN linux_length,
|
||||
const VOID *initrd_buffer, UINTN initrd_length);
|
||||
const void *linux_buffer, UINTN linux_length,
|
||||
const void *initrd_buffer, UINTN initrd_length);
|
||||
|
||||
@@ -104,9 +104,9 @@ struct boot_params {
|
||||
#define __regparm0__
|
||||
#endif
|
||||
|
||||
typedef VOID(*handover_f)(VOID *image, EFI_SYSTEM_TABLE *table, struct boot_params *params) __regparm0__;
|
||||
typedef void(*handover_f)(void *image, EFI_SYSTEM_TABLE *table, struct boot_params *params) __regparm0__;
|
||||
|
||||
static VOID linux_efi_handover(EFI_HANDLE image, struct boot_params *params) {
|
||||
static void linux_efi_handover(EFI_HANDLE image, struct boot_params *params) {
|
||||
handover_f handover;
|
||||
UINTN start = (UINTN)params->hdr.code32_start;
|
||||
|
||||
@@ -123,8 +123,8 @@ static VOID linux_efi_handover(EFI_HANDLE image, struct boot_params *params) {
|
||||
EFI_STATUS linux_exec(
|
||||
EFI_HANDLE image,
|
||||
const CHAR8 *cmdline, UINTN cmdline_len,
|
||||
const VOID *linux_buffer, UINTN linux_length,
|
||||
const VOID *initrd_buffer, UINTN initrd_length) {
|
||||
const void *linux_buffer, UINTN linux_length,
|
||||
const void *initrd_buffer, UINTN initrd_length) {
|
||||
|
||||
const struct boot_params *image_params;
|
||||
struct boot_params *boot_params;
|
||||
|
||||
+2
-2
@@ -130,7 +130,7 @@ static inline UINTN section_table_offset(const struct DosFileHeader *dos, const
|
||||
return dos->ExeHeader + OFFSETOF(struct PeFileHeader, OptionalHeader) + pe->FileHeader.SizeOfOptionalHeader;
|
||||
}
|
||||
|
||||
static VOID locate_sections(
|
||||
static void locate_sections(
|
||||
const struct PeSectionHeader section_table[],
|
||||
UINTN n_table,
|
||||
const CHAR8 **sections,
|
||||
@@ -159,7 +159,7 @@ static VOID locate_sections(
|
||||
}
|
||||
|
||||
EFI_STATUS pe_alignment_info(
|
||||
const VOID *base,
|
||||
const void *base,
|
||||
UINT32 *ret_entry_point_address,
|
||||
UINT32 *ret_size_of_image,
|
||||
UINT32 *ret_section_alignment) {
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ EFI_STATUS pe_file_locate_sections(
|
||||
UINTN *sizes);
|
||||
|
||||
EFI_STATUS pe_alignment_info(
|
||||
const VOID *base,
|
||||
const void *base,
|
||||
UINT32 *ret_entry_point_address,
|
||||
UINT32 *ret_size_of_image,
|
||||
UINT32 *ret_section_alignment);
|
||||
|
||||
+22
-22
@@ -17,8 +17,8 @@
|
||||
/* SHA256 gives us 256/8=32 bytes */
|
||||
#define HASH_VALUE_SIZE 32
|
||||
|
||||
static EFI_STATUS acquire_rng(UINTN size, VOID **ret) {
|
||||
_cleanup_freepool_ VOID *data = NULL;
|
||||
static EFI_STATUS acquire_rng(UINTN size, void **ret) {
|
||||
_cleanup_freepool_ void *data = NULL;
|
||||
EFI_RNG_PROTOCOL *rng;
|
||||
EFI_STATUS err;
|
||||
|
||||
@@ -26,7 +26,7 @@ static EFI_STATUS acquire_rng(UINTN size, VOID **ret) {
|
||||
|
||||
/* Try to acquire the specified number of bytes from the UEFI RNG */
|
||||
|
||||
err = LibLocateProtocol((EFI_GUID*) EFI_RNG_GUID, (VOID**) &rng);
|
||||
err = LibLocateProtocol((EFI_GUID*) EFI_RNG_GUID, (void**) &rng);
|
||||
if (EFI_ERROR(err))
|
||||
return err;
|
||||
if (!rng)
|
||||
@@ -44,11 +44,11 @@ static EFI_STATUS acquire_rng(UINTN size, VOID **ret) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
static VOID hash_once(
|
||||
const VOID *old_seed,
|
||||
const VOID *rng,
|
||||
static void hash_once(
|
||||
const void *old_seed,
|
||||
const void *rng,
|
||||
UINTN size,
|
||||
const VOID *system_token,
|
||||
const void *system_token,
|
||||
UINTN system_token_size,
|
||||
UINTN counter,
|
||||
UINT8 ret[static HASH_VALUE_SIZE]) {
|
||||
@@ -80,16 +80,16 @@ static VOID hash_once(
|
||||
}
|
||||
|
||||
static EFI_STATUS hash_many(
|
||||
const VOID *old_seed,
|
||||
const VOID *rng,
|
||||
const void *old_seed,
|
||||
const void *rng,
|
||||
UINTN size,
|
||||
const VOID *system_token,
|
||||
const void *system_token,
|
||||
UINTN system_token_size,
|
||||
UINTN counter_start,
|
||||
UINTN n,
|
||||
VOID **ret) {
|
||||
void **ret) {
|
||||
|
||||
_cleanup_freepool_ VOID *output = NULL;
|
||||
_cleanup_freepool_ void *output = NULL;
|
||||
|
||||
assert(old_seed);
|
||||
assert(rng);
|
||||
@@ -114,15 +114,15 @@ static EFI_STATUS hash_many(
|
||||
}
|
||||
|
||||
static EFI_STATUS mangle_random_seed(
|
||||
const VOID *old_seed,
|
||||
const VOID *rng,
|
||||
const void *old_seed,
|
||||
const void *rng,
|
||||
UINTN size,
|
||||
const VOID *system_token,
|
||||
const void *system_token,
|
||||
UINTN system_token_size,
|
||||
VOID **ret_new_seed,
|
||||
VOID **ret_for_kernel) {
|
||||
void **ret_new_seed,
|
||||
void **ret_for_kernel) {
|
||||
|
||||
_cleanup_freepool_ VOID *new_seed = NULL, *for_kernel = NULL;
|
||||
_cleanup_freepool_ void *new_seed = NULL, *for_kernel = NULL;
|
||||
EFI_STATUS err;
|
||||
UINTN n;
|
||||
|
||||
@@ -156,7 +156,7 @@ static EFI_STATUS mangle_random_seed(
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
static EFI_STATUS acquire_system_token(VOID **ret, UINTN *ret_size) {
|
||||
static EFI_STATUS acquire_system_token(void **ret, UINTN *ret_size) {
|
||||
_cleanup_freepool_ CHAR8 *data = NULL;
|
||||
EFI_STATUS err;
|
||||
UINTN size;
|
||||
@@ -180,7 +180,7 @@ static EFI_STATUS acquire_system_token(VOID **ret, UINTN *ret_size) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
static VOID validate_sha256(void) {
|
||||
static void validate_sha256(void) {
|
||||
|
||||
#ifdef EFI_DEBUG
|
||||
/* Let's validate our SHA256 implementation. We stole it from glibc, and converted it to UEFI
|
||||
@@ -231,7 +231,7 @@ static VOID validate_sha256(void) {
|
||||
}
|
||||
|
||||
EFI_STATUS process_random_seed(EFI_FILE *root_dir, RandomSeedMode mode) {
|
||||
_cleanup_freepool_ VOID *seed = NULL, *new_seed = NULL, *rng = NULL, *for_kernel = NULL, *system_token = NULL;
|
||||
_cleanup_freepool_ void *seed = NULL, *new_seed = NULL, *rng = NULL, *for_kernel = NULL, *system_token = NULL;
|
||||
_cleanup_(FileHandleClosep) EFI_FILE_HANDLE handle = NULL;
|
||||
UINTN size, rsize, wsize, system_token_size = 0;
|
||||
_cleanup_freepool_ EFI_FILE_INFO *info = NULL;
|
||||
@@ -292,7 +292,7 @@ EFI_STATUS process_random_seed(EFI_FILE *root_dir, RandomSeedMode mode) {
|
||||
/* Request some random data from the UEFI RNG. We don't need this to work safely, but it's a good
|
||||
* idea to use it because it helps us for cases where users mistakenly include a random seed in
|
||||
* golden master images that are replicated many times. */
|
||||
(VOID) acquire_rng(size, &rng); /* It's fine if this fails */
|
||||
(void) acquire_rng(size, &rng); /* It's fine if this fails */
|
||||
|
||||
/* Calculate new random seed for the disk and what to pass to the kernel */
|
||||
err = mangle_random_seed(seed, rng, size, system_token, system_token_size, &new_seed, &for_kernel);
|
||||
|
||||
+9
-9
@@ -22,13 +22,13 @@
|
||||
#endif
|
||||
|
||||
struct ShimLock {
|
||||
EFI_STATUS __sysv_abi__ (*shim_verify) (VOID *buffer, UINT32 size);
|
||||
EFI_STATUS __sysv_abi__ (*shim_verify) (void *buffer, UINT32 size);
|
||||
|
||||
/* context is actually a struct for the PE header, but it isn't needed so void is sufficient just do define the interface
|
||||
* see shim.c/shim.h and PeHeader.h in the github shim repo */
|
||||
EFI_STATUS __sysv_abi__ (*generate_hash) (VOID *data, UINT32 datasize, VOID *context, UINT8 *sha256hash, UINT8 *sha1hash);
|
||||
EFI_STATUS __sysv_abi__ (*generate_hash) (void *data, UINT32 datasize, void *context, UINT8 *sha256hash, UINT8 *sha1hash);
|
||||
|
||||
EFI_STATUS __sysv_abi__ (*read_header) (VOID *data, UINT32 datasize, VOID *context);
|
||||
EFI_STATUS __sysv_abi__ (*read_header) (void *data, UINT32 datasize, void *context);
|
||||
};
|
||||
|
||||
#define SIMPLE_FS_GUID &(const EFI_GUID) SIMPLE_FILE_SYSTEM_PROTOCOL
|
||||
@@ -38,16 +38,16 @@ struct ShimLock {
|
||||
BOOLEAN shim_loaded(void) {
|
||||
struct ShimLock *shim_lock;
|
||||
|
||||
return uefi_call_wrapper(BS->LocateProtocol, 3, (EFI_GUID*) SHIM_LOCK_GUID, NULL, (VOID**) &shim_lock) == EFI_SUCCESS;
|
||||
return uefi_call_wrapper(BS->LocateProtocol, 3, (EFI_GUID*) SHIM_LOCK_GUID, NULL, (void**) &shim_lock) == EFI_SUCCESS;
|
||||
}
|
||||
|
||||
static BOOLEAN shim_validate(VOID *data, UINT32 size) {
|
||||
static BOOLEAN shim_validate(void *data, UINT32 size) {
|
||||
struct ShimLock *shim_lock;
|
||||
|
||||
if (!data)
|
||||
return FALSE;
|
||||
|
||||
if (uefi_call_wrapper(BS->LocateProtocol, 3, (EFI_GUID*) SHIM_LOCK_GUID, NULL, (VOID**) &shim_lock) != EFI_SUCCESS)
|
||||
if (uefi_call_wrapper(BS->LocateProtocol, 3, (EFI_GUID*) SHIM_LOCK_GUID, NULL, (void**) &shim_lock) != EFI_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
if (!shim_lock)
|
||||
@@ -72,7 +72,7 @@ static EFI_SECURITY2_FILE_AUTHENTICATION es2fa = NULL;
|
||||
*/
|
||||
static EFIAPI EFI_STATUS security2_policy_authentication (const EFI_SECURITY2_PROTOCOL *this,
|
||||
const EFI_DEVICE_PATH_PROTOCOL *device_path,
|
||||
VOID *file_buffer, UINTN file_size, BOOLEAN boot_policy) {
|
||||
void *file_buffer, UINTN file_size, BOOLEAN boot_policy) {
|
||||
EFI_STATUS status;
|
||||
|
||||
assert(this);
|
||||
@@ -155,9 +155,9 @@ EFI_STATUS security_policy_install(void) {
|
||||
* to fail, since SECURITY2 was introduced in PI 1.2.1.
|
||||
* Use security2_protocol == NULL as indicator.
|
||||
*/
|
||||
uefi_call_wrapper(BS->LocateProtocol, 3, (EFI_GUID*) SECURITY_PROTOCOL2_GUID, NULL, (VOID**) &security2_protocol);
|
||||
uefi_call_wrapper(BS->LocateProtocol, 3, (EFI_GUID*) SECURITY_PROTOCOL2_GUID, NULL, (void**) &security2_protocol);
|
||||
|
||||
status = uefi_call_wrapper(BS->LocateProtocol, 3, (EFI_GUID*) SECURITY_PROTOCOL_GUID, NULL, (VOID**) &security_protocol);
|
||||
status = uefi_call_wrapper(BS->LocateProtocol, 3, (EFI_GUID*) SECURITY_PROTOCOL_GUID, NULL, (void**) &security_protocol);
|
||||
/* This one is mandatory, so there's a serious problem */
|
||||
if (status != EFI_SUCCESS)
|
||||
return status;
|
||||
|
||||
@@ -135,7 +135,7 @@ static EFI_STATUS bmp_parse_header(
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
static VOID pixel_blend(UINT32 *dst, const UINT32 source) {
|
||||
static void pixel_blend(UINT32 *dst, const UINT32 source) {
|
||||
UINT32 alpha, src, src_rb, src_g, dst_rb, dst_g, rb, g;
|
||||
|
||||
assert(dst);
|
||||
@@ -262,7 +262,7 @@ EFI_STATUS graphics_splash(const UINT8 *content, UINTN len, const EFI_GRAPHICS_O
|
||||
struct bmp_map *map;
|
||||
const UINT8 *pixmap;
|
||||
UINT64 blt_size;
|
||||
_cleanup_freepool_ VOID *blt = NULL;
|
||||
_cleanup_freepool_ void *blt = NULL;
|
||||
UINTN x_pos = 0;
|
||||
UINTN y_pos = 0;
|
||||
EFI_STATUS err;
|
||||
@@ -281,7 +281,7 @@ EFI_STATUS graphics_splash(const UINT8 *content, UINTN len, const EFI_GRAPHICS_O
|
||||
background = &pixel;
|
||||
}
|
||||
|
||||
err = LibLocateProtocol((EFI_GUID*) &GraphicsOutputProtocolGuid, (VOID **)&GraphicsOutput);
|
||||
err = LibLocateProtocol((EFI_GUID*) &GraphicsOutputProtocolGuid, (void **)&GraphicsOutput);
|
||||
if (EFI_ERROR(err))
|
||||
return err;
|
||||
|
||||
|
||||
+8
-8
@@ -19,8 +19,8 @@ _used_ _section_(".sdmagic") static const char magic[] = "#### LoaderInfo: syste
|
||||
|
||||
static EFI_STATUS combine_initrd(
|
||||
EFI_PHYSICAL_ADDRESS initrd_base, UINTN initrd_size,
|
||||
const VOID *credential_initrd, UINTN credential_initrd_size,
|
||||
const VOID *sysext_initrd, UINTN sysext_initrd_size,
|
||||
const void *credential_initrd, UINTN credential_initrd_size,
|
||||
const void *sysext_initrd, UINTN sysext_initrd_size,
|
||||
EFI_PHYSICAL_ADDRESS *ret_initrd_base, UINTN *ret_initrd_size) {
|
||||
|
||||
EFI_PHYSICAL_ADDRESS base = UINT32_MAX; /* allocate an area below the 32bit boundary for this */
|
||||
@@ -90,7 +90,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 *loaded_image) {
|
||||
CHAR16 uuid[37];
|
||||
|
||||
assert(loaded_image);
|
||||
@@ -166,7 +166,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
|
||||
UINTN cmdline_len = 0, linux_size, initrd_size, dt_size;
|
||||
UINTN credential_initrd_size = 0, sysext_initrd_size = 0;
|
||||
_cleanup_freepool_ VOID *credential_initrd = NULL, *sysext_initrd = NULL;
|
||||
_cleanup_freepool_ void *credential_initrd = NULL, *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;
|
||||
@@ -177,7 +177,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
|
||||
InitializeLib(image, sys_table);
|
||||
|
||||
err = uefi_call_wrapper(BS->OpenProtocol, 6, image, &LoadedImageProtocol, (VOID **)&loaded_image,
|
||||
err = uefi_call_wrapper(BS->OpenProtocol, 6, image, &LoadedImageProtocol, (void **)&loaded_image,
|
||||
image, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (EFI_ERROR(err))
|
||||
return log_error_status_stall(err, L"Error getting a LoadedImageProtocol handle: %r", err);
|
||||
@@ -214,12 +214,12 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
* duplicates what we already did in the boot menu, if that was already used. However, since
|
||||
* we want the boot menu to support an EFI binary, and want to this stub to be usable from
|
||||
* any boot menu, let's measure things anyway. */
|
||||
(VOID) tpm_log_load_options(loaded_image->LoadOptions);
|
||||
(void) tpm_log_load_options(loaded_image->LoadOptions);
|
||||
}
|
||||
|
||||
export_variables(loaded_image);
|
||||
|
||||
(VOID) pack_cpio(loaded_image,
|
||||
(void) pack_cpio(loaded_image,
|
||||
L".cred",
|
||||
(const CHAR8*) ".extra/credentials",
|
||||
/* dir_mode= */ 0500,
|
||||
@@ -229,7 +229,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
&credential_initrd,
|
||||
&credential_initrd_size);
|
||||
|
||||
(VOID) pack_cpio(loaded_image,
|
||||
(void) pack_cpio(loaded_image,
|
||||
L".raw",
|
||||
(const CHAR8*) ".extra/sysext",
|
||||
/* dir_mode= */ 0555,
|
||||
|
||||
+18
-18
@@ -6,39 +6,39 @@
|
||||
#include "util.h"
|
||||
|
||||
#ifdef __x86_64__
|
||||
UINT64 ticks_read(VOID) {
|
||||
UINT64 ticks_read(void) {
|
||||
UINT64 a, d;
|
||||
__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
|
||||
return (d << 32) | a;
|
||||
}
|
||||
#elif defined(__i386__)
|
||||
UINT64 ticks_read(VOID) {
|
||||
UINT64 ticks_read(void) {
|
||||
UINT64 val;
|
||||
__asm__ volatile ("rdtsc" : "=A" (val));
|
||||
return val;
|
||||
}
|
||||
#elif defined(__aarch64__)
|
||||
UINT64 ticks_read(VOID) {
|
||||
UINT64 ticks_read(void) {
|
||||
UINT64 val;
|
||||
__asm__ volatile ("mrs %0, cntpct_el0" : "=r" (val));
|
||||
return val;
|
||||
}
|
||||
#else
|
||||
UINT64 ticks_read(VOID) {
|
||||
UINT64 ticks_read(void) {
|
||||
UINT64 val = 1;
|
||||
return val;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__aarch64__)
|
||||
UINT64 ticks_freq(VOID) {
|
||||
UINT64 ticks_freq(void) {
|
||||
UINT64 freq;
|
||||
__asm__ volatile ("mrs %0, cntfrq_el0": "=r" (freq));
|
||||
return freq;
|
||||
}
|
||||
#else
|
||||
/* count TSC ticks during a millisecond delay */
|
||||
UINT64 ticks_freq(VOID) {
|
||||
UINT64 ticks_freq(void) {
|
||||
UINT64 ticks_start, ticks_end;
|
||||
|
||||
ticks_start = ticks_read();
|
||||
@@ -49,7 +49,7 @@ UINT64 ticks_freq(VOID) {
|
||||
}
|
||||
#endif
|
||||
|
||||
UINT64 time_usec(VOID) {
|
||||
UINT64 time_usec(void) {
|
||||
UINT64 ticks;
|
||||
static UINT64 freq;
|
||||
|
||||
@@ -95,13 +95,13 @@ EFI_STATUS parse_boolean(const CHAR8 *v, BOOLEAN *b) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, const CHAR16 *name, const VOID *buf, UINTN size, UINT32 flags) {
|
||||
EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, const CHAR16 *name, const void *buf, UINTN size, UINT32 flags) {
|
||||
assert(vendor);
|
||||
assert(name);
|
||||
assert(buf || size == 0);
|
||||
|
||||
flags |= EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
|
||||
return uefi_call_wrapper(RT->SetVariable, 5, (CHAR16*) name, (EFI_GUID *) vendor, flags, size, (VOID*) buf);
|
||||
return uefi_call_wrapper(RT->SetVariable, 5, (CHAR16*) name, (EFI_GUID *) vendor, flags, size, (void*) buf);
|
||||
}
|
||||
|
||||
EFI_STATUS efivar_set(const EFI_GUID *vendor, const CHAR16 *name, const CHAR16 *value, UINT32 flags) {
|
||||
@@ -289,7 +289,7 @@ EFI_STATUS efivar_get_boolean_u8(const EFI_GUID *vendor, const CHAR16 *name, BOO
|
||||
return err;
|
||||
}
|
||||
|
||||
VOID efivar_set_time_usec(const EFI_GUID *vendor, const CHAR16 *name, UINT64 usec) {
|
||||
void efivar_set_time_usec(const EFI_GUID *vendor, const CHAR16 *name, UINT64 usec) {
|
||||
CHAR16 str[32];
|
||||
|
||||
assert(vendor);
|
||||
@@ -488,7 +488,7 @@ EFI_STATUS file_read(EFI_FILE_HANDLE dir, const CHAR16 *name, UINTN off, UINTN s
|
||||
return err;
|
||||
}
|
||||
|
||||
VOID log_error_stall(const CHAR16 *fmt, ...) {
|
||||
void log_error_stall(const CHAR16 *fmt, ...) {
|
||||
va_list args;
|
||||
|
||||
assert(fmt);
|
||||
@@ -509,34 +509,34 @@ EFI_STATUS log_oom(void) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
VOID *memmem_safe(const VOID *haystack, UINTN haystack_len, const VOID *needle, UINTN needle_len) {
|
||||
void *memmem_safe(const void *haystack, UINTN haystack_len, const void *needle, UINTN needle_len) {
|
||||
assert(haystack || haystack_len == 0);
|
||||
assert(needle || needle_len == 0);
|
||||
|
||||
if (needle_len == 0)
|
||||
return (VOID*)haystack;
|
||||
return (void*)haystack;
|
||||
|
||||
for (const CHAR8 *h = haystack, *n = needle; haystack_len >= needle_len; h++, haystack_len--)
|
||||
if (*h == *n && CompareMem(h + 1, n + 1, needle_len - 1) == 0)
|
||||
return (VOID*)h;
|
||||
return (void*)h;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VOID print_at(UINTN x, UINTN y, UINTN attr, const CHAR16 *str) {
|
||||
void print_at(UINTN x, UINTN y, UINTN attr, const CHAR16 *str) {
|
||||
assert(str);
|
||||
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, x, y);
|
||||
uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut, attr);
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, (CHAR16*)str);
|
||||
}
|
||||
|
||||
VOID clear_screen(UINTN attr) {
|
||||
void clear_screen(UINTN attr) {
|
||||
uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut, attr);
|
||||
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
|
||||
}
|
||||
|
||||
void sort_pointer_array(
|
||||
VOID **array,
|
||||
void **array,
|
||||
UINTN n_members,
|
||||
compare_pointer_func_t compare) {
|
||||
|
||||
@@ -748,7 +748,7 @@ EFI_STATUS open_directory(
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
UINT64 get_os_indications_supported(VOID) {
|
||||
UINT64 get_os_indications_supported(void) {
|
||||
UINT64 osind;
|
||||
EFI_STATUS err;
|
||||
|
||||
|
||||
+10
-10
@@ -38,11 +38,11 @@ UINT64 ticks_freq(void);
|
||||
UINT64 time_usec(void);
|
||||
|
||||
EFI_STATUS efivar_set(const EFI_GUID *vendor, const CHAR16 *name, const CHAR16 *value, UINT32 flags);
|
||||
EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, const CHAR16 *name, const VOID *buf, UINTN size, UINT32 flags);
|
||||
EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, const CHAR16 *name, const void *buf, UINTN size, UINT32 flags);
|
||||
EFI_STATUS efivar_set_uint_string(const EFI_GUID *vendor, const CHAR16 *name, UINTN i, UINT32 flags);
|
||||
EFI_STATUS efivar_set_uint32_le(const EFI_GUID *vendor, const CHAR16 *NAME, UINT32 value, UINT32 flags);
|
||||
EFI_STATUS efivar_set_uint64_le(const EFI_GUID *vendor, const CHAR16 *name, UINT64 value, UINT32 flags);
|
||||
VOID efivar_set_time_usec(const EFI_GUID *vendor, const CHAR16 *name, UINT64 usec);
|
||||
void efivar_set_time_usec(const EFI_GUID *vendor, const CHAR16 *name, UINT64 usec);
|
||||
|
||||
EFI_STATUS efivar_get(const EFI_GUID *vendor, const CHAR16 *name, CHAR16 **value);
|
||||
EFI_STATUS efivar_get_raw(const EFI_GUID *vendor, const CHAR16 *name, CHAR8 **buffer, UINTN *size);
|
||||
@@ -84,7 +84,7 @@ static inline void FileHandleClosep(EFI_FILE_HANDLE *handle) {
|
||||
&(const EFI_GUID) { 0x4a67b082, 0x0a4c, 0x41cf, { 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f } }
|
||||
#define EFI_GLOBAL_GUID &(const EFI_GUID) EFI_GLOBAL_VARIABLE
|
||||
|
||||
VOID log_error_stall(const CHAR16 *fmt, ...);
|
||||
void log_error_stall(const CHAR16 *fmt, ...);
|
||||
EFI_STATUS log_oom(void);
|
||||
|
||||
/* This works just like log_error_errno() from userspace, but requires you
|
||||
@@ -95,18 +95,18 @@ EFI_STATUS log_oom(void);
|
||||
err; \
|
||||
})
|
||||
|
||||
VOID *memmem_safe(const VOID *haystack, UINTN haystack_len, const VOID *needle, UINTN needle_len);
|
||||
void *memmem_safe(const void *haystack, UINTN haystack_len, const void *needle, UINTN needle_len);
|
||||
|
||||
static inline VOID *mempmem_safe(const VOID *haystack, UINTN haystack_len, const VOID *needle, UINTN needle_len) {
|
||||
static inline void *mempmem_safe(const void *haystack, UINTN haystack_len, const void *needle, UINTN needle_len) {
|
||||
CHAR8 *p = memmem_safe(haystack, haystack_len, needle, needle_len);
|
||||
return p ? p + needle_len : NULL;
|
||||
}
|
||||
|
||||
VOID print_at(UINTN x, UINTN y, UINTN attr, const CHAR16 *str);
|
||||
VOID clear_screen(UINTN attr);
|
||||
void print_at(UINTN x, UINTN y, UINTN attr, const CHAR16 *str);
|
||||
void clear_screen(UINTN attr);
|
||||
|
||||
typedef INTN (*compare_pointer_func_t)(const VOID *a, const VOID *b);
|
||||
void sort_pointer_array(VOID **array, UINTN n_members, compare_pointer_func_t compare);
|
||||
typedef INTN (*compare_pointer_func_t)(const void *a, const void *b);
|
||||
void sort_pointer_array(void **array, UINTN n_members, compare_pointer_func_t compare);
|
||||
|
||||
EFI_STATUS get_file_info_harder(EFI_FILE_HANDLE handle, EFI_FILE_INFO **ret, UINTN *ret_size);
|
||||
|
||||
@@ -145,4 +145,4 @@ static inline void *PHYSICAL_ADDRESS_TO_POINTER(EFI_PHYSICAL_ADDRESS addr) {
|
||||
return (void*) (UINTN) addr;
|
||||
}
|
||||
|
||||
UINT64 get_os_indications_supported(VOID);
|
||||
UINT64 get_os_indications_supported(void);
|
||||
|
||||
@@ -203,7 +203,7 @@ static EFI_STATUS find_device(
|
||||
if (EFI_ERROR(err))
|
||||
continue;
|
||||
|
||||
err = uefi_call_wrapper(BS->HandleProtocol, 3, disk_handle, &BlockIoProtocol, (VOID **)&block_io);
|
||||
err = uefi_call_wrapper(BS->HandleProtocol, 3, disk_handle, &BlockIoProtocol, (void **)&block_io);
|
||||
if (EFI_ERROR(err))
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user