}
}
-static BOOLEAN config_entry_add_call(
- Config *config,
- const CHAR16 *id,
- const CHAR16 *title,
- EFI_STATUS (*call)(void)) {
-
- ConfigEntry *entry;
-
- assert(config);
- assert(id);
- assert(title);
- assert(call);
-
- entry = xnew(ConfigEntry, 1);
- *entry = (ConfigEntry) {
- .id = xstrdup(id),
- .title = xstrdup(title),
- .call = call,
- .tries_done = UINTN_MAX,
- .tries_left = UINTN_MAX,
- };
-
- config_add_entry(config, entry);
- return TRUE;
-}
-
-static ConfigEntry *config_entry_add_loader(
- Config *config,
- EFI_HANDLE *device,
- enum loader_type type,
- const CHAR16 *id,
- CHAR16 key,
- const CHAR16 *title,
- const CHAR16 *loader,
- const CHAR16 *sort_key,
- const CHAR16 *version) {
-
- ConfigEntry *entry;
-
- assert(config);
- assert(device);
- assert(id);
- assert(title);
- assert(loader);
-
- entry = xnew(ConfigEntry, 1);
- *entry = (ConfigEntry) {
- .type = type,
- .title = xstrdup(title),
- .version = version ? xstrdup(version) : NULL,
- .device = device,
- .loader = xstrdup(loader),
- .id = xstrdup(id),
- .sort_key = sort_key ? xstrdup(sort_key) : NULL,
- .key = key,
- .tries_done = UINTN_MAX,
- .tries_left = UINTN_MAX,
- };
-
- StrLwr(entry->id);
-
- config_add_entry(config, entry);
- return entry;
-}
-
static BOOLEAN is_sd_boot(EFI_FILE *root_dir, const CHAR16 *loader_path) {
EFI_STATUS err;
const CHAR8 *sections[] = {
if (EFI_ERROR(err))
return NULL;
- return config_entry_add_loader(config, device, LOADER_AUTO, id, key, title, loader, NULL, NULL);
+ ConfigEntry *entry = xnew(ConfigEntry, 1);
+ *entry = (ConfigEntry) {
+ .id = xstrdup(id),
+ .type = LOADER_AUTO,
+ .title = xstrdup(title),
+ .device = device,
+ .loader = xstrdup(loader),
+ .key = key,
+ .tries_done = UINTN_MAX,
+ .tries_left = UINTN_MAX,
+ };
+
+ config_add_entry(config, entry);
+ return entry;
}
static void config_entry_add_osx(Config *config) {
_cleanup_(file_closep) EFI_FILE *linux_dir = NULL;
_cleanup_freepool_ EFI_FILE_INFO *f = NULL;
- ConfigEntry *entry;
UINTN f_size = 0;
EFI_STATUS err;
};
_cleanup_freepool_ CHAR16 *os_pretty_name = NULL, *os_image_id = NULL, *os_name = NULL, *os_id = NULL,
- *os_image_version = NULL, *os_version = NULL, *os_version_id = NULL, *os_build_id = NULL,
- *path = NULL;
+ *os_image_version = NULL, *os_version = NULL, *os_version_id = NULL, *os_build_id = NULL;
const CHAR16 *good_name, *good_version, *good_sort_key;
_cleanup_freepool_ CHAR8 *content = NULL;
UINTN offs[_SECTION_MAX] = {};
&good_sort_key))
continue;
- path = xpool_print(L"\\EFI\\Linux\\%s", f->FileName);
- entry = config_entry_add_loader(
- config,
- device,
- LOADER_UNIFIED_LINUX,
- /* id= */ f->FileName,
- /* key= */ 'l',
- /* title= */ good_name,
- /* loader= */ path,
- /* sort_key= */ good_sort_key,
- good_version);
+ ConfigEntry *entry = xnew(ConfigEntry, 1);
+ *entry = (ConfigEntry) {
+ .id = xstrdup(f->FileName),
+ .type = LOADER_UNIFIED_LINUX,
+ .title = xstrdup(good_name),
+ .version = good_version ? xstrdup(good_version) : NULL,
+ .device = device,
+ .loader = xpool_print(L"\\EFI\\Linux\\%s", f->FileName),
+ .sort_key = good_sort_key ? xstrdup(good_sort_key) : NULL,
+ .key = 'l',
+ .tries_done = UINTN_MAX,
+ .tries_left = UINTN_MAX,
+ };
+ StrLwr(entry->id);
+ config_add_entry(config, entry);
config_entry_parse_tries(entry, L"\\EFI\\Linux", f->FileName, L".efi");
if (szs[SECTION_CMDLINE] == 0)
config_entry_add_loader_auto(config, loaded_image->DeviceHandle, root_dir, loaded_image_path,
L"auto-efi-default", '\0', L"EFI Default Loader", NULL);
- if (config->auto_firmware && FLAGS_SET(get_os_indications_supported(), EFI_OS_INDICATIONS_BOOT_TO_FW_UI))
- config_entry_add_call(config,
- L"auto-reboot-to-firmware-setup",
- L"Reboot Into Firmware Interface",
- reboot_into_firmware);
+ if (config->auto_firmware && FLAGS_SET(get_os_indications_supported(), EFI_OS_INDICATIONS_BOOT_TO_FW_UI)) {
+ ConfigEntry *entry = xnew(ConfigEntry, 1);
+ *entry = (ConfigEntry) {
+ .id = xstrdup(L"auto-reboot-to-firmware-setup"),
+ .title = xstrdup(L"Reboot Into Firmware Interface"),
+ .call = reboot_into_firmware,
+ .tries_done = UINTN_MAX,
+ .tries_left = UINTN_MAX,
+ };
+ config_add_entry(config, entry);
+ }
if (config->entry_count == 0)
return;