[PATCH 1/2] efi_loader: enable support for file renaming

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Jan 3 21:40:58 CET 2025


On 12.12.24 23:06, Burak Gerz wrote:
> EFI applications can issue a file rename to U-boot - add support for
> this

Thank you for the patch series. This is a valuable addition.

We want to be able to bisect our code git repository. This requires that
the code builds after each individual patch.

So this patch must be last.

>
> Signed-off-by: Burak Gerz <burak at gerz.io>
> ---
>
>   lib/efi_loader/efi_file.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
> index 95b3c890ee..b4d1a9dad5 100644
> --- a/lib/efi_loader/efi_file.c
> +++ b/lib/efi_loader/efi_file.c
> @@ -975,14 +975,15 @@ static efi_status_t EFIAPI efi_file_setinfo(struct efi_file_handle *file,
>   		}
>   		pos = new_file_name;
>   		utf16_utf8_strcpy(&pos, info->file_name);
> +
>   		if (strcmp(new_file_name, filename)) {
> -			/* TODO: we do not support renaming */
> -			EFI_PRINT("Renaming not supported\n");
> +			if (set_blk_dev(fh) == 0 && fs_rename(fh->path, new_file_name) == 0)

We tend to avoid "== 0" in the U-Boot code.

     if (!set_blk_dev(fh) && !fs_rename(fh->path, new_file_name))

> +				ret = EFI_SUCCESS;
> +			else
> +				ret = EFI_DEVICE_ERROR;

What is wrong about EFI_ACCESS_DENIED?

Best regards

Heinrich

>   			free(new_file_name);
> -			ret = EFI_ACCESS_DENIED;
>   			goto out;
>   		}
> -		free(new_file_name);
>   		/* Check for truncation */
>   		if (!fh->isdir) {
>   			ret = efi_get_file_size(fh, &file_size);



More information about the U-Boot mailing list