pub struct PartList(_);
Expand description
List of all detected partitions and partitions tables
Implementations§
source§impl PartList
impl PartList
sourcepub fn get_partition(&self, part_num: i32) -> BlkIdResult<Partition>
pub fn get_partition(&self, part_num: i32) -> BlkIdResult<Partition>
Returns partition object.
It’s possible that the list of partitions is empty, but there is a valid partition table on the disk. This happen when on-disk details about partitions are unknown or the partition table is empty.
See also Self::get_table
.
sourcepub fn get_partition_by_parno(&self, partno: i32) -> BlkIdResult<Partition>
pub fn get_partition_by_parno(&self, partno: i32) -> BlkIdResult<Partition>
Returns partition object by the partiton number (e.g. N
from sdaN
).
This does not assume any order of the input blkid_partlist. And correctly handles “out of order” partition tables. partition N is located after partition N+1 on the disk.
sourcepub fn get_partitions(&self) -> BlkIdResult<Vec<Partition>>
pub fn get_partitions(&self) -> BlkIdResult<Vec<Partition>>
Returns all partitions
sourcepub fn devno_to_partition(&self, devno: u64) -> BlkIdResult<Partition>
pub fn devno_to_partition(&self, devno: u64) -> BlkIdResult<Partition>
Returns partition object by requested partition.
This tries to get start and size for devno from sysfs
and returns a partition from list
which matches with the values from sysfs
.
This function is necessary when you want to make a relation between an entry in the partition table (list) and block devices in your system.
sourcepub fn get_table(&self) -> Option<PartTable>
pub fn get_table(&self) -> Option<PartTable>
Returns PartTable
or None
if there is not a partition table on the device
sourcepub fn numof_partitions(&self) -> BlkIdResult<i32>
pub fn numof_partitions(&self) -> BlkIdResult<i32>
Returns number of partitions in the list