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:
Samuel Ortiz
2019-09-23 19:42:52 +02:00
committed by Rob Bradford
parent 5f8a62f3d0
commit 3dc7aff00e
5 changed files with 23 additions and 23 deletions

View File

@@ -463,13 +463,13 @@ impl DeviceConfig {
}
}
pub struct VhostUserNetConfig<'a> {
pub struct VhostUserNetConfig {
pub mac: MacAddr,
pub vu_cfg: VhostUserConfig<'a>,
pub vu_cfg: VhostUserConfig,
}
impl<'a> VhostUserNetConfig<'a> {
pub fn parse(vhost_user_net: &'a str) -> Result<Self> {
impl VhostUserNetConfig {
pub fn parse(vhost_user_net: &str) -> Result<Self> {
// Split the parameters based on the comma delimiter
let params_list: Vec<&str> = vhost_user_net.split(',').collect();
@@ -512,7 +512,7 @@ impl<'a> VhostUserNetConfig<'a> {
}
let vu_cfg = VhostUserConfig {
sock,
sock: sock.to_string(),
num_queues,
queue_size,
};
@@ -553,13 +553,13 @@ impl<'a> VsockConfig<'a> {
}
}
pub struct VhostUserBlkConfig<'a> {
pub struct VhostUserBlkConfig {
pub wce: bool,
pub vu_cfg: VhostUserConfig<'a>,
pub vu_cfg: VhostUserConfig,
}
impl<'a> VhostUserBlkConfig<'a> {
pub fn parse(vhost_user_blk: &'a str) -> Result<Self> {
impl VhostUserBlkConfig {
pub fn parse(vhost_user_blk: &str) -> Result<Self> {
// Split the parameters based on the comma delimiter
let params_list: Vec<&str> = vhost_user_blk.split(',').collect();
@@ -599,7 +599,7 @@ impl<'a> VhostUserBlkConfig<'a> {
}
let vu_cfg = VhostUserConfig {
sock,
sock: sock.to_string(),
num_queues,
queue_size,
};
@@ -621,8 +621,8 @@ pub struct VmConfig<'a> {
pub serial: ConsoleConfig,
pub console: ConsoleConfig,
pub devices: Option<Vec<DeviceConfig>>,
pub vhost_user_net: Option<Vec<VhostUserNetConfig<'a>>>,
pub vhost_user_blk: Option<Vec<VhostUserBlkConfig<'a>>>,
pub vhost_user_net: Option<Vec<VhostUserNetConfig>>,
pub vhost_user_blk: Option<Vec<VhostUserBlkConfig>>,
pub vsock: Option<Vec<VsockConfig<'a>>>,
}