pub struct Partition {
pub part_type_guid: Type,
pub part_guid: Uuid,
pub first_lba: u64,
pub last_lba: u64,
pub flags: u64,
pub name: String,
}
Expand description
A partition entry in a GPT partition table.
Fields§
§part_type_guid: Type
GUID of the partition type.
part_guid: Uuid
UUID of the partition.
first_lba: u64
First LBA of the partition.
last_lba: u64
Last LBA of the partition.
flags: u64
Partition flags.
name: String
Partition name.
Implementations§
source§impl Partition
impl Partition
sourcepub fn write(
&self,
p: &Path,
partition_index: u64,
start_lba: u64,
lb_size: LogicalBlockSize
) -> Result<()>
pub fn write( &self, p: &Path, partition_index: u64, start_lba: u64, lb_size: LogicalBlockSize ) -> Result<()>
Write the partition entry to the partitions area in the given file. NOTE: does not update partitions array crc32 in the headers!
sourcepub fn write_to_device<D: DiskDevice>(
&self,
device: &mut D,
partition_index: u64,
start_lba: u64,
lb_size: LogicalBlockSize,
bytes_per_partition: u32
) -> Result<()>
pub fn write_to_device<D: DiskDevice>( &self, device: &mut D, partition_index: u64, start_lba: u64, lb_size: LogicalBlockSize, bytes_per_partition: u32 ) -> Result<()>
Write the partition entry to the partitions area in the given device. NOTE: does not update partitions array crc32 in the headers!
sourcepub fn write_zero_entries_to_device<D: DiskDevice>(
device: &mut D,
starting_partition_index: u64,
number_entries: u64,
start_lba: u64,
lb_size: LogicalBlockSize,
bytes_per_partition: u32
) -> Result<()>
pub fn write_zero_entries_to_device<D: DiskDevice>( device: &mut D, starting_partition_index: u64, number_entries: u64, start_lba: u64, lb_size: LogicalBlockSize, bytes_per_partition: u32 ) -> Result<()>
Write empty partition entries starting at the given index in the partition array for the given number of entries…
sourcepub fn bytes_len(&self, lb_size: LogicalBlockSize) -> Result<u64>
pub fn bytes_len(&self, lb_size: LogicalBlockSize) -> Result<u64>
Return the length (in bytes) of this partition. Partition size is calculated as (last_lba + 1 - first_lba) * block_size Bounds are inclusive, meaning we add one to account for the full last logical block
sourcepub fn bytes_start(&self, lb_size: LogicalBlockSize) -> Result<u64>
pub fn bytes_start(&self, lb_size: LogicalBlockSize) -> Result<u64>
Return the starting offset (in bytes) of this partition.