16 friend class FsPartition;
20 const static size_t MAX_LFN_CHARS = 255;
25 RES_DISK_ERROR = 0x02,
26 RES_NOT_FORMATTED = 0x03,
27 RES_OUT_OF_MEMORY = 0x04,
28 RES_INVALID_PATH = 0x05,
29 RES_INVALID_PARTITION = 0x06,
30 RES_ENTRY_NOT_FOUND = 0x07,
31 RES_FILE_ALREADY_OPEN = 0x08,
34 RES_ENTRY_NOT_OPEN = 0x0B,
35 RES_FOLDER_NOT_EMPTY = 0x0C,
36 RES_NOT_IMPLEMENTED = 0x0D,
37 RES_DRIVE_ID_INVALID = 0x0E,
38 RES_NO_MORE_SFN_AVAILABLE = 0x0F,
41 static const char* getResultString(RESULT result);
43 const static size_t SECTOR_BYTES = 512;
44 const static size_t SECTOR_DWORDS = 512 / 4;
45 const static size_t DIRECTORIES_TABLES_PER_SECTOR = 16;
46 const static size_t MAX_LFN_LENGTH = 255;
47 const static uint32_t FAT_FREE_CLUSTER = 0;
48 const static uint32_t FAT_LAST_CLUSTER = 0xFFFFFFFF;
49 const static uint32_t FAT_MAX_CLUSTER_VALUE = 0xFFFFFFF6;
50 const static uint8_t ENTRY_LAST = 0;
51 const static uint8_t ENTRY_UNUSED = 0xE5;
59 PT_EXTENDED_CHS = 0x05,
65 PT_EXTENDED_LBA = 0x0F,
66 PT_PARTITION_EISA = 0x12,
67 PT_DYNAMIC_DISK_VOLUME = 0x42,
68 PT_LEGACY_FAT16 = 0x86,
69 PT_LEGACY_NTFS = 0x87,
70 PT_LEGACY_FAT32 = 0x8B,
71 PT_LEGACY_PARTITION_EISA = 0x8C,
77 PARTITION_TYPE partitionType;
80 uint32_t numberOfSectors;
81 }__attribute__((packed)) PARTITION_ENTRY;
105 uint8_t filSysType[8];
106 uint8_t reserved2[448];
116 uint8_t reserved1[12];
122 uint8_t filSysType[8];
123 uint8_t reserved3[420];
127 }__attribute__((packed)) BOOT_SECTOR;
131 uint8_t reserverd1[480];
135 uint8_t reserved2[14];
137 }__attribute__((packed)) FS_INFO;
163 uint8_t directory :1;
174 ATTRIBUTES attributes;
176 uint8_t createTimeMs;
180 uint16_t firstClusterHi;
181 TIME lastModifiedTime;
182 DATE lastModifiedDate;
183 uint16_t firstClusterLo;
185 }__attribute__((packed)) SHORT_DIRECTORY_ENTRY;
190 ATTRIBUTES attributes;
194 uint16_t firstCluster;
196 }__attribute__((packed)) LONG_DIRECTORY_ENTRY;
198 const static
size_t LFN_MAX_CHARS_PER_ENTRY = 13;
201 SHORT_DIRECTORY_ENTRY shortEntry;
202 LONG_DIRECTORY_ENTRY longEntry;
207 PARTITION_ENTRY partitionEntries[4];
209 }__attribute__((packed)) MBR;
213 uint8_t bytes[SECTOR_BYTES];
214 uint32_t dwords[SECTOR_DWORDS];
215 DIRECTORY_ENTRY dirEntries[DIRECTORIES_TABLES_PER_SECTOR];