vmm: Make KernelConfig 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 18:54:00 +02:00 committed by Rob Bradford
parent 9c5bfb8e13
commit 036890e5be

View File

@ -172,14 +172,14 @@ impl MemoryConfig {
}
}
pub struct KernelConfig<'a> {
pub path: &'a Path,
pub struct KernelConfig {
pub path: PathBuf,
}
impl<'a> KernelConfig<'a> {
pub fn parse(kernel: &'a str) -> Result<Self> {
impl KernelConfig {
pub fn parse(kernel: &str) -> Result<Self> {
Ok(KernelConfig {
path: Path::new(kernel),
path: PathBuf::from(kernel),
})
}
}
@ -611,7 +611,7 @@ impl<'a> VhostUserBlkConfig<'a> {
pub struct VmConfig<'a> {
pub cpus: CpusConfig,
pub memory: MemoryConfig,
pub kernel: KernelConfig<'a>,
pub kernel: KernelConfig,
pub cmdline: CmdlineConfig,
pub disks: Option<Vec<DiskConfig<'a>>>,
pub net: Option<Vec<NetConfig<'a>>>,