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

Burak Gerz burak at gerz.io
Thu Dec 12 23:06:28 CET 2024


EFI applications can issue a file rename to U-boot - add support for
this

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)
+				ret = EFI_SUCCESS;
+			else
+				ret = EFI_DEVICE_ERROR;
 			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);
-- 
2.45.2



More information about the U-Boot mailing list