mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-09 20:52:54 +00:00
AK: Add conversion functions for packed DOS time format
This also adjusts the FATFS code to use the new functions and removes the now redundant old conversion functions.
This commit is contained in:
parent
7e915b145b
commit
361df6eff8
Notes:
sideshowbarker
2024-07-17 10:10:18 +09:00
Author: https://github.com/Ollrogge
Commit: 361df6eff8
Pull-request: https://github.com/SerenityOS/serenity/pull/17224
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/drunderscore
Reviewed-by: https://github.com/timschumi
7 changed files with 98 additions and 39 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DOSPackedTime.h>
|
||||
#include <AK/EnumBits.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
|
@ -54,38 +55,18 @@ enum class FATAttributes : u8 {
|
|||
|
||||
AK_ENUM_BITWISE_OPERATORS(FATAttributes);
|
||||
|
||||
union FATPackedTime {
|
||||
u16 value;
|
||||
struct {
|
||||
u16 second : 5;
|
||||
u16 minute : 6;
|
||||
u16 hour : 5;
|
||||
};
|
||||
};
|
||||
static_assert(sizeof(FATPackedTime) == 2);
|
||||
|
||||
union FATPackedDate {
|
||||
u16 value;
|
||||
struct {
|
||||
u16 day : 5;
|
||||
u16 month : 4;
|
||||
u16 year : 7;
|
||||
};
|
||||
};
|
||||
static_assert(sizeof(FATPackedDate) == 2);
|
||||
|
||||
struct [[gnu::packed]] FATEntry {
|
||||
char filename[8];
|
||||
char extension[3];
|
||||
FATAttributes attributes;
|
||||
u8 unused1;
|
||||
u8 creation_time_seconds;
|
||||
FATPackedTime creation_time;
|
||||
FATPackedDate creation_date;
|
||||
FATPackedDate last_accessed_date;
|
||||
DOSPackedTime creation_time;
|
||||
DOSPackedDate creation_date;
|
||||
DOSPackedDate last_accessed_date;
|
||||
u16 first_cluster_high;
|
||||
FATPackedTime modification_time;
|
||||
FATPackedDate modification_date;
|
||||
DOSPackedTime modification_time;
|
||||
DOSPackedDate modification_date;
|
||||
u16 first_cluster_low;
|
||||
u32 file_size;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue