Struct libblkid_rs::BlkidProbe
source · pub struct BlkidProbe(/* private fields */);
Expand description
A structure for probing block devices.
Implementations§
source§impl BlkidProbe
impl BlkidProbe
sourcepub fn new_from_filename(filename: &Path) -> Result<Self>
pub fn new_from_filename(filename: &Path) -> Result<Self>
Create a new probe from a filename.
sourcepub fn reset_buffers(&mut self) -> Result<()>
pub fn reset_buffers(&mut self) -> Result<()>
Reset and free all buffers used in the probe.
sourcepub fn hide_range(&mut self, offset: u64, len: u64) -> Result<()>
pub fn hide_range(&mut self, offset: u64, len: u64) -> Result<()>
Hide a memory range in the probe from the next do_probe
call.
sourcepub fn set_device(
&mut self,
fd: RawFd,
offset: blkid_loff_t,
size: blkid_loff_t
) -> Result<()>
pub fn set_device( &mut self, fd: RawFd, offset: blkid_loff_t, size: blkid_loff_t ) -> Result<()>
Assign the device to the probe control structure.
sourcepub fn get_devno(&self) -> BlkidDevno
pub fn get_devno(&self) -> BlkidDevno
Get the device number associated with the probe device.
sourcepub fn get_wholedisk_devno(&self) -> BlkidDevno
pub fn get_wholedisk_devno(&self) -> BlkidDevno
Get the device number of the whole disk
sourcepub fn is_wholedisk(&self) -> bool
pub fn is_wholedisk(&self) -> bool
Check if the given device is an entire disk (instead of a partition or something similar)
sourcepub fn get_size(&self) -> blkid_loff_t
pub fn get_size(&self) -> blkid_loff_t
Get the size of of a device.
sourcepub fn get_offset(&self) -> blkid_loff_t
pub fn get_offset(&self) -> blkid_loff_t
Get the offset of a probing area of a device.
sourcepub fn get_sector_size(&self) -> c_uint
pub fn get_sector_size(&self) -> c_uint
Get the sector size of the attached device.
sourcepub fn enable_superblocks(&mut self, enable: bool) -> Result<()>
pub fn enable_superblocks(&mut self, enable: bool) -> Result<()>
Enable superblock probing.
sourcepub fn set_superblock_flags(&mut self, flags: BlkidSublksFlags) -> Result<()>
pub fn set_superblock_flags(&mut self, flags: BlkidSublksFlags) -> Result<()>
Set the superblock probing flags.
sourcepub fn reset_superblock_filter(&mut self) -> Result<()>
pub fn reset_superblock_filter(&mut self) -> Result<()>
Reset the superblock probing filter.
sourcepub fn invert_superblock_filter(&mut self) -> Result<()>
pub fn invert_superblock_filter(&mut self) -> Result<()>
Invert the superblock probing filter.
sourcepub fn filter_superblock_type(
&mut self,
flag: BlkidFltr,
names: &[&str]
) -> Result<()>
pub fn filter_superblock_type( &mut self, flag: BlkidFltr, names: &[&str] ) -> Result<()>
Filter superblock types based on the provided flags and name.
sourcepub fn filter_superblock_usage(
&mut self,
flag: BlkidFltr,
usage: BlkidUsageFlags
) -> Result<()>
pub fn filter_superblock_usage( &mut self, flag: BlkidFltr, usage: BlkidUsageFlags ) -> Result<()>
Filter devices based on the usages specified in the usage
parameter.
sourcepub fn enable_topology(&mut self, enable: bool) -> Result<()>
pub fn enable_topology(&mut self, enable: bool) -> Result<()>
Enable topology probing.
sourcepub fn get_topology(&mut self) -> Result<BlkidTopology>
pub fn get_topology(&mut self) -> Result<BlkidTopology>
Get the blkid topology of devices.
The topology will be overwritten with each call to this method per the
libblkid documentation. To use multiple topologies simultaneously,
you must use multiple BlkidProbe
structs.
sourcepub fn enable_partitions(&mut self, enable: bool) -> Result<()>
pub fn enable_partitions(&mut self, enable: bool) -> Result<()>
Enable partition probing.
sourcepub fn reset_partition_filter(&mut self) -> Result<()>
pub fn reset_partition_filter(&mut self) -> Result<()>
Reset the partition filter.
sourcepub fn invert_partition_filter(&mut self) -> Result<()>
pub fn invert_partition_filter(&mut self) -> Result<()>
Invert the partition filter.
sourcepub fn filter_partition_types(
&mut self,
flag: BlkidFltr,
names: &[&str]
) -> Result<()>
pub fn filter_partition_types( &mut self, flag: BlkidFltr, names: &[&str] ) -> Result<()>
Probe for partitions using the specified partition types.
This method can either probe for partitions with partition types specified
in names
or only for partition types not found in names
.
sourcepub fn get_partitions(&mut self) -> Result<BlkidPartlist>
pub fn get_partitions(&mut self) -> Result<BlkidPartlist>
Get list of probed partitions.
sourcepub fn do_probe(&mut self) -> Result<BlkidProbeRet>
pub fn do_probe(&mut self) -> Result<BlkidProbeRet>
Probe for signatures at the tag level (TAG=VALUE
). Superblocks will
be probed by default. This method calls only one function call at a time
and should be called in a loop to get results from all probing chains.
sourcepub fn do_safeprobe(&mut self) -> Result<BlkidSafeprobeRet>
pub fn do_safeprobe(&mut self) -> Result<BlkidSafeprobeRet>
Probes all enabled chains and checks for ambiguous results.
sourcepub fn do_fullprobe(&mut self) -> Result<BlkidFullprobeRet>
pub fn do_fullprobe(&mut self) -> Result<BlkidFullprobeRet>
Same as do_safeprobe
but does not check for collisions.
sourcepub fn numof_values(&self) -> Result<usize>
pub fn numof_values(&self) -> Result<usize>
Number of values in probe
sourcepub fn get_value(&self, num: c_uint) -> Result<(String, String)>
pub fn get_value(&self, num: c_uint) -> Result<(String, String)>
Get the tag and value of an entry by the index in the range
0..(self.numof_values())
.
sourcepub fn lookup_value(&self, name: &str) -> Result<String>
pub fn lookup_value(&self, name: &str) -> Result<String>
Get the value for a tag with the given name.
sourcepub fn has_value(&self, name: &str) -> Result<bool>
pub fn has_value(&self, name: &str) -> Result<bool>
Check whether the given name exists in a probe.
sourcepub fn do_wipe(&mut self, dry_run: bool) -> Result<()>
pub fn do_wipe(&mut self, dry_run: bool) -> Result<()>
Wipe the current probed block signature.
sourcepub fn set_request(&mut self, flags: BlkidProbreqFlags) -> Result<()>
pub fn set_request(&mut self, flags: BlkidProbreqFlags) -> Result<()>
Set request flags.