Skip to main content

vm_ch/
directory_sharing.rs

1/// Stores host directory path and read-only flag for virtiofs sharing.
2/// On Linux/KVM, virtiofs requires an external `virtiofsd` process;
3/// this type only holds config and is consumed by VirtualMachine.
4pub struct SharedDirectory {
5    pub(crate) path: String,
6    pub(crate) read_only: bool,
7}
8
9impl SharedDirectory {
10    pub fn new(path: &str, read_only: bool) -> Self {
11        SharedDirectory {
12            path: path.to_string(),
13            read_only,
14        }
15    }
16}
17
18pub struct VirtioFileSystemDevice {
19    pub(crate) tag: String,
20    pub(crate) host_path: String,
21    pub(crate) read_only: bool,
22}
23
24impl VirtioFileSystemDevice {
25    pub fn new(tag: &str, directory: &SharedDirectory) -> Self {
26        VirtioFileSystemDevice {
27            tag: tag.to_string(),
28            host_path: directory.path.clone(),
29            read_only: directory.read_only,
30        }
31    }
32}