mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Make vhost-user configuration owned
Convert Path to PathBuf, &str to String and remove the associated lifetime. Fixes #298 Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
committed by
Rob Bradford
parent
5f8a62f3d0
commit
3dc7aff00e
@@ -46,10 +46,10 @@ pub struct Blk {
|
||||
interrupt_cb: Option<Arc<VirtioInterrupt>>,
|
||||
}
|
||||
|
||||
impl<'a> Blk {
|
||||
impl Blk {
|
||||
/// Create a new vhost-user-blk device
|
||||
pub fn new(wce: bool, vu_cfg: VhostUserConfig<'a>) -> Result<Blk> {
|
||||
let mut vhost_user_blk = Master::connect(vu_cfg.sock, vu_cfg.num_queues as u64)
|
||||
pub fn new(wce: bool, vu_cfg: VhostUserConfig) -> Result<Blk> {
|
||||
let mut vhost_user_blk = Master::connect(&vu_cfg.sock, vu_cfg.num_queues as u64)
|
||||
.map_err(Error::VhostUserCreateMaster)?;
|
||||
|
||||
// Filling device and vring features VMM supports.
|
||||
|
||||
@@ -38,10 +38,10 @@ pub struct Net {
|
||||
queue_sizes: Vec<u16>,
|
||||
}
|
||||
|
||||
impl<'a> Net {
|
||||
impl Net {
|
||||
/// Create a new vhost-user-net device
|
||||
pub fn new(mac_addr: MacAddr, vu_cfg: VhostUserConfig<'a>) -> Result<Net> {
|
||||
let mut vhost_user_net = Master::connect(vu_cfg.sock, vu_cfg.num_queues as u64)
|
||||
pub fn new(mac_addr: MacAddr, vu_cfg: VhostUserConfig) -> Result<Net> {
|
||||
let mut vhost_user_net = Master::connect(&vu_cfg.sock, vu_cfg.num_queues as u64)
|
||||
.map_err(Error::VhostUserCreateMaster)?;
|
||||
|
||||
let kill_evt = EventFd::new(EFD_NONBLOCK).map_err(Error::CreateKillEventFd)?;
|
||||
|
||||
@@ -14,9 +14,9 @@ use super::{Error, Result};
|
||||
use vhost_rs::vhost_user::{Master, VhostUserMaster};
|
||||
use vhost_rs::{VhostBackend, VhostUserMemoryRegionInfo, VringConfigData};
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct VhostUserConfig<'a> {
|
||||
pub sock: &'a str,
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct VhostUserConfig {
|
||||
pub sock: String,
|
||||
pub num_queues: usize,
|
||||
pub queue_size: u16,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user