#include "uki.h"
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 (UKI, .efi)",
- [BOOT_ENTRY_LOADER] = "Reported by Boot Loader",
- [BOOT_ENTRY_LOADER_AUTO] = "Automatic",
+ [BOOT_ENTRY_TYPE1] = "Boot Loader Specification Type #1 (.conf)",
+ [BOOT_ENTRY_TYPE2] = "Boot Loader Specification Type #2 (UKI, .efi)",
+ [BOOT_ENTRY_LOADER] = "Reported by Boot Loader",
+ [BOOT_ENTRY_AUTO] = "Automatic",
};
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",
- [BOOT_ENTRY_UNIFIED] = "type2",
- [BOOT_ENTRY_LOADER] = "loader",
- [BOOT_ENTRY_LOADER_AUTO] = "auto",
+static const char* const boot_entry_type_table[_BOOT_ENTRY_TYPE_MAX] = {
+ [BOOT_ENTRY_TYPE1] = "type1",
+ [BOOT_ENTRY_TYPE2] = "type2",
+ [BOOT_ENTRY_LOADER] = "loader",
+ [BOOT_ENTRY_AUTO] = "auto",
};
-DEFINE_STRING_TABLE_LOOKUP_TO_STRING(boot_entry_type_json, BootEntryType);
+DEFINE_STRING_TABLE_LOOKUP_TO_STRING(boot_entry_type, BootEntryType);
static const char* const boot_entry_source_table[_BOOT_ENTRY_SOURCE_MAX] = {
[BOOT_ENTRY_ESP] = "EFI System Partition",
const char *fname,
BootEntry *ret) {
- _cleanup_(boot_entry_free) BootEntry tmp = BOOT_ENTRY_INIT(BOOT_ENTRY_CONF, source);
+ _cleanup_(boot_entry_free) BootEntry tmp = BOOT_ENTRY_INIT(BOOT_ENTRY_TYPE1, source);
char *c;
int r;
if (r < 0)
return log_error_errno(r, "Failed to extract file name from '%s': %m", path);
- _cleanup_(boot_entry_free) BootEntry tmp = BOOT_ENTRY_INIT(BOOT_ENTRY_UNIFIED, source);
+ _cleanup_(boot_entry_free) BootEntry tmp = BOOT_ENTRY_INIT(BOOT_ENTRY_TYPE2, source);
r = boot_filename_extract_tries(fname, &tmp.id, &tmp.tries_left, &tmp.tries_done);
if (r < 0)
return log_oom();
config->entries[config->n_entries++] = (BootEntry) {
- .type = startswith(*i, "auto-") ? BOOT_ENTRY_LOADER_AUTO : BOOT_ENTRY_LOADER,
+ .type = startswith(*i, "auto-") ? BOOT_ENTRY_AUTO : BOOT_ENTRY_LOADER,
.id = TAKE_PTR(c),
.title = TAKE_PTR(t),
.path = TAKE_PTR(p),
if (e->type == BOOT_ENTRY_LOADER)
printf(" %s(reported/absent)%s",
ansi_highlight_red(), ansi_normal());
- else if (!e->reported_by_loader && e->type != BOOT_ENTRY_LOADER_AUTO)
+ else if (!e->reported_by_loader && e->type != BOOT_ENTRY_AUTO)
printf(" %s(not reported/new)%s",
ansi_highlight_green(), ansi_normal());
}
/* Let's urlify the link to make it easy to view in an editor, but only if it is a text
* file. Unified images are binary ELFs, and EFI variables are not pure text either. */
- if (e->type == BOOT_ENTRY_CONF)
+ if (e->type == BOOT_ENTRY_TYPE1)
(void) terminal_urlify_path(e->path, text, &link);
printf(" source: %s (on the %s)\n",
r = sd_json_variant_merge_objectbo(
&v,
- SD_JSON_BUILD_PAIR("type", SD_JSON_BUILD_STRING(boot_entry_type_json_to_string(e->type))),
+ SD_JSON_BUILD_PAIR("type", SD_JSON_BUILD_STRING(boot_entry_type_to_string(e->type))),
SD_JSON_BUILD_PAIR("source", SD_JSON_BUILD_STRING(boot_entry_source_json_to_string(e->source))),
SD_JSON_BUILD_PAIR_CONDITION(!!e->id, "id", SD_JSON_BUILD_STRING(e->id)),
SD_JSON_BUILD_PAIR_CONDITION(!!e->path, "path", SD_JSON_BUILD_STRING(e->path)),
#include "forward.h"
typedef enum BootEntryType {
- BOOT_ENTRY_CONF, /* Boot Loader Specification Type #1 entries: *.conf files */
- BOOT_ENTRY_UNIFIED, /* Boot Loader Specification Type #2 entries: *.efi files */
- BOOT_ENTRY_LOADER, /* Additional entries augmented from LoaderEntries EFI variable (regular entries) */
- BOOT_ENTRY_LOADER_AUTO, /* Additional entries augmented from LoaderEntries EFI variable (special "automatic" entries) */
+ BOOT_ENTRY_TYPE1, /* Boot Loader Specification Type #1 entries: *.conf files */
+ BOOT_ENTRY_TYPE2, /* Boot Loader Specification Type #2 entries: *.efi files (UKIs) */
+ BOOT_ENTRY_LOADER, /* Additional entries augmented from LoaderEntries EFI variable (regular entries) */
+ BOOT_ENTRY_AUTO, /* Additional entries augmented from LoaderEntries EFI variable (special "automatic" entries) */
_BOOT_ENTRY_TYPE_MAX,
_BOOT_ENTRY_TYPE_INVALID = -EINVAL,
} BootEntryType;
}
const char* boot_entry_type_description_to_string(BootEntryType) _const_;
-const char* boot_entry_type_json_to_string(BootEntryType) _const_;
+const char* boot_entry_type_to_string(BootEntryType) _const_;
const char* boot_entry_source_to_string(BootEntrySource) _const_;
const char* boot_entry_source_json_to_string(BootEntrySource) _const_;
const BootEntry *boot_entry = boot_config_default_entry(&config);
- if (boot_entry && !IN_SET(boot_entry->type, BOOT_ENTRY_UNIFIED, BOOT_ENTRY_CONF))
+ if (boot_entry && !IN_SET(boot_entry->type, BOOT_ENTRY_TYPE1, BOOT_ENTRY_TYPE2))
boot_entry = NULL;
/* If we cannot determine a default entry search for UKIs (Type #2 EFI Unified Kernel Images)
* https://uapi-group.org/specifications/specs/boot_loader_specification */
if (!boot_entry)
FOREACH_ARRAY(entry, config.entries, config.n_entries)
- if (entry->type == BOOT_ENTRY_UNIFIED) {
+ if (entry->type == BOOT_ENTRY_TYPE2) { /* UKI */
boot_entry = entry;
break;
}
if (!boot_entry)
FOREACH_ARRAY(entry, config.entries, config.n_entries)
- if (entry->type == BOOT_ENTRY_CONF) {
+ if (entry->type == BOOT_ENTRY_TYPE1) { /* .conf */
boot_entry = entry;
break;
}
_cleanup_free_ char *linux_kernel = NULL;
_cleanup_strv_free_ char **initrds = NULL;
- if (boot_entry->type == BOOT_ENTRY_UNIFIED) {
+ if (boot_entry->type == BOOT_ENTRY_TYPE2) { /* UKI */
linux_kernel = path_join(boot_entry->root, boot_entry->kernel);
if (!linux_kernel)
return log_oom();
- } else if (boot_entry->type == BOOT_ENTRY_CONF) {
+ } else if (boot_entry->type == BOOT_ENTRY_TYPE1) { /* .conf */
linux_kernel = path_join(boot_entry->root, boot_entry->kernel);
if (!linux_kernel)
return log_oom();