* [PATCH] efi_loader: remove EFI_CALL from efi_file_from_path()
@ 2022-11-10 13:11 Ilias Apalodimas
2022-11-10 13:26 ` Heinrich Schuchardt
0 siblings, 1 reply; 2+ messages in thread
From: Ilias Apalodimas @ 2022-11-10 13:11 UTC (permalink / raw)
To: u-boot; +Cc: heinrich.schuchardt, Ilias Apalodimas, Heinrich Schuchardt
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@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);
f = f2;
}
--
2.38.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] efi_loader: remove EFI_CALL from efi_file_from_path()
2022-11-10 13:11 [PATCH] efi_loader: remove EFI_CALL from efi_file_from_path() Ilias Apalodimas
@ 2022-11-10 13:26 ` Heinrich Schuchardt
0 siblings, 0 replies; 2+ messages in thread
From: Heinrich Schuchardt @ 2022-11-10 13:26 UTC (permalink / raw)
To: Ilias Apalodimas; +Cc: heinrich.schuchardt, u-boot
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@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;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-10 13:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10 13:11 [PATCH] efi_loader: remove EFI_CALL from efi_file_from_path() Ilias Apalodimas
2022-11-10 13:26 ` Heinrich Schuchardt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.