vmm: Make VsockConfig owned

Convert Path to PathBuf and remove the associated lifetime.
Now we can remove the VmConfig associated lifetime.

Fixes #298

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2019-09-23 19:46:35 +02:00
committed by Rob Bradford
parent 3dc7aff00e
commit acc60b0ad5
2 changed files with 13 additions and 13 deletions

View File

@@ -426,7 +426,7 @@ impl Vcpu {
pub struct VmInfo<'a> {
pub memory: &'a Arc<RwLock<GuestMemoryMmap>>,
pub vm_fd: &'a Arc<VmFd>,
pub vm_cfg: &'a VmConfig<'a>,
pub vm_cfg: &'a VmConfig,
}
#[derive(Debug, Clone, Copy, PartialEq)]
@@ -507,7 +507,7 @@ pub struct Vm<'a> {
threads: Vec<thread::JoinHandle<()>>,
devices: DeviceManager,
cpuid: CpuId,
config: &'a VmConfig<'a>,
config: &'a VmConfig,
epoll: EpollContext,
on_tty: bool,
creation_ts: std::time::Instant,
@@ -533,7 +533,7 @@ fn get_host_cpu_phys_bits() -> u8 {
}
impl<'a> Vm<'a> {
pub fn new(kvm: &Kvm, config: &'a VmConfig<'a>) -> Result<Self> {
pub fn new(kvm: &Kvm, config: &'a VmConfig) -> Result<Self> {
let kernel = File::open(&config.kernel.path).map_err(Error::KernelFile)?;
let fd = kvm.create_vm().map_err(Error::VmCreate)?;
let fd = Arc::new(fd);