summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-05-15 22:41:26 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-07-12 20:30:48 +0200
commit79a61ccb236547a69db53ee52751e62b6a4361c3 (patch)
tree4a88d8122b50625a36c2057ede0cf7261fd22a7a /lib
parentcbe3ab986bdd5301dd4cbfd50e316a063d17d7b8 (diff)
downloadu-boot-79a61ccb236547a69db53ee52751e62b6a4361c3.tar.gz
efi_loader: provide file attributes in EFI_FILE_PROTOCOL.Read()
When reading a directory using EFI_FILE_PROTOCOL.Read() provide file attributes and timestamps. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_file.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index 6b3f5962be..6299fcbbf4 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -480,6 +480,17 @@ static efi_status_t file_read(struct file_handle *fh, u64 *buffer_size,
return EFI_SUCCESS;
}
+static void rtc2efi(struct efi_time *time, struct rtc_time *tm)
+{
+ memset(time, 0, sizeof(struct efi_time));
+ time->year = tm->tm_year;
+ time->month = tm->tm_mon;
+ time->day = tm->tm_mday;
+ time->hour = tm->tm_hour;
+ time->minute = tm->tm_min;
+ time->second = tm->tm_sec;
+}
+
static efi_status_t dir_read(struct file_handle *fh, u64 *buffer_size,
void *buffer)
{
@@ -535,6 +546,10 @@ static efi_status_t dir_read(struct file_handle *fh, u64 *buffer_size,
info->size = required_size;
info->file_size = dent->size;
info->physical_size = dent->size;
+ info->attribute = dent->attr;
+ rtc2efi(&info->create_time, &dent->create_time);
+ rtc2efi(&info->modification_time, &dent->change_time);
+ rtc2efi(&info->last_access_time, &dent->access_time);
if (dent->type == FS_DT_DIR)
info->attribute |= EFI_FILE_DIRECTORY;