]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: implement a file delete
authorAKASHI Takahiro <takahiro.akashi@linaro.org>
Tue, 11 Sep 2018 06:59:16 +0000 (15:59 +0900)
committerAlexander Graf <agraf@suse.de>
Sun, 23 Sep 2018 19:55:30 +0000 (21:55 +0200)
'Delete' will be implemented here by calling fs_unlink() which relies on
underlying file system's implementation.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
lib/efi_loader/efi_file.c

index 9294fe58aae080e55cd4bf89b22d9eec4a6df59a..89d65694da3c8e8de891c196c51ca315d32c94c1 100644 (file)
@@ -230,9 +230,21 @@ static efi_status_t EFIAPI efi_file_close(struct efi_file_handle *file)
 static efi_status_t EFIAPI efi_file_delete(struct efi_file_handle *file)
 {
        struct file_handle *fh = to_fh(file);
+       efi_status_t ret = EFI_SUCCESS;
+
        EFI_ENTRY("%p", file);
+
+       if (set_blk_dev(fh)) {
+               ret = EFI_DEVICE_ERROR;
+               goto error;
+       }
+
+       if (fs_unlink(fh->path))
+               ret = EFI_DEVICE_ERROR;
        file_close(fh);
-       return EFI_EXIT(EFI_WARN_DELETE_FAILURE);
+
+error:
+       return EFI_EXIT(ret);
 }
 
 static efi_status_t file_read(struct file_handle *fh, u64 *buffer_size,