[PATCH] efi_loader: remove EFI_CALL from efi_file_from_path()
Heinrich Schuchardt
xypron.glpk at gmx.de
Thu Nov 10 14:26:45 CET 2022
On 11/10/22 14:11, Ilias Apalodimas wrote:
> We now have internal functions for OpenVolume, EFI_FILE_PROTOCOL.Open()
> and EFI_FILE_PROTOCOL.Close(). So use these instead of wrapping the
> callsites with EFI_CALL()
>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> ---
> lib/efi_loader/efi_file.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
> index c96a7f7ca371..8480ed3007c7 100644
> --- a/lib/efi_loader/efi_file.c
> +++ b/lib/efi_loader/efi_file.c
> @@ -1111,7 +1111,7 @@ struct efi_file_handle *efi_file_from_path(struct efi_device_path *fp)
> if (!v)
> return NULL;
>
> - EFI_CALL(ret = v->open_volume(v, &f));
> + ret = efi_open_volume_int(v, &f);
> if (ret != EFI_SUCCESS)
> return NULL;
>
> @@ -1131,22 +1131,21 @@ struct efi_file_handle *efi_file_from_path(struct efi_device_path *fp)
>
> if (!EFI_DP_TYPE(fp, MEDIA_DEVICE, FILE_PATH)) {
> printf("bad file path!\n");
> - f->close(f);
> + efi_file_close_int(f);
> return NULL;
> }
>
> filename = u16_strdup(fdp->str);
> if (!filename)
> return NULL;
> - EFI_CALL(ret = f->open(f, &f2, filename,
> - EFI_FILE_MODE_READ, 0));
> + ret = efi_file_open_int(f, &f2, filename, EFI_FILE_MODE_READ, 0);
> free(filename);
> if (ret != EFI_SUCCESS)
> return NULL;
>
> fp = efi_dp_next(fp);
>
> - EFI_CALL(f->close(f));
> + efi_file_close_int(f);
We should not assume that the FileProtocol() is implemented by U-Boot.
An EFI binary that we execute may have implement its own simple file
system protocol and file protocol and then call LoadImage() on it.
We do exactly this in lib/efi_selftest/efi_selftest_loadimage.c.
Best regards
Heinrich
> f = f2;
> }
>
More information about the U-Boot
mailing list