#include <common.h>
#include <charset.h>
#include <efi_loader.h>
+#include <log.h>
#include <malloc.h>
#include <mapmem.h>
#include <fs.h>
+#include <part.h>
/* GUID for file system information */
const efi_guid_t efi_file_system_info_guid = EFI_FILE_SYSTEM_INFO_GUID;
efi_status_t ret;
loff_t file_size;
+ if (!buffer) {
+ ret = EFI_INVALID_PARAMETER;
+ return ret;
+ }
+
ret = efi_get_file_size(fh, &file_size);
if (ret != EFI_SUCCESS)
return ret;
fh->dent = dent;
return EFI_BUFFER_TOO_SMALL;
}
+ if (!buffer)
+ return EFI_INVALID_PARAMETER;
fh->dent = NULL;
*buffer_size = required_size;
EFI_ENTRY("%p, %p, %p", file, buffer_size, buffer);
- if (!buffer_size || !buffer) {
+ if (!buffer_size) {
ret = EFI_INVALID_PARAMETER;
goto error;
}
utf8_utf16_strcpy(&dst, filename);
} else if (!guidcmp(info_type, &efi_file_system_info_guid)) {
struct efi_file_system_info *info = buffer;
- disk_partition_t part;
+ struct disk_partition part;
efi_uintn_t required_size;
int r;
memset(info, 0, required_size);
info->size = required_size;
- info->read_only = true;
+ /*
+ * TODO: We cannot determine if the volume can be written to.
+ */
+ info->read_only = false;
info->volume_size = part.size * part.blksz;
- info->free_space = 0;
+ /*
+ * TODO: We currently have no function to determine the free
+ * space. The volume size is the best upper bound we have.
+ */
+ info->free_space = info->volume_size;
info->block_size = part.blksz;
/*
* TODO: The volume label is not available in U-Boot.
goto out;
}
/* Check for renaming */
- new_file_name = malloc(utf16_utf8_strlen(info->file_name));
+ new_file_name = malloc(utf16_utf8_strlen(info->file_name) + 1);
if (!new_file_name) {
ret = EFI_OUT_OF_RESOURCES;
goto out;