Changeset 66594 in vbox for trunk/include/iprt/formats
- Timestamp:
- Apr 17, 2017 3:29:05 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/formats/fat.h
r66578 r66594 31 31 #include <iprt/assert.h> 32 32 33 #pragma pack(1)34 33 35 34 /** @name FAT Media byte values … … 47 46 * This was the first DOS version with a BPB. 48 47 */ 48 #pragma pack(1) 49 49 typedef struct FATBPB20 50 50 { … … 66 66 uint16_t cSectorsPerFat; 67 67 } FATBPB20; 68 #pragma pack() 68 69 AssertCompileSize(FATBPB20, 0xd); 69 70 /** Pointer to a DOS 2.0 BPB. */ … … 76 77 * The DOS 3.0 BPB changes that survived. 77 78 */ 79 #pragma pack(1) 78 80 typedef struct FATBPB30CMN 79 81 { … … 85 87 uint16_t cTracksPerCylinder; 86 88 } FATBPB30CMN; 89 #pragma pack() 87 90 AssertCompileSize(FATBPB30CMN, 0x11); 88 91 … … 90 93 * The DOS 3.0 BPB. 91 94 */ 95 #pragma pack(1) 92 96 typedef struct FATBPB30 93 97 { … … 98 102 uint16_t cHiddenSectors; 99 103 } FATBPB30; 104 #pragma pack() 100 105 AssertCompileSize(FATBPB30, 0x13); 101 106 /** Pointer to a DOS 3.0 BPB. */ … … 107 112 * The DOS 3.0 BPB, flattened structure. 108 113 */ 114 #pragma pack(1) 109 115 typedef struct FATBPB30FLAT 110 116 { … … 139 145 /** @} */ 140 146 } FATBPB30FLAT; 147 #pragma pack() 141 148 AssertCompileSize(FATBPB30FLAT, 0x13); 142 149 /** Pointer to a flattened DOS 3.0 BPB. */ … … 149 156 * The DOS 3.2 BPB. 150 157 */ 158 #pragma pack(1) 151 159 typedef struct FATBPB32 152 160 { … … 157 165 uint16_t cAnotherTotalSectors; 158 166 } FATBPB32; 167 #pragma pack() 159 168 AssertCompileSize(FATBPB32, 0x15); 160 169 /** Pointer to a DOS 3.2 BPB. */ … … 166 175 * The DOS 3.2 BPB, flattened structure. 167 176 */ 177 #pragma pack(1) 168 178 typedef struct FATBPB32FLAT 169 179 { … … 204 214 /** @} */ 205 215 } FATBPB32FLAT; 216 #pragma pack() 206 217 AssertCompileSize(FATBPB32FLAT, 0x15); 207 218 /** Pointer to a flattened DOS 3.2 BPB. */ … … 214 225 * The DOS 3.31 BPB. 215 226 */ 227 #pragma pack(1) 216 228 typedef struct FATBPB331 217 229 { … … 226 238 uint32_t cTotalSectors32; 227 239 } FATBPB331; 240 #pragma pack() 228 241 AssertCompileSize(FATBPB331, 0x19); 229 242 /** Pointer to a DOS 3.31 BPB. */ … … 235 248 * The DOS 3.31 BPB, flattened structure. 236 249 */ 250 #pragma pack(1) 237 251 typedef struct FATBPB331FLAT 238 252 { … … 274 288 /** @} */ 275 289 } FATBPB331FLAT; 290 #pragma pack() 276 291 AssertCompileSize(FATBPB331FLAT, 0x19); 277 292 /** Pointer to a flattened DOS 3.31 BPB. */ … … 284 299 * Extended BIOS parameter block (EBPB). 285 300 */ 301 #pragma pack(1) 286 302 typedef struct FATEBPB 287 303 { … … 306 322 char achType[8]; 307 323 } FATEBPB; 324 #pragma pack() 308 325 AssertCompileSize(FATEBPB, 0x33); 309 326 /** Pointer to an extended BIOS parameter block. */ … … 329 346 * FAT32 Extended BIOS parameter block (EBPB). 330 347 */ 348 #pragma pack(1) 331 349 typedef struct FAT32EBPB 332 350 { … … 376 394 union 377 395 { 396 /** Type string variant. */ 378 397 char achType[8]; 398 /** Total sector count if 4G or higher. */ 379 399 uint64_t cTotalSectors64; 380 400 } u; 381 401 } FAT32EBPB; 402 #pragma pack() 382 403 AssertCompileSize(FAT32EBPB, 0x4f); 383 404 /** Pointer to a FAT32 extended BIOS parameter block. */ … … 393 414 * FAT boot sector layout. 394 415 */ 416 #pragma pack(1) 395 417 typedef struct FATBOOTSECTOR 396 418 { … … 417 439 uint16_t uSignature; 418 440 } FATBOOTSECTOR; 441 #pragma pack() 419 442 AssertCompileSize(FATBOOTSECTOR, 0x200); 420 443 /** Pointer to a FAT boot sector. */ … … 426 449 #define FATBOOTSECTOR_SIGNATURE UINT16_C(0xaa55) 427 450 428 #pragma pack() 451 452 453 /** 454 * FAT32 info sector (follows the boot sector). 455 */ 456 typedef struct FAT32INFOSECTOR 457 { 458 /** 0x000: Signature \#1 (FAT32INFOSECTOR_SIGNATURE_1). */ 459 uint32_t uSignature1; 460 /** Reserved, should be zero. */ 461 uint8_t abReserved1[0x1E0]; 462 /** 0x1e4: Signature \#1 (FAT32INFOSECTOR_SIGNATURE_2). */ 463 uint32_t uSignature2; 464 /** 0x1e8: Last known number of free clusters (informational). */ 465 uint32_t cFreeClusters; 466 /** 0x1ec: Last allocated cluster number (informational). This could be used as 467 * an allocation hint when searching for a free cluster. */ 468 uint32_t cLastAllocatedCluster; 469 /** 0x1f0: Reserved, should be zero, preserve. */ 470 uint8_t abReserved2[12]; 471 /** 0x1fc: Signature \#3 (FAT32INFOSECTOR_SIGNATURE_3). */ 472 uint32_t uSignature3; 473 } FAT32INFOSECTOR; 474 AssertCompileSize(FAT32INFOSECTOR, 0x200); 475 /** Pointer to a FAT32 info sector. */ 476 typedef FAT32INFOSECTOR *PFAT32INFOSECTOR; 477 /** Pointer to a const FAT32 info sector. */ 478 typedef FAT32INFOSECTOR const *PCFAT32INFOSECTOR; 479 480 #define FAT32INFOSECTOR_SIGNATURE_1 UINT32_C(0x41615252) 481 #define FAT32INFOSECTOR_SIGNATURE_2 UINT32_C(0x61417272) 482 #define FAT32INFOSECTOR_SIGNATURE_3 UINT32_C(0xaa550000) 429 483 430 484 #endif
Note:
See TracChangeset
for help on using the changeset viewer.