summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_file.c
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2018-09-11 15:59:16 +0900
committerAlexander Graf <agraf@suse.de>2018-09-23 21:55:30 +0200
commitd39f6a617ca201517e320b38d609017f1183c572 (patch)
tree2d20405aacb1c3db5c0f63838e40a3fd5b05e338 /lib/efi_loader/efi_file.c
parentd4b751e9f3efc5f230c0596c082ba13ca89618e1 (diff)
efi_loader: implement a file delete
'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>
Diffstat (limited to 'lib/efi_loader/efi_file.c')
-rw-r--r--lib/efi_loader/efi_file.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index 9294fe58aa..89d65694da 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -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,