Struct libblkid_rs::BlkidProbe

source ·
pub struct BlkidProbe(/* private fields */);
Expand description

A structure for probing block devices.

Implementations§

source§

impl BlkidProbe

source

pub fn new() -> Result<Self>

Allocate and create a new libblkid probe.

source

pub fn new_from_filename(filename: &Path) -> Result<Self>

Create a new probe from a filename.

source

pub fn reset(&mut self)

Reset the probe.

source

pub fn reset_buffers(&mut self) -> Result<()>

Reset and free all buffers used in the probe.

source

pub fn hide_range(&mut self, offset: u64, len: u64) -> Result<()>

Hide a memory range in the probe from the next do_probe call.

source

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.

source

pub fn get_devno(&self) -> BlkidDevno

Get the device number associated with the probe device.

source

pub fn get_wholedisk_devno(&self) -> BlkidDevno

Get the device number of the whole disk

source

pub fn is_wholedisk(&self) -> bool

Check if the given device is an entire disk (instead of a partition or something similar)

source

pub fn get_size(&self) -> blkid_loff_t

Get the size of of a device.

source

pub fn get_offset(&self) -> blkid_loff_t

Get the offset of a probing area of a device.

source

pub fn get_sector_size(&self) -> c_uint

Get the sector size of the attached device.

source

pub fn get_fd(&self) -> Result<RawFd>

Get a file descriptor associated with the given device.

source

pub fn enable_superblocks(&mut self, enable: bool) -> Result<()>

Enable superblock probing.

source

pub fn set_superblock_flags(&mut self, flags: BlkidSublksFlags) -> Result<()>

Set the superblock probing flags.

source

pub fn reset_superblock_filter(&mut self) -> Result<()>

Reset the superblock probing filter.

source

pub fn invert_superblock_filter(&mut self) -> Result<()>

Invert the superblock probing filter.

source

pub fn filter_superblock_type( &mut self, flag: BlkidFltr, names: &[&str] ) -> Result<()>

Filter superblock types based on the provided flags and name.

source

pub fn filter_superblock_usage( &mut self, flag: BlkidFltr, usage: BlkidUsageFlags ) -> Result<()>

Filter devices based on the usages specified in the usage parameter.

source

pub fn enable_topology(&mut self, enable: bool) -> Result<()>

Enable topology probing.

source

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.

source

pub fn enable_partitions(&mut self, enable: bool) -> Result<()>

Enable partition probing.

source

pub fn reset_partition_filter(&mut self) -> Result<()>

Reset the partition filter.

source

pub fn invert_partition_filter(&mut self) -> Result<()>

Invert the partition filter.

source

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.

source

pub fn get_partitions(&mut self) -> Result<BlkidPartlist>

Get list of probed partitions.

source

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.

source

pub fn do_safeprobe(&mut self) -> Result<BlkidSafeprobeRet>

Probes all enabled chains and checks for ambiguous results.

source

pub fn do_fullprobe(&mut self) -> Result<BlkidFullprobeRet>

Same as do_safeprobe but does not check for collisions.

source

pub fn numof_values(&self) -> Result<usize>

Number of values in probe

source

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()).

source

pub fn lookup_value(&self, name: &str) -> Result<String>

Get the value for a tag with the given name.

source

pub fn has_value(&self, name: &str) -> Result<bool>

Check whether the given name exists in a probe.

source

pub fn do_wipe(&mut self, dry_run: bool) -> Result<()>

Wipe the current probed block signature.

source

pub fn step_back(&mut self) -> Result<()>

Set the probing on step back on the probing chain.

source

pub fn set_request(&mut self, flags: BlkidProbreqFlags) -> Result<()>

Set request flags.

Trait Implementations§

source§

impl Drop for BlkidProbe

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.