Hi Simon, On Thu, 12 Dec 2024 at 00:38, Simon Glass <[email protected]> wrote: > > Move this code into a function so it can be called from elsewhere. > > Signed-off-by: Simon Glass <[email protected]> > --- > > (no changes since v1) > > lib/efi_loader/efi_bootbin.c | 53 +++++++++++++++++++++++++----------- > 1 file changed, 37 insertions(+), 16 deletions(-) > > diff --git a/lib/efi_loader/efi_bootbin.c b/lib/efi_loader/efi_bootbin.c > index 7e7a6bf31aa..afb13a008c2 100644 > --- a/lib/efi_loader/efi_bootbin.c > +++ b/lib/efi_loader/efi_bootbin.c > @@ -44,12 +44,46 @@ void efi_clear_bootdev(void) > image_size = 0; > } > > +efi_status_t calculate_paths(const char *dev, const char *devnr, const char > *path, > + struct efi_device_path **device_pathp, > + struct efi_device_path **image_pathp) > + > +{ > + struct efi_device_path *image, *device; > + efi_status_t ret; > + > + ret = efi_dp_from_name(dev, devnr, path, &device, &image); > + if (ret != EFI_SUCCESS) > + return ret; > + > + *device_pathp = device; > + if (image) { > + /* FIXME: image should not contain device */ > + struct efi_device_path *image_tmp = image; > + > + efi_dp_split_file_path(image, &device, &image); > + efi_free_pool(image_tmp); > + } > + *image_pathp = image; > + log_debug("- boot device %pD\n", device); > + if (image) > + log_debug("- image %pD\n", image); > + > + return EFI_SUCCESS; > +}
This needs an entry in a header file and a description. Also, we usually keep DP related functions to lib/efi_loader/efi_device_path.c [...] Thanks /Ilias

