X Tutup
Skip to content

Commit 70cd15e

Browse files
committed
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.
1 parent f694340 commit 70cd15e

File tree

22 files changed

+150
-150
lines changed

22 files changed

+150
-150
lines changed

src/boot/efi/boot.c

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ typedef struct {
4646
CHAR16 *devicetree;
4747
CHAR16 *options;
4848
CHAR16 key;
49-
EFI_STATUS (*call)(VOID);
49+
EFI_STATUS (*call)(void);
5050
BOOLEAN no_autoselect;
5151
BOOLEAN non_unique;
5252
UINTN tries_done;
@@ -88,7 +88,7 @@ enum {
8888
TIMEOUT_TYPE_MAX = UINT32_MAX,
8989
};
9090

91-
static VOID cursor_left(UINTN *cursor, UINTN *first) {
91+
static void cursor_left(UINTN *cursor, UINTN *first) {
9292
assert(cursor);
9393
assert(first);
9494

@@ -98,7 +98,7 @@ static VOID cursor_left(UINTN *cursor, UINTN *first) {
9898
(*first)--;
9999
}
100100

101-
static VOID cursor_right(
101+
static void cursor_right(
102102
UINTN *cursor,
103103
UINTN *first,
104104
UINTN x_max,
@@ -428,7 +428,7 @@ static void ps_bool(const CHAR16 *fmt, BOOLEAN value) {
428428
Print(fmt, yes_no(value));
429429
}
430430

431-
static VOID print_status(Config *config, CHAR16 *loaded_image_path) {
431+
static void print_status(Config *config, CHAR16 *loaded_image_path) {
432432
UINT64 key;
433433
UINTN x_max, y_max;
434434
BOOLEAN setup_mode = FALSE;
@@ -440,9 +440,9 @@ static VOID print_status(Config *config, CHAR16 *loaded_image_path) {
440440
clear_screen(COLOR_NORMAL);
441441
console_query_mode(&x_max, &y_max);
442442

443-
(VOID) efivar_get(LOADER_GUID, L"LoaderDevicePartUUID", &device_part_uuid);
444-
(VOID) efivar_get(LOADER_GUID, L"LoaderEntryDefault", &default_efivar);
445-
(VOID) efivar_get_boolean_u8(EFI_GLOBAL_GUID, L"SetupMode", &setup_mode);
443+
(void) efivar_get(LOADER_GUID, L"LoaderDevicePartUUID", &device_part_uuid);
444+
(void) efivar_get(LOADER_GUID, L"LoaderEntryDefault", &default_efivar);
445+
(void) efivar_get_boolean_u8(EFI_GLOBAL_GUID, L"SetupMode", &setup_mode);
446446

447447
/* We employ some unusual indentation here for readability. */
448448

@@ -933,21 +933,21 @@ static BOOLEAN menu_run(
933933
return run;
934934
}
935935

936-
static VOID config_add_entry(Config *config, ConfigEntry *entry) {
936+
static void config_add_entry(Config *config, ConfigEntry *entry) {
937937
assert(config);
938938
assert(entry);
939939

940940
if ((config->entry_count & 15) == 0) {
941941
UINTN i = config->entry_count + 16;
942942
config->entries = ReallocatePool(
943943
config->entries,
944-
sizeof(VOID *) * config->entry_count,
945-
sizeof(VOID *) * i);
944+
sizeof(void *) * config->entry_count,
945+
sizeof(void *) * i);
946946
}
947947
config->entries[config->entry_count++] = entry;
948948
}
949949

950-
static VOID config_entry_free(ConfigEntry *entry) {
950+
static void config_entry_free(ConfigEntry *entry) {
951951
if (!entry)
952952
return;
953953

@@ -965,7 +965,7 @@ static VOID config_entry_free(ConfigEntry *entry) {
965965
FreePool(entry);
966966
}
967967

968-
static inline VOID config_entry_freep(ConfigEntry **entry) {
968+
static inline void config_entry_freep(ConfigEntry **entry) {
969969
config_entry_free(*entry);
970970
}
971971

@@ -1042,7 +1042,7 @@ static CHAR8 *line_get_key_value(
10421042
return line;
10431043
}
10441044

1045-
static VOID config_defaults_load_from_file(Config *config, CHAR8 *content) {
1045+
static void config_defaults_load_from_file(Config *config, CHAR8 *content) {
10461046
CHAR8 *line;
10471047
UINTN pos = 0;
10481048
CHAR8 *key, *value;
@@ -1134,7 +1134,7 @@ static VOID config_defaults_load_from_file(Config *config, CHAR8 *content) {
11341134
}
11351135
}
11361136

1137-
static VOID config_entry_parse_tries(
1137+
static void config_entry_parse_tries(
11381138
ConfigEntry *entry,
11391139
const CHAR16 *path,
11401140
const CHAR16 *file,
@@ -1253,7 +1253,7 @@ static VOID config_entry_parse_tries(
12531253
entry->next_name = PoolPrint(L"%s+%u-%u%s", prefix, next_left, next_done, suffix ?: L"");
12541254
}
12551255

1256-
static VOID config_entry_bump_counters(
1256+
static void config_entry_bump_counters(
12571257
ConfigEntry *entry,
12581258
EFI_FILE_HANDLE root_dir) {
12591259

@@ -1306,7 +1306,7 @@ static VOID config_entry_bump_counters(
13061306
}
13071307
}
13081308

1309-
static VOID config_entry_add_from_file(
1309+
static void config_entry_add_from_file(
13101310
Config *config,
13111311
EFI_HANDLE *device,
13121312
EFI_FILE *root_dir,
@@ -1456,7 +1456,7 @@ static VOID config_entry_add_from_file(
14561456
TAKE_PTR(entry);
14571457
}
14581458

1459-
static VOID config_load_defaults(Config *config, EFI_FILE *root_dir) {
1459+
static void config_load_defaults(Config *config, EFI_FILE *root_dir) {
14601460
_cleanup_freepool_ CHAR8 *content = NULL;
14611461
UINTN value;
14621462
EFI_STATUS err;
@@ -1499,7 +1499,7 @@ static VOID config_load_defaults(Config *config, EFI_FILE *root_dir) {
14991499
config->console_mode_efivar = value;
15001500
}
15011501

1502-
static VOID config_load_entries(
1502+
static void config_load_entries(
15031503
Config *config,
15041504
EFI_HANDLE *device,
15051505
EFI_FILE *root_dir,
@@ -1576,7 +1576,7 @@ static INTN config_entry_compare(const ConfigEntry *a, const ConfigEntry *b) {
15761576
return 0;
15771577
}
15781578

1579-
static VOID config_sort_entries(Config *config) {
1579+
static void config_sort_entries(Config *config) {
15801580
assert(config);
15811581

15821582
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) {
15931593
return -1;
15941594
}
15951595

1596-
static VOID config_default_entry_select(Config *config) {
1596+
static void config_default_entry_select(Config *config) {
15971597
_cleanup_freepool_ CHAR16 *entry_default = NULL;
15981598
EFI_STATUS err;
15991599
INTN i;
@@ -1682,7 +1682,7 @@ static BOOLEAN find_nonunique(ConfigEntry **entries, UINTN entry_count) {
16821682
}
16831683

16841684
/* generate a unique title, avoiding non-distinguishable menu entries */
1685-
static VOID config_title_generate(Config *config) {
1685+
static void config_title_generate(Config *config) {
16861686
assert(config);
16871687

16881688
/* set title */
@@ -1753,7 +1753,7 @@ static BOOLEAN config_entry_add_call(
17531753
Config *config,
17541754
const CHAR16 *id,
17551755
const CHAR16 *title,
1756-
EFI_STATUS (*call)(VOID)) {
1756+
EFI_STATUS (*call)(void)) {
17571757

17581758
ConfigEntry *entry;
17591759

@@ -1890,7 +1890,7 @@ static BOOLEAN config_entry_add_loader_auto(
18901890
return TRUE;
18911891
}
18921892

1893-
static VOID config_entry_add_osx(Config *config) {
1893+
static void config_entry_add_osx(Config *config) {
18941894
EFI_STATUS err;
18951895
UINTN handle_count = 0;
18961896
_cleanup_freepool_ EFI_HANDLE *handles = NULL;
@@ -1918,7 +1918,7 @@ static VOID config_entry_add_osx(Config *config) {
19181918
}
19191919
}
19201920

1921-
static VOID config_entry_add_windows(Config *config, EFI_HANDLE *device, EFI_FILE *root_dir) {
1921+
static void config_entry_add_windows(Config *config, EFI_HANDLE *device, EFI_FILE *root_dir) {
19221922
_cleanup_freepool_ CHAR8 *bcd = NULL;
19231923
const CHAR16 *title = NULL;
19241924
EFI_STATUS err;
@@ -1967,7 +1967,7 @@ static VOID config_entry_add_windows(Config *config, EFI_HANDLE *device, EFI_FIL
19671967
L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi");
19681968
}
19691969

1970-
static VOID config_entry_add_linux(
1970+
static void config_entry_add_linux(
19711971
Config *config,
19721972
EFI_HANDLE *device,
19731973
EFI_FILE *root_dir) {
@@ -2102,7 +2102,7 @@ static VOID config_entry_add_linux(
21022102
}
21032103
}
21042104

2105-
static VOID config_load_xbootldr(
2105+
static void config_load_xbootldr(
21062106
Config *config,
21072107
EFI_HANDLE *device) {
21082108

@@ -2159,7 +2159,7 @@ static EFI_STATUS image_start(
21592159
if (options) {
21602160
EFI_LOADED_IMAGE *loaded_image;
21612161

2162-
err = uefi_call_wrapper(BS->OpenProtocol, 6, image, &LoadedImageProtocol, (VOID **)&loaded_image,
2162+
err = uefi_call_wrapper(BS->OpenProtocol, 6, image, &LoadedImageProtocol, (void **)&loaded_image,
21632163
parent_image, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
21642164
if (EFI_ERROR(err)) {
21652165
log_error_stall(L"Error getting LoadedImageProtocol handle: %r", err);
@@ -2169,7 +2169,7 @@ static EFI_STATUS image_start(
21692169
loaded_image->LoadOptionsSize = StrSize(loaded_image->LoadOptions);
21702170

21712171
/* Try to log any options to the TPM, especially to catch manually edited options */
2172-
(VOID) tpm_log_load_options(options);
2172+
(void) tpm_log_load_options(options);
21732173
}
21742174

21752175
efivar_set_time_usec(LOADER_GUID, L"LoaderTimeExecUSec", 0);
@@ -2179,7 +2179,7 @@ static EFI_STATUS image_start(
21792179
return err;
21802180
}
21812181

2182-
static EFI_STATUS reboot_into_firmware(VOID) {
2182+
static EFI_STATUS reboot_into_firmware(void) {
21832183
UINT64 old, new;
21842184
EFI_STATUS err;
21852185

@@ -2197,7 +2197,7 @@ static EFI_STATUS reboot_into_firmware(VOID) {
21972197
return log_error_status_stall(err, L"Error calling ResetSystem: %r", err);
21982198
}
21992199

2200-
static VOID config_free(Config *config) {
2200+
static void config_free(Config *config) {
22012201
assert(config);
22022202
for (UINTN i = 0; i < config->entry_count; i++)
22032203
config_entry_free(config->entries[i]);
@@ -2207,7 +2207,7 @@ static VOID config_free(Config *config) {
22072207
FreePool(config->entry_oneshot);
22082208
}
22092209

2210-
static VOID config_write_entries_to_variable(Config *config) {
2210+
static void config_write_entries_to_variable(Config *config) {
22112211
_cleanup_freepool_ CHAR8 *buffer = NULL;
22122212
UINTN sz = 0;
22132213
CHAR8 *p;
@@ -2234,7 +2234,7 @@ static VOID config_write_entries_to_variable(Config *config) {
22342234
(void) efivar_set_raw(LOADER_GUID, L"LoaderEntries", buffer, sz, 0);
22352235
}
22362236

2237-
static VOID export_variables(
2237+
static void export_variables(
22382238
EFI_LOADED_IMAGE *loaded_image,
22392239
const CHAR16 *loaded_image_path,
22402240
UINT64 init_usec) {
@@ -2275,7 +2275,7 @@ static VOID export_variables(
22752275
efivar_set(LOADER_GUID, L"LoaderDevicePartUUID", uuid, 0);
22762276
}
22772277

2278-
static VOID config_load_all_entries(
2278+
static void config_load_all_entries(
22792279
Config *config,
22802280
EFI_LOADED_IMAGE *loaded_image,
22812281
const CHAR16 *loaded_image_path,
@@ -2331,7 +2331,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
23312331
BS->OpenProtocol, 6,
23322332
image,
23332333
&LoadedImageProtocol,
2334-
(VOID **)&loaded_image,
2334+
(void **)&loaded_image,
23352335
image,
23362336
NULL,
23372337
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
@@ -2354,7 +2354,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
23542354
return log_error_status_stall(err, L"Error installing security policy: %r", err);
23552355
}
23562356

2357-
(VOID) load_drivers(image, loaded_image, root_dir);
2357+
(void) load_drivers(image, loaded_image, root_dir);
23582358

23592359
config_load_all_entries(&config, loaded_image, loaded_image_path, root_dir);
23602360

@@ -2416,10 +2416,10 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
24162416
config_entry_bump_counters(entry, root_dir);
24172417

24182418
/* Export the selected boot entry to the system */
2419-
(VOID) efivar_set(LOADER_GUID, L"LoaderEntrySelected", entry->id, 0);
2419+
(void) efivar_set(LOADER_GUID, L"LoaderEntrySelected", entry->id, 0);
24202420

24212421
/* Optionally, read a random seed off the ESP and pass it to the OS */
2422-
(VOID) process_random_seed(root_dir, config.random_seed_mode);
2422+
(void) process_random_seed(root_dir, config.random_seed_mode);
24232423

24242424
err = image_start(root_dir, image, &config, entry);
24252425
if (EFI_ERROR(err)) {

src/boot/efi/console.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ EFI_STATUS console_key_read(UINT64 *key, UINT64 timeout_usec) {
5050
assert(key);
5151

5252
if (!checked) {
53-
err = LibLocateProtocol((EFI_GUID*) EFI_SIMPLE_TEXT_INPUT_EX_GUID, (VOID **)&TextInputEx);
53+
err = LibLocateProtocol((EFI_GUID*) EFI_SIMPLE_TEXT_INPUT_EX_GUID, (void **)&TextInputEx);
5454
if (EFI_ERROR(err) ||
5555
uefi_call_wrapper(BS->CheckEvent, 1, TextInputEx->WaitForKeyEx) == EFI_INVALID_PARAMETER)
5656
/* If WaitForKeyEx fails here, the firmware pretends it talks this
@@ -167,7 +167,7 @@ static INT64 get_auto_mode(void) {
167167
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
168168
EFI_STATUS err;
169169

170-
err = LibLocateProtocol(&GraphicsOutputProtocol, (VOID **)&GraphicsOutput);
170+
err = LibLocateProtocol(&GraphicsOutputProtocol, (void **)&GraphicsOutput);
171171
if (!EFI_ERROR(err) && GraphicsOutput->Mode && GraphicsOutput->Mode->Info) {
172172
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info = GraphicsOutput->Mode->Info;
173173
BOOLEAN keep = FALSE;

src/boot/efi/cpio.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ static CHAR8* pad4(CHAR8 *p, const CHAR8* start) {
5353

5454
static EFI_STATUS pack_cpio_one(
5555
const CHAR16 *fname,
56-
const VOID *contents,
56+
const void *contents,
5757
UINTN contents_size,
5858
const CHAR8 *target_dir_prefix,
5959
UINT32 access_mode,
6060
UINT32 *inode_counter,
61-
VOID **cpio_buffer,
61+
void **cpio_buffer,
6262
UINTN *cpio_buffer_size) {
6363

6464
UINTN l, target_dir_prefix_size, fname_size, q;
@@ -167,7 +167,7 @@ static EFI_STATUS pack_cpio_dir(
167167
const CHAR8 *path,
168168
UINT32 access_mode,
169169
UINT32 *inode_counter,
170-
VOID **cpio_buffer,
170+
void **cpio_buffer,
171171
UINTN *cpio_buffer_size) {
172172

173173
UINTN l, path_size;
@@ -238,7 +238,7 @@ static EFI_STATUS pack_cpio_prefix(
238238
const CHAR8 *path,
239239
UINT32 dir_mode,
240240
UINT32 *inode_counter,
241-
VOID **cpio_buffer,
241+
void **cpio_buffer,
242242
UINTN *cpio_buffer_size) {
243243

244244
EFI_STATUS err;
@@ -278,7 +278,7 @@ static EFI_STATUS pack_cpio_prefix(
278278
}
279279

280280
static EFI_STATUS pack_cpio_trailer(
281-
VOID **cpio_buffer,
281+
void **cpio_buffer,
282282
UINTN *cpio_buffer_size) {
283283

284284
static const char trailer[] =
@@ -298,7 +298,7 @@ static EFI_STATUS pack_cpio_trailer(
298298
"00000000"
299299
"TRAILER!!!\0\0\0"; /* There's a fourth NUL byte appended here, because this is a string */
300300

301-
VOID *a;
301+
void *a;
302302

303303
/* Generates the cpio trailer record that indicates the end of our initrd cpio archive */
304304

@@ -325,15 +325,15 @@ EFI_STATUS pack_cpio(
325325
UINT32 access_mode,
326326
UINTN tpm_pcr,
327327
const CHAR16 *tpm_description,
328-
VOID **ret_buffer,
328+
void **ret_buffer,
329329
UINTN *ret_buffer_size) {
330330

331331
_cleanup_(FileHandleClosep) EFI_FILE_HANDLE root = NULL, extra_dir = NULL;
332332
UINTN dirent_size = 0, buffer_size = 0, n_items = 0, n_allocated = 0;
333333
_cleanup_freepool_ CHAR16 *loaded_image_path = NULL, *j = NULL;
334334
_cleanup_freepool_ EFI_FILE_INFO *dirent = NULL;
335335
_cleanup_(strv_freep) CHAR16 **items = NULL;
336-
_cleanup_freepool_ VOID *buffer = NULL;
336+
_cleanup_freepool_ void *buffer = NULL;
337337
UINT32 inode = 1; /* inode counter, so that each item gets a new inode */
338338
EFI_STATUS err;
339339

@@ -416,7 +416,7 @@ EFI_STATUS pack_cpio(
416416

417417
/* Now, sort the files we found, to make this uniform and stable (and to ensure the TPM measurements
418418
* are not dependent on read order) */
419-
sort_pointer_array((VOID**) items, n_items, (compare_pointer_func_t) StrCmp);
419+
sort_pointer_array((void**) items, n_items, (compare_pointer_func_t) StrCmp);
420420

421421
/* Generate the leading directory inodes right before adding the first files, to the
422422
* archive. Otherwise the cpio archive cannot be unpacked, since the leading dirs won't exist. */

0 commit comments

Comments
 (0)
X Tutup