boot: two trivial cleanups (#39093)

This commit is contained in:
Yu Watanabe
2025-09-24 23:18:00 +09:00
committed by GitHub
3 changed files with 12 additions and 12 deletions
+7 -7
View File
@@ -244,7 +244,7 @@ static char16_t* update_timeout_efivar(Config *config, bool inc) {
case TIMEOUT_MENU_HIDDEN:
return xstrdup16(u"Menu hidden. Hold down key at bootup to show menu.");
default:
return xasprintf("Menu timeout set to %u s.", (uint32_t)config->timeout_sec_efivar);
return xasprintf("Menu timeout set to %"PRIu64"s.", config->timeout_sec_efivar);
}
}
@@ -279,7 +279,7 @@ static void print_timeout_status(const char *label, uint64_t t) {
case TIMEOUT_MENU_HIDDEN:
return (void) printf("%s: menu-hidden\n", label);
default:
return (void) printf("%s: %u s\n", label, (uint32_t)t);
return (void) printf("%s: %"PRIu64"s\n", label, t);
}
}
@@ -343,7 +343,7 @@ static void print_status(Config *config, char16_t *loaded_image_path) {
printf(" reboot-on-error: %s\n", reboot_on_error_to_string(config->reboot_on_error));
printf(" secure-boot-enroll: %s\n", secure_boot_enroll_to_string(config->secure_boot_enroll));
printf(" secure-boot-enroll-action: %s\n", secure_boot_enroll_action_to_string(config->secure_boot_enroll_action));
printf("secure-boot-enroll-timeout-sec: %" PRIu64 "\n", config->secure_boot_enroll_timeout_sec);
printf("secure-boot-enroll-timeout-sec: %"PRIu64"s\n", config->secure_boot_enroll_timeout_sec);
switch (config->console_mode) {
case CONSOLE_MODE_AUTO:
@@ -477,8 +477,8 @@ static bool menu_run(
size_t x_start = 0, y_start = 0, y_status = 0, x_max, y_max;
_cleanup_strv_free_ char16_t **lines = NULL;
_cleanup_free_ char16_t *clearline = NULL, *separator = NULL, *status = NULL;
uint64_t timeout_efivar_saved = config->timeout_sec_efivar;
uint32_t timeout_remain = config->timeout_sec == TIMEOUT_MENU_FORCE ? 0 : config->timeout_sec;
uint64_t timeout_efivar_saved = config->timeout_sec_efivar,
timeout_remain = config->timeout_sec == TIMEOUT_MENU_FORCE ? 0 : config->timeout_sec;
int64_t console_mode_initial = ST->ConOut->Mode->Mode, console_mode_efivar_saved = config->console_mode_efivar;
size_t default_efivar_saved = config->idx_default_efivar;
@@ -623,7 +623,7 @@ static bool menu_run(
if (timeout_remain > 0) {
free(status);
status = xasprintf("Boot in %u s.", timeout_remain);
status = xasprintf("Boot in %"PRIu64"s.", timeout_remain);
}
if (status) {
@@ -1105,7 +1105,7 @@ static void config_defaults_load_from_file(Config *config, char *content) {
config->secure_boot_enroll_timeout_sec = ENROLL_TIMEOUT_HIDDEN;
else {
uint64_t u;
if (!parse_number8(value, &u, NULL) || u > ENROLL_TIMEOUT_TYPE_MAX) {
if (!parse_number8(value, &u, NULL) || u > ENROLL_TIMEOUT_MAX) {
log_error("Error parsing 'secure-boot-enroll-timeout-sec' config option, ignoring: %s",
value);
continue;
+1 -1
View File
@@ -94,7 +94,7 @@ EFI_STATUS secure_boot_enroll_at(EFI_FILE *root_dir, const char16_t *path, bool
printf("Warning: Enrolling custom Secure Boot keys might soft-brick your machine!\n");
for (;;) {
printf("\rEnrolling in %" PRIu64 " s, press any key to abort.", timeout_sec);
printf("\rEnrolling in %"PRIu64"s, press any key to abort.", timeout_sec);
err = console_key_read(/* ret_key= */ NULL, /* timeout_usec= */ 1000 * 1000);
if (err == EFI_NOT_READY)
+4 -4
View File
@@ -19,10 +19,10 @@ typedef enum {
} secure_boot_enroll_action;
enum {
ENROLL_TIMEOUT_HIDDEN = 0,
ENROLL_TIMEOUT_MIN = 1,
ENROLL_TIMEOUT_DEFAULT = 15,
ENROLL_TIMEOUT_TYPE_MAX = UINT32_MAX,
ENROLL_TIMEOUT_HIDDEN = 0,
ENROLL_TIMEOUT_MIN = 1,
ENROLL_TIMEOUT_DEFAULT = 15,
ENROLL_TIMEOUT_MAX = UINT32_MAX,
};
bool secure_boot_enabled(void);