runtime-rs: Name the ShareFs Mount Option type more accurately

Fixes: #7915

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
alex.lyn
2023-11-20 20:05:50 +08:00
parent 856315ff87
commit fe62e656a7
5 changed files with 12 additions and 12 deletions

View File

@@ -20,7 +20,7 @@ pub use virtio_blk::{
VIRTIO_BLOCK_MMIO, VIRTIO_BLOCK_PCI, VIRTIO_PMEM, VIRTIO_BLOCK_MMIO, VIRTIO_BLOCK_PCI, VIRTIO_PMEM,
}; };
pub use virtio_fs::{ pub use virtio_fs::{
ShareFsConfig, ShareFsDevice, ShareFsMountConfig, ShareFsMountType, ShareFsOperation, ShareFsConfig, ShareFsDevice, ShareFsMountConfig, ShareFsMountOperation, ShareFsMountType,
}; };
pub use virtio_net::{Address, Backend, NetworkConfig, NetworkDevice}; pub use virtio_net::{Address, Backend, NetworkConfig, NetworkDevice};
pub use virtio_vsock::{ pub use virtio_vsock::{

View File

@@ -10,7 +10,7 @@ use async_trait::async_trait;
use crate::device::{hypervisor, Device, DeviceType}; use crate::device::{hypervisor, Device, DeviceType};
#[derive(Copy, Clone, Debug, Default)] #[derive(Copy, Clone, Debug, Default)]
pub enum ShareFsOperation { pub enum ShareFsMountOperation {
#[default] #[default]
Mount, Mount,
Umount, Umount,
@@ -43,7 +43,7 @@ pub struct ShareFsMountConfig {
pub tag: String, pub tag: String,
/// op: the operation to take, e.g. mount, umount or update /// op: the operation to take, e.g. mount, umount or update
pub op: ShareFsOperation, pub op: ShareFsMountOperation,
/// prefetch_list_path: path to file that contains file lists that should be prefetched by rafs /// prefetch_list_path: path to file that contains file lists that should be prefetched by rafs
pub prefetch_list_path: Option<String>, pub prefetch_list_path: Option<String>,

View File

@@ -15,7 +15,7 @@ use dragonball::device_manager::blk_dev_mgr::BlockDeviceType;
use super::DragonballInner; use super::DragonballInner;
use crate::{ use crate::{
device::DeviceType, HybridVsockConfig, NetworkConfig, ShareFsConfig, ShareFsMountConfig, device::DeviceType, HybridVsockConfig, NetworkConfig, ShareFsConfig, ShareFsMountConfig,
ShareFsMountType, ShareFsOperation, VfioBusMode, VfioDevice, VmmState, JAILER_ROOT, ShareFsMountOperation, ShareFsMountType, VfioBusMode, VfioDevice, VmmState, JAILER_ROOT,
}; };
const MB_TO_B: u32 = 1024 * 1024; const MB_TO_B: u32 = 1024 * 1024;
@@ -346,9 +346,9 @@ impl DragonballInner {
fn add_share_fs_mount(&mut self, config: &ShareFsMountConfig) -> Result<()> { fn add_share_fs_mount(&mut self, config: &ShareFsMountConfig) -> Result<()> {
let ops = match config.op { let ops = match config.op {
ShareFsOperation::Mount => "mount", ShareFsMountOperation::Mount => "mount",
ShareFsOperation::Umount => "umount", ShareFsMountOperation::Umount => "umount",
ShareFsOperation::Update => "update", ShareFsMountOperation::Update => "update",
}; };
let fstype = match config.fstype { let fstype = match config.fstype {

View File

@@ -26,7 +26,7 @@ use nix::sched::{setns, CloneFlags};
use seccompiler::BpfProgram; use seccompiler::BpfProgram;
use vmm_sys_util::eventfd::EventFd; use vmm_sys_util::eventfd::EventFd;
use crate::ShareFsOperation; use crate::ShareFsMountOperation;
pub enum Request { pub enum Request {
Sync(VmmAction), Sync(VmmAction),
@@ -238,7 +238,7 @@ impl VmmInstance {
Ok(()) Ok(())
} }
pub fn patch_fs(&self, cfg: &FsMountConfigInfo, op: ShareFsOperation) -> Result<()> { pub fn patch_fs(&self, cfg: &FsMountConfigInfo, op: ShareFsMountOperation) -> Result<()> {
self.handle_request(Request::Sync(VmmAction::ManipulateFsBackendFs(cfg.clone()))) self.handle_request(Request::Sync(VmmAction::ManipulateFsBackendFs(cfg.clone())))
.with_context(|| { .with_context(|| {
format!( format!(

View File

@@ -13,7 +13,7 @@ use tokio::sync::RwLock;
use hypervisor::{ use hypervisor::{
device::{ device::{
device_manager::{do_handle_device, do_update_device, DeviceManager}, device_manager::{do_handle_device, do_update_device, DeviceManager},
driver::{ShareFsMountConfig, ShareFsMountType, ShareFsOperation}, driver::{ShareFsMountConfig, ShareFsMountOperation, ShareFsMountType},
DeviceConfig, DeviceConfig,
}, },
ShareFsConfig, ShareFsConfig,
@@ -89,7 +89,7 @@ pub(crate) async fn setup_inline_virtiofs(d: &RwLock<DeviceManager>, id: &str) -
mount_point: mnt, mount_point: mnt,
config: None, config: None,
tag: String::from(MOUNT_GUEST_TAG), tag: String::from(MOUNT_GUEST_TAG),
op: ShareFsOperation::Mount, op: ShareFsMountOperation::Mount,
prefetch_list_path: None, prefetch_list_path: None,
}; };
@@ -126,7 +126,7 @@ pub async fn rafs_mount(
mount_point: rafs_mnt, mount_point: rafs_mnt,
config: Some(config_content), config: Some(config_content),
tag: String::from(MOUNT_GUEST_TAG), tag: String::from(MOUNT_GUEST_TAG),
op: ShareFsOperation::Mount, op: ShareFsMountOperation::Mount,
prefetch_list_path, prefetch_list_path,
}; };