mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-01 02:55:45 +00:00
vmm: Make PmemConfig owned
Convert Path to PathBuf and remove the associated lifetime. Fixes #298 Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
00674cd850
commit
79a02f9171
@ -368,13 +368,13 @@ impl FsConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PmemConfig<'a> {
|
pub struct PmemConfig {
|
||||||
pub file: &'a Path,
|
pub file: PathBuf,
|
||||||
pub size: u64,
|
pub size: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PmemConfig<'a> {
|
impl PmemConfig {
|
||||||
pub fn parse(pmem: &'a str) -> Result<Self> {
|
pub fn parse(pmem: &str) -> Result<Self> {
|
||||||
// Split the parameters based on the comma delimiter
|
// Split the parameters based on the comma delimiter
|
||||||
let params_list: Vec<&str> = pmem.split(',').collect();
|
let params_list: Vec<&str> = pmem.split(',').collect();
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ impl<'a> PmemConfig<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ok(PmemConfig {
|
Ok(PmemConfig {
|
||||||
file: Path::new(file_str),
|
file: PathBuf::from(file_str),
|
||||||
size: parse_size(size_str)?,
|
size: parse_size(size_str)?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -617,7 +617,7 @@ pub struct VmConfig<'a> {
|
|||||||
pub net: Option<Vec<NetConfig>>,
|
pub net: Option<Vec<NetConfig>>,
|
||||||
pub rng: RngConfig,
|
pub rng: RngConfig,
|
||||||
pub fs: Option<Vec<FsConfig>>,
|
pub fs: Option<Vec<FsConfig>>,
|
||||||
pub pmem: Option<Vec<PmemConfig<'a>>>,
|
pub pmem: Option<Vec<PmemConfig>>,
|
||||||
pub serial: ConsoleConfig<'a>,
|
pub serial: ConsoleConfig<'a>,
|
||||||
pub console: ConsoleConfig<'a>,
|
pub console: ConsoleConfig<'a>,
|
||||||
pub devices: Option<Vec<DeviceConfig<'a>>>,
|
pub devices: Option<Vec<DeviceConfig<'a>>>,
|
||||||
|
@ -719,7 +719,7 @@ impl DeviceManager {
|
|||||||
.read(true)
|
.read(true)
|
||||||
.write(true)
|
.write(true)
|
||||||
.custom_flags(custom_flags)
|
.custom_flags(custom_flags)
|
||||||
.open(pmem_cfg.file)
|
.open(&pmem_cfg.file)
|
||||||
.map_err(DeviceManagerError::PmemFileOpen)?;
|
.map_err(DeviceManagerError::PmemFileOpen)?;
|
||||||
|
|
||||||
if set_len {
|
if set_len {
|
||||||
|
Loading…
Reference in New Issue
Block a user