vmm: Make FsConfig 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:23:17 +02:00 committed by Rob Bradford
parent 5323da031c
commit 00674cd850
2 changed files with 9 additions and 9 deletions

View File

@ -281,16 +281,16 @@ impl RngConfig {
}
#[derive(Debug)]
pub struct FsConfig<'a> {
pub tag: &'a str,
pub sock: &'a Path,
pub struct FsConfig {
pub tag: String,
pub sock: PathBuf,
pub num_queues: usize,
pub queue_size: u16,
pub cache_size: Option<u64>,
}
impl<'a> FsConfig<'a> {
pub fn parse(fs: &'a str) -> Result<Self> {
impl FsConfig {
pub fn parse(fs: &str) -> Result<Self> {
// Split the parameters based on the comma delimiter
let params_list: Vec<&str> = fs.split(',').collect();
@ -359,8 +359,8 @@ impl<'a> FsConfig<'a> {
}
Ok(FsConfig {
tag,
sock: Path::new(sock),
tag: tag.to_string(),
sock: PathBuf::from(sock),
num_queues,
queue_size,
cache_size,
@ -616,7 +616,7 @@ pub struct VmConfig<'a> {
pub disks: Option<Vec<DiskConfig>>,
pub net: Option<Vec<NetConfig>>,
pub rng: RngConfig,
pub fs: Option<Vec<FsConfig<'a>>>,
pub fs: Option<Vec<FsConfig>>,
pub pmem: Option<Vec<PmemConfig<'a>>>,
pub serial: ConsoleConfig<'a>,
pub console: ConsoleConfig<'a>,

View File

@ -676,7 +676,7 @@ impl DeviceManager {
let virtio_fs_device = vm_virtio::vhost_user::Fs::new(
fs_sock,
fs_cfg.tag,
&fs_cfg.tag,
fs_cfg.num_queues,
fs_cfg.queue_size,
cache,