pub struct LinearDevTargetTable {
    pub table: Vec<TargetLine<LinearDevTargetParams>>,
}
Expand description

A target table for a linear device. Such a table allows flakey targets as well as linear targets.

Fields§

§table: Vec<TargetLine<LinearDevTargetParams>>

The device’s table

Implementations§

Make a new LinearDevTargetTable from a suitable vec

Examples found in repository?
src/lineardev.rs (line 534)
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
    pub fn setup(
        dm: &DM,
        name: &DmName,
        uuid: Option<&DmUuid>,
        table: Vec<TargetLine<LinearDevTargetParams>>,
    ) -> DmResult<LinearDev> {
        let table = LinearDevTargetTable::new(table);
        let dev = if device_exists(dm, name)? {
            let dev_info = dm.device_info(&DevId::Name(name))?;
            let dev = LinearDev {
                dev_info: Box::new(dev_info),
                table,
            };
            device_match(dm, &dev, uuid)?;
            dev
        } else {
            let dev_info = device_create(dm, name, uuid, &table, DmOptions::default())?;
            LinearDev {
                dev_info: Box::new(dev_info),
                table,
            }
        };
        Ok(dev)
    }

    /// 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.
    pub fn set_table(
        &mut self,
        dm: &DM,
        table: Vec<TargetLine<LinearDevTargetParams>>,
    ) -> DmResult<()> {
        let table = LinearDevTargetTable::new(table);
        self.suspend(dm, DmOptions::default().set_flags(DmFlags::DM_NOFLUSH))?;
        self.table_load(dm, &table, DmOptions::default())?;
        self.table = table;
        Ok(())
    }

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The device.
The device’s device node.
Check if tables indicate an equivalent device.
The device’s name.
The number of sectors available for user data.
What the device thinks its table is.
Erase the kernel’s memory of this device.
The device’s UUID, if available. Note that the UUID is not any standard UUID format.
Read the devicemapper table
Resume I/O on the device.
Suspend I/O on the device.
Load a table
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Constructs a table from a raw table returned by DM::table_status()
Generates a table that can be loaded by DM::table_load()

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.