vmm: Make DiskConfig 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:
Samuel Ortiz
2019-09-23 19:12:19 +02:00
committed by Rob Bradford
parent 036890e5be
commit 675e46355c
2 changed files with 11 additions and 13 deletions
+6 -6
View File
@@ -205,14 +205,14 @@ impl CmdlineConfig {
}
#[derive(Debug)]
pub struct DiskConfig<'a> {
pub path: &'a Path,
pub struct DiskConfig {
pub path: PathBuf,
}
impl<'a> DiskConfig<'a> {
pub fn parse(disk: &'a str) -> Result<Self> {
impl DiskConfig {
pub fn parse(disk: &str) -> Result<Self> {
Ok(DiskConfig {
path: Path::new(disk),
path: PathBuf::from(disk),
})
}
}
@@ -613,7 +613,7 @@ pub struct VmConfig<'a> {
pub memory: MemoryConfig,
pub kernel: KernelConfig,
pub cmdline: CmdlineConfig,
pub disks: Option<Vec<DiskConfig<'a>>>,
pub disks: Option<Vec<DiskConfig>>,
pub net: Option<Vec<NetConfig<'a>>>,
pub rng: RngConfig<'a>,
pub fs: Option<Vec<FsConfig<'a>>>,