Struct devicemapper::LinearTargetParams
source · Expand description
Struct representing params for a linear target
Fields§
§device: DeviceDevice on which this segment resides.
start_offset: SectorsStart offset in device on which this segment resides.
Implementations§
source§impl LinearTargetParams
impl LinearTargetParams
sourcepub fn new(device: Device, start_offset: Sectors) -> LinearTargetParams
pub fn new(device: Device, start_offset: Sectors) -> LinearTargetParams
Create a new LinearTargetParams struct
Examples found in repository?
src/lineardev.rs (line 70)
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
fn from_str(s: &str) -> DmResult<LinearTargetParams> {
let vals = s.split(' ').collect::<Vec<_>>();
if vals.len() != 3 {
let err_msg = format!(
"expected 3 values in params string \"{}\", found {}",
s,
vals.len()
);
return Err(DmError::Dm(ErrorEnum::Invalid, err_msg));
}
if vals[0] != LINEAR_TARGET_NAME {
let err_msg = format!(
"Expected a linear target entry but found target type {}",
vals[0]
);
return Err(DmError::Dm(ErrorEnum::Invalid, err_msg));
}
let device = parse_device(vals[1], "block device for linear target")?;
let start = Sectors(parse_value(vals[2], "physical start offset")?);
Ok(LinearTargetParams::new(device, start))
}Trait Implementations§
source§impl Clone for LinearTargetParams
impl Clone for LinearTargetParams
source§fn clone(&self) -> LinearTargetParams
fn clone(&self) -> LinearTargetParams
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 LinearTargetParams
impl Debug for LinearTargetParams
source§impl Display for LinearTargetParams
impl Display for LinearTargetParams
source§impl FromStr for LinearTargetParams
impl FromStr for LinearTargetParams
source§impl PartialEq<LinearTargetParams> for LinearTargetParams
impl PartialEq<LinearTargetParams> for LinearTargetParams
source§fn eq(&self, other: &LinearTargetParams) -> bool
fn eq(&self, other: &LinearTargetParams) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl TargetParams for LinearTargetParams
impl TargetParams for LinearTargetParams
source§fn target_type(&self) -> TargetTypeBuf
fn target_type(&self) -> TargetTypeBuf
Return the target type