Struct LinearDev

Source
pub struct LinearDev { /* private fields */ }
Expand description

A DM construct of combined Segments

Implementations§

Source§

impl LinearDev

Use DM to concatenate a list of segments together into a linear block device of continuous sectors.

Source

pub fn setup( dm: &DM, name: &DmName, uuid: Option<&DmUuid>, table: Vec<TargetLine<LinearDevTargetParams>>, ) -> DmResult<LinearDev>

Construct a new block device by concatenating the given segments into linear space. If the device is already known to the kernel, just verifies that the segments argument passed exactly matches the kernel data.

Warning: If the segments overlap, this method will succeed. However, the behavior of the linear device in that case should be treated as undefined.

Note: A linear device is just a mapping in the kernel from locations in that device to locations on other devices which are specified by their device number. There is usually a device node so that data can be read from and written to the device. Other than that, it really has no existence. Consequently, there is no conflict in overloading this method to mean both “make a wholly new device” and “establish the existence of the requested device”. Of course, a linear device is usually expected to hold data, so it is important to get the mapping just right.

Source

pub fn set_table( &mut self, dm: &DM, table: Vec<TargetLine<LinearDevTargetParams>>, ) -> DmResult<()>

Set the segments for this linear device. This action puts the device in a state where it is ready to be resumed. Warning: It is the client’s responsibility to make sure the designated segments are compatible with the device’s existing segments. If they are not, this function will still succeed, but some kind of data corruption will be the inevitable result.

Source

pub fn set_name(&mut self, dm: &DM, name: &DmName) -> DmResult<()>

Set the name for this LinearDev.

Trait Implementations§

Source§

impl Debug for LinearDev

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DmDevice<LinearDevTargetTable> for LinearDev

Source§

fn device(&self) -> Device

The device.
Source§

fn devnode(&self) -> PathBuf

The device’s device node.
Source§

fn equivalent_tables( left: &LinearDevTargetTable, right: &LinearDevTargetTable, ) -> DmResult<bool>

Check if tables indicate an equivalent device.
Source§

fn name(&self) -> &DmName

The device’s name.
Source§

fn size(&self) -> Sectors

The number of sectors available for user data.
Source§

fn table(&self) -> &LinearDevTargetTable

What the device thinks its table is.
Source§

fn teardown(&mut self, dm: &DM) -> DmResult<()>

Erase the kernel’s memory of this device.
Source§

fn uuid(&self) -> Option<&DmUuid>

The device’s UUID, if available. Note that the UUID is not any standard UUID format.
Source§

fn read_kernel_table(dm: &DM, id: &DevId<'_>) -> DmResult<T>

Read the devicemapper table
Source§

fn resume(&mut self, dm: &DM) -> DmResult<()>

Resume I/O on the device.
Source§

fn suspend(&mut self, dm: &DM, options: DmOptions) -> DmResult<()>

Suspend I/O on the device.
Source§

fn table_load(&self, dm: &DM, table: &T, options: DmOptions) -> DmResult<()>

Load a table

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>,

Source§

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>,

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V