pub struct Geometry {Show 15 fields
pub variant: FatVariant,
pub bytes_per_sector: u32,
pub sectors_per_cluster: u32,
pub cluster_size: u32,
pub reserved_sectors: u32,
pub num_fats: u32,
pub fat_size_sectors: u32,
pub root_entry_count: u32,
pub total_sectors: u64,
pub root_cluster: u32,
pub count_of_clusters: u32,
pub fat_start: u64,
pub root_dir_start: u64,
pub root_dir_bytes: u32,
pub data_start: u64,
}Expand description
Resolved on-disk geometry of a FAT12/16/32 volume. All byte offsets are relative to the start of the volume (sector 0).
Fields§
§variant: FatVariantWhich FAT variant.
bytes_per_sector: u32Bytes per logical sector (power of two, 512–4096).
sectors_per_cluster: u32Sectors per cluster (power of two, 1–128).
cluster_size: u32Cluster size in bytes.
reserved_sectors: u32Count of reserved sectors preceding the first FAT.
num_fats: u32Number of FAT copies.
fat_size_sectors: u32Sectors occupied by one FAT.
root_entry_count: u32FAT12/16 fixed root directory entry count (0 on FAT32).
total_sectors: u64Total sectors in the volume.
root_cluster: u32FAT32/exFAT first cluster of the root directory (0 on FAT12/16).
count_of_clusters: u32Count of data clusters (drives the type decision).
fat_start: u64Byte offset of the first FAT.
root_dir_start: u64Byte offset of the FAT12/16 fixed root region (0 on FAT32).
root_dir_bytes: u32Byte size of the FAT12/16 fixed root region (0 on FAT32).
data_start: u64Byte offset of cluster 2 (start of the data region).
Implementations§
Source§impl Geometry
impl Geometry
Sourcepub fn parse(boot: &[u8]) -> Result<Geometry>
pub fn parse(boot: &[u8]) -> Result<Geometry>
Parse the BPB from the boot sector boot (at least 512 bytes).
Fails loud, naming the offending value, on any structurally invalid field — an invalid BPB is a bootstrap failure, never a silent default.
Sourcepub fn cluster_offset(&self, cluster: u32) -> Option<u64>
pub fn cluster_offset(&self, cluster: u32) -> Option<u64>
Byte offset of the first sector of cluster (>= 2) in the data region.