Struct devicemapper::LinearDevTargetTable
source · 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§
source§impl LinearDevTargetTable
impl LinearDevTargetTable
sourcepub fn new(
table: Vec<TargetLine<LinearDevTargetParams>>
) -> LinearDevTargetTable
pub fn new(
table: Vec<TargetLine<LinearDevTargetParams>>
) -> LinearDevTargetTable
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§
source§impl Clone for LinearDevTargetTable
impl Clone for LinearDevTargetTable
source§fn clone(&self) -> LinearDevTargetTable
fn clone(&self) -> LinearDevTargetTable
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for LinearDevTargetTable
impl Debug for LinearDevTargetTable
source§impl Display for LinearDevTargetTable
impl Display for LinearDevTargetTable
source§impl DmDevice<LinearDevTargetTable> for LinearDev
impl DmDevice<LinearDevTargetTable> for LinearDev
source§fn equivalent_tables(
left: &LinearDevTargetTable,
right: &LinearDevTargetTable
) -> DmResult<bool>
fn equivalent_tables(
left: &LinearDevTargetTable,
right: &LinearDevTargetTable
) -> DmResult<bool>
Check if tables indicate an equivalent device.
source§fn table(&self) -> &LinearDevTargetTable
fn table(&self) -> &LinearDevTargetTable
What the device thinks its table is.
source§impl PartialEq<LinearDevTargetTable> for LinearDevTargetTable
impl PartialEq<LinearDevTargetTable> for LinearDevTargetTable
source§fn eq(&self, other: &LinearDevTargetTable) -> bool
fn eq(&self, other: &LinearDevTargetTable) -> bool
This method tests for
self and other values to be equal, and is used
by ==.