13#ifndef MAXOS_FILESYSTEM_FAT32_H
14#define MAXOS_FILESYSTEM_FAT32_H
17#include <common/macros.h>
22namespace MaxOS::filesystem::format {
54 uint8_t reserved0[12];
59 uint8_t volume_label[11];
60 uint8_t file_system_type[8];
73 uint8_t reserved1[480];
77 uint8_t reserved2[12];
123 LONG_NAME = READ_ONLY | HIDDEN | SYSTEM | VOLUME_ID,
152 } long_file_name_entry_t;
161 END_OF_CHAIN = 0xFFFFFFFF,
189 [[nodiscard]] uint32_t
next_cluster(uint32_t cluster)
const;
214 uint32_t m_first_cluster;
241 lba_t m_first_cluster;
242 lba_t m_last_cluster = 0;
243 size_t m_current_cluster_length = 0;
248 void remove_entry(
lba_t cluster);
249 void read_all_entries();
251 uint32_t entry_index(
lba_t cluster);
252 int64_t find_free_entries(
size_t amount);
253 int expand_directory(
size_t amount);
Wrapper class for a region of bytes in memor in an attempt to add some memory safety....
Stores the left, top, width and height of a rectangle.
Generic Disk, handles the reading and writing of data to the hard drive.
Handles a group of files (directory)
string name()
Get the name of the directory.
Handles the disk operations and file system information.
Handles file operations and information.
string name()
Get the name of the file.
Defines a generic Disk driver for reading and writing data to disk drives.
ClusterState
The state of a cluster in the FAT32 filesystem.
struct PACKED MaxOS::filesystem::format::BiosParameterBlock32 bpb32_t
Alias for BiosParameterBlock32 struct.
struct PACKED MaxOS::filesystem::format::LongFileNameEntry long_file_name_entry_t
Alias for LongFileNameEntry struct.
DirectoryEntryAttributes
Flags for a directory entry in a FAT32 System.
struct PACKED MaxOS::filesystem::format::FSInfo fs_info_t
Alias for FSInfo struct.
constexpr uint16_t MAX_NAME_LENGTH
Highest number of characters in a file/directory name.
struct PACKED MaxOS::filesystem::format::DirectoryEntry dir_entry_t
Alias for DirectoryEntry struct.
DirectoryEntryType
The type of a directory entry.
Defines a generic API for a file system, including classes for File, Directory, and FileSystem.
uint32_t lba_t
Logical Block Addressing type.
Stores information about a file or directory.
uint32_t size
File size in bytes.
uint8_t creation_time_tenth
Creation time in tenths of a second (or 100ths of a second) (0-199 on Windows, 0/100 on Linux)
uint16_t last_access_date
Last access date (YYYY-MM-DD)
uint16_t creation_time
Creation time (HH:MM:SS) (multiply seconds by 2)
uint8_t reserved
Reserved for Windows NT.
uint16_t last_write_time
Last write time (HH:MM:SS) (multiply seconds by 2)
uint16_t creation_date
Creation date (YYYY-MM-DD)
uint16_t first_cluster_high
High word of this entry's first cluster number (usually 0 for FAT12/FAT16)
uint16_t first_cluster_low
Low word of this entry's first cluster number.
uint8_t attributes
File attributes (see DirectoryEntryAttributes)
uint16_t last_write_date
Last write date (YYYY-MM-DD)
Directory entry for a long file name.
uint8_t checksum
checksum of the corresponding short file name
uint8_t order
Index of this entry in the sequence of LFN entries.
uint16_t zero
Must be zero.
uint8_t attributes
Attributes (always 0x0F for LFN entries)
uint8_t type
Type (always 0 for LFN entries)