From 199989e168ee070849e1c13ad3c450093c3ad64d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 7 Jul 2025 15:52:17 +0200 Subject: [PATCH] bootspec: rename boot_entry_type_to_string() to boot_entry_type_description_to_string() This helper does not translate BootEntryType to a string matching the enum's value names, but instead returns a human readable descriptive string. Let's make it clearer what this, by including "description" in the name. --- src/shared/bootspec.c | 6 +++--- src/shared/bootspec.h | 2 +- src/vmspawn/vmspawn.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index bac00c5b3ca..59ab33a19b0 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -32,14 +32,14 @@ #include "strv.h" #include "uki.h" -static const char* const boot_entry_type_table[_BOOT_ENTRY_TYPE_MAX] = { +static const char* const boot_entry_type_description_table[_BOOT_ENTRY_TYPE_MAX] = { [BOOT_ENTRY_CONF] = "Boot Loader Specification Type #1 (.conf)", [BOOT_ENTRY_UNIFIED] = "Boot Loader Specification Type #2 (.efi)", [BOOT_ENTRY_LOADER] = "Reported by Boot Loader", [BOOT_ENTRY_LOADER_AUTO] = "Automatic", }; -DEFINE_STRING_TABLE_LOOKUP_TO_STRING(boot_entry_type, BootEntryType); +DEFINE_STRING_TABLE_LOOKUP_TO_STRING(boot_entry_type_description, BootEntryType); static const char* const boot_entry_type_json_table[_BOOT_ENTRY_TYPE_MAX] = { [BOOT_ENTRY_CONF] = "type1", @@ -1823,7 +1823,7 @@ int show_boot_entry( assert(e); printf(" type: %s\n", - boot_entry_type_to_string(e->type)); + boot_entry_type_description_to_string(e->type)); printf(" title: %s%s%s", ansi_highlight(), boot_entry_title(e), ansi_normal()); diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h index e0c561808c7..f73ca627c5c 100644 --- a/src/shared/bootspec.h +++ b/src/shared/bootspec.h @@ -91,7 +91,7 @@ typedef struct BootConfig { .selected_entry = -1, \ } -const char* boot_entry_type_to_string(BootEntryType) _const_; +const char* boot_entry_type_description_to_string(BootEntryType) _const_; const char* boot_entry_type_json_to_string(BootEntryType) _const_; const char* boot_entry_source_to_string(BootEntrySource) _const_; diff --git a/src/vmspawn/vmspawn.c b/src/vmspawn/vmspawn.c index 49833ec49fc..6a7a34d35be 100644 --- a/src/vmspawn/vmspawn.c +++ b/src/vmspawn/vmspawn.c @@ -1373,7 +1373,7 @@ static int discover_boot_entry(const char *root, char **ret_linux, char ***ret_i if (!boot_entry) return log_error_errno(SYNTHETIC_ERRNO(ENOENT), "Failed to discover any boot entries."); - log_debug("Discovered boot entry %s (%s)", boot_entry->id, boot_entry_type_to_string(boot_entry->type)); + log_debug("Discovered boot entry %s (%s)", boot_entry->id, boot_entry_type_description_to_string(boot_entry->type)); _cleanup_free_ char *linux_kernel = NULL; _cleanup_strv_free_ char **initrds = NULL; -- 2.47.3