mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-04 19:11:11 +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 file: &'a Path,
|
||||
pub struct PmemConfig {
|
||||
pub file: PathBuf,
|
||||
pub size: u64,
|
||||
}
|
||||
|
||||
impl<'a> PmemConfig<'a> {
|
||||
pub fn parse(pmem: &'a str) -> Result<Self> {
|
||||
impl PmemConfig {
|
||||
pub fn parse(pmem: &str) -> Result<Self> {
|
||||
// Split the parameters based on the comma delimiter
|
||||
let params_list: Vec<&str> = pmem.split(',').collect();
|
||||
|
||||
@ -394,7 +394,7 @@ impl<'a> PmemConfig<'a> {
|
||||
}
|
||||
|
||||
Ok(PmemConfig {
|
||||
file: Path::new(file_str),
|
||||
file: PathBuf::from(file_str),
|
||||
size: parse_size(size_str)?,
|
||||
})
|
||||
}
|
||||
@ -617,7 +617,7 @@ pub struct VmConfig<'a> {
|
||||
pub net: Option<Vec<NetConfig>>,
|
||||
pub rng: RngConfig,
|
||||
pub fs: Option<Vec<FsConfig>>,
|
||||
pub pmem: Option<Vec<PmemConfig<'a>>>,
|
||||
pub pmem: Option<Vec<PmemConfig>>,
|
||||
pub serial: ConsoleConfig<'a>,
|
||||
pub console: ConsoleConfig<'a>,
|
||||
pub devices: Option<Vec<DeviceConfig<'a>>>,
|
||||
|
@ -719,7 +719,7 @@ impl DeviceManager {
|
||||
.read(true)
|
||||
.write(true)
|
||||
.custom_flags(custom_flags)
|
||||
.open(pmem_cfg.file)
|
||||
.open(&pmem_cfg.file)
|
||||
.map_err(DeviceManagerError::PmemFileOpen)?;
|
||||
|
||||
if set_len {
|
||||
|
Loading…
Reference in New Issue
Block a user