for (UINTN i = 0; i < config->entry_count; i++) {
ConfigEntry *entry = config->entries[i];
+ _cleanup_free_ char16_t *dp = NULL;
+ if (entry->device)
+ (void) device_path_to_str(DevicePathFromHandle(entry->device), &dp);
+
Print(L" config entry: %" PRIuN L"/%" PRIuN L"\n", i + 1, config->entry_count);
ps_string(L" id: %s\n", entry->id);
ps_string(L" title: %s\n", entry->title);
ps_string(L" sort key: %s\n", entry->sort_key);
ps_string(L" version: %s\n", entry->version);
ps_string(L" machine-id: %s\n", entry->machine_id);
- if (entry->device)
- Print(L" device: %D\n", DevicePathFromHandle(entry->device));
+ ps_string(L" device: %s\n", dp);
ps_string(L" loader: %s\n", entry->loader);
STRV_FOREACH(initrd, entry->initrd)
Print(L" initrd: %s\n", *initrd);
if (err != EFI_SUCCESS)
return log_error_status_stall(err, L"Error getting a LoadedImageProtocol handle: %r", err);
- loaded_image_path = DevicePathToStr(loaded_image->FilePath);
- if (!loaded_image_path)
- return log_oom();
+ err = device_path_to_str(loaded_image->FilePath, &loaded_image_path);
+ if (err != EFI_SUCCESS)
+ return log_error_status_stall(err, L"Error getting loaded image path: %m");
export_variables(loaded_image, loaded_image_path, init_usec);
return log_error_status_stall(
err, L"Unable to open root directory: %r", err);
- if (!dropin_dir)
- dropin_dir = rel_dropin_dir = xpool_print(L"%D.extra.d", loaded_image->FilePath);
+ if (!dropin_dir) {
+ _cleanup_free_ char16_t *file_path = NULL;
+ err = device_path_to_str(loaded_image->FilePath, &file_path);
+ if (err != EFI_SUCCESS)
+ goto nothing;
+ dropin_dir = rel_dropin_dir = xpool_print(u"%s.extra.d", file_path);
+ }
err = open_directory(root, dropin_dir, &extra_dir);
if (err == EFI_NOT_FOUND)
if (err != EFI_SUCCESS)
return err;
- dev_path_str = DevicePathToStr(dp);
- if (!dev_path_str)
- return EFI_OUT_OF_RESOURCES;
+ err = device_path_to_str(dp, &dev_path_str);
+ if (err != EFI_SUCCESS)
+ return err;
err = file_read(root, dev_path_str, 0, 0, &file_buffer, &file_size);
if (err != EFI_SUCCESS)
if (efivar_get_raw(LOADER_GUID, L"LoaderImageIdentifier", NULL, NULL) != EFI_SUCCESS &&
loaded_image->FilePath) {
_cleanup_free_ char16_t *s = NULL;
-
- s = DevicePathToStr(loaded_image->FilePath);
- if (s)
+ if (device_path_to_str(loaded_image->FilePath, &s) == EFI_SUCCESS)
efivar_set(LOADER_GUID, L"LoaderImageIdentifier", s, 0);
- else
- log_oom();
}
/* if LoaderFirmwareInfo is not set, let's set it */