#[repr(packed)]pub struct BPB {Show 27 fields
pub bs_jmp_boot: [u8; 3],
pub bs_oem_name: [u8; 8],
pub byts_per_sec: u16,
pub sec_per_clus: u8,
pub rsvd_sec_cnt: u16,
pub num_fats: u8,
pub root_ent_cnt: u16,
pub tot_sec16: u16,
pub media: u8,
pub fat_sz16: u16,
pub sec_per_trk: u16,
pub num_heads: u16,
pub hidd_sec: u32,
pub tot_sec32: u32,
pub fat_sz32: u32,
pub ext_flags: u16,
pub fs_ver: u16,
pub root_clus: u32,
pub fs_info: u16,
pub bk_boot_sec: u16,
pub reserved: [u8; 12],
pub drv_num: u8,
pub resvered1: u8,
pub boot_sig: u8,
pub vol_id: u32,
pub vol_lab: [u8; 11],
pub fil_sys_type: [u8; 8],
}
Expand description
On-disk data structure for partition information.
Fields
bs_jmp_boot: [u8; 3]
x86 assembly to jump instruction to boot code.
bs_oem_name: [u8; 8]
“MSWIN4.1” There are many misconceptions about this field. It is only a name string. Unlike some FAT drivers, Microsoft operating systems don’t pay any attention to this field.
byts_per_sec: u16
Bytes per sector, 512 for SD card
sec_per_clus: u8
sector per cluster, usually 8 for SD card
rsvd_sec_cnt: u16
sector number of the reserved area
num_fats: u8
Number of FATs
root_ent_cnt: u16
Have to be ZERO for FAT32. Positioned at offset
tot_sec16: u16
For FAT32 volumes, this field must be 0.
media: u8
Used to denote the media type. This is a legacy field that is no longer in use. 0xF8 is the standard value for “fixed” (non-removable) media. For removable media, 0xF0 is frequently used. The legal values for this field are: 0xF0, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, and 0xFF.
fat_sz16: u16
On FAT32 volumes this field must be 0, and fat_sz32 contains the FAT size count.
sec_per_trk: u16
Sector per track used by interrupt 0x13, not needed by SD card.
num_heads: u16
Number of heads for interrupt 0x13.
This field is relevant as discussed earlier for BPB_SecPerTrk.
This field contains the one based “count of heads”.
For example, on a 1.44 MB 3.5-inch floppy drive this value is 2.
hidd_sec: u32
tot_sec32: u32
fat_sz32: u32
ext_flags: u16
fs_ver: u16
root_clus: u32
This is set to the cluster number of the first cluster of the root directory, usually 2 but not required to be 2. Unique to FAT32.
fs_info: u16
Sector number of FSINFO structure in the reserved area of the
FAT32 volume. Usually 1.
Unique to FAT32.
bk_boot_sec: u16
If non-zero, indicates the sector number in the reserved area of the volume of a copy of the boot record. Usually 6. No value other than 6 is recommended. Unique to FAT32.
reserved: [u8; 12]
drv_num: u8
resvered1: u8
boot_sig: u8
vol_id: u32
vol_lab: [u8; 11]
fil_sys_type: [u8; 8]
Implementations
May be WRONG! This function should round DOWN.
Sectors occupied by the root directory May be WRONG! Should be rounded UP.
The first data sector beyond the root directory
The first data sector beyond the root directory
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for BPB
impl UnwindSafe for BPB
Blanket Implementations
Mutably borrows from an owned value. Read more