diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-05-26 22:24:02 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-05-29 15:40:01 +0200 |
commit | d4bd786d69c6e9ee65cd4a7c5a9b2b4829546e10 (patch) | |
tree | 84c43110e31609b9f9cf9313bc2ba4bc9bcb91ec /src/shared | |
parent | README: add a Fossies codespell badge (diff) | |
download | systemd-d4bd786d69c6e9ee65cd4a7c5a9b2b4829546e10.tar.xz systemd-d4bd786d69c6e9ee65cd4a7c5a9b2b4829546e10.zip |
efi: cache LoaderEntries EFI variable
Based-on:
https://github.com/systemd/systemd/issues/14828#issuecomment-634202054
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/bootspec.c | 18 | ||||
-rw-r--r-- | src/shared/bootspec.h | 8 |
2 files changed, 7 insertions, 19 deletions
diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 13d7b2f160..11bba2c7ed 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -735,9 +735,12 @@ int boot_entries_load_config_auto( return boot_entries_load_config(esp_where, xbootldr_where, config); } -#if ENABLE_EFI -int boot_entries_augment_from_loader(BootConfig *config, bool only_auto) { - static const char * const title_table[] = { +int boot_entries_augment_from_loader( + BootConfig *config, + char **found_by_loader, + bool only_auto) { + + static const char *const title_table[] = { /* Pretty names for a few well-known automatically discovered entries. */ "auto-osx", "macOS", "auto-windows", "Windows Boot Manager", @@ -746,22 +749,14 @@ int boot_entries_augment_from_loader(BootConfig *config, bool only_auto) { "auto-reboot-to-firmware-setup", "Reboot Into Firmware Interface", }; - _cleanup_strv_free_ char **found_by_loader = NULL; size_t n_allocated; char **i; - int r; assert(config); /* Let's add the entries discovered by the boot loader to the end of our list, unless they are * already included there. */ - r = efi_loader_get_entries(&found_by_loader); - if (IN_SET(r, -ENOENT, -EOPNOTSUPP)) - return log_debug_errno(r, "Boot loader reported no entries."); - if (r < 0) - return log_error_errno(r, "Failed to determine entries reported by boot loader: %m"); - n_allocated = config->n_entries; STRV_FOREACH(i, found_by_loader) { @@ -803,7 +798,6 @@ int boot_entries_augment_from_loader(BootConfig *config, bool only_auto) { return 0; } -#endif /********************************************************************************/ diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h index b40680b643..1075a41d54 100644 --- a/src/shared/bootspec.h +++ b/src/shared/bootspec.h @@ -76,13 +76,7 @@ static inline BootEntry* boot_config_default_entry(BootConfig *config) { void boot_config_free(BootConfig *config); int boot_entries_load_config(const char *esp_path, const char *xbootldr_path, BootConfig *config); int boot_entries_load_config_auto(const char *override_esp_path, const char *override_xbootldr_path, BootConfig *config); -#if ENABLE_EFI -int boot_entries_augment_from_loader(BootConfig *config, bool only_auto); -#else -static inline int boot_entries_augment_from_loader(BootConfig *config, bool only_auto) { - return -EOPNOTSUPP; -} -#endif +int boot_entries_augment_from_loader(BootConfig *config, char **list, bool only_auto); static inline const char* boot_entry_title(const BootEntry *entry) { return entry->show_title ?: entry->title ?: entry->id; |