bootsector
status = parse_bpb(fatVolume, reinterpret_cast<bootsector*>(bootsectorBuffer), dos33);
status = parse_bpb(&dummyVolume, reinterpret_cast<union bootsector*>(buf), dos33);
char bootsector[512];
memset(bootsector,0x00,512);
memcpy(bootsector + BOOTJMP_START_OFFSET, bootjmp, sizeof(bootjmp));
memcpy(bootsector + BOOTCODE_START_OFFSET, bootcode, sizeof(bootcode));
bootsector32 *bs = (bootsector32 *)bootsector;
bootsector1216 *bs = (bootsector1216 *)bootsector;
written = write_pos(fd, BOOT_SECTOR_NUM * sectorSize, bootsector, 512);
written = write_pos(fd, BACKUP_SECTOR_NUM * sectorSize, bootsector, 512);
char bootsector[512];
memset(bootsector,0x00,512);
if (write_pos(fd, 512, bootsector, sizeof(bootsector)) < 0)
check_bootsector(const uint8* bootsector, FatType& _type, bool& _dos33)
if (bootsector[0x1fe] != BOOTSIG0 || bootsector[0x1ff] != BOOTSIG1)
if (!memcmp((uint8*) bootsector + 3, "NTFS ", 8)
|| !memcmp((uint8*) bootsector + 3, "HPFS ", 8)) {
uint32 bytesPerSector = read16(bootsector, 0Xb);
uint32 sectorsPerCluster = bootsector[0xd];
uint32 rootDirEntries = read16(bootsector, 0x11);
uint32 sectorsPerFat = read16(bootsector, 0x16);
sectorsPerFat = read32(bootsector, 0x24);
uint32 totalSectors = read16(bootsector, 0x13);
totalSectors = read32(bootsector, 0x20);
uint32 reservedSectors = read16(bootsector, 0xe);
uint32 fatCount = bootsector[0x10];
if (_type != fat32 && bootsector[0x26] != EXBOOTSIG)
parse_bpb(msdosfsmount* volume, const bootsector* bootsector, bool dos33)
= reinterpret_cast<const universal_byte_bpb*>(bootsector->bs33.bsBPB);
const struct byte_bpb33* b33 = reinterpret_cast<const byte_bpb33*>(bootsector->bs33.bsBPB);
const struct byte_bpb50* b50 = reinterpret_cast<const byte_bpb50*>(bootsector->bs50.bsBPB);
= reinterpret_cast<const byte_bpb710*>(bootsector->bs710.bsBPB);
= reinterpret_cast<const byte_bpb710*>(bootsector->bs710.bsBPB);
status_t check_bootsector(const uint8* bootsector, FatType& _type, bool& _dos33);
status_t parse_bpb(msdosfsmount* volume, const bootsector* bootsector, bool dos33);