mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vhost_user_fs: add fs cache request operations
This introduces setupmapping and removemapping methods to server.rs,
passthrough.rs and filesystem.rs in order to support virtiofs dax mode
inside guest.
Since we don't really want the server.rs to know that it is dealing with
vhost-user specifically, this is making it more generic by adding a new
trait which has three functions map()/unmap()/sync() corresponding to
fs_slave_{map, unmap, sync}, server.rs will take anything that implements
the trait.
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
This commit is contained in:
@@ -13,8 +13,10 @@ use libc;
|
||||
|
||||
use crate::fuse;
|
||||
|
||||
use super::fs_cache_req_handler::FsCacheReqHandler;
|
||||
pub use fuse::FsOptions;
|
||||
pub use fuse::OpenOptions;
|
||||
pub use fuse::RemovemappingOne;
|
||||
pub use fuse::SetattrValid;
|
||||
pub use fuse::ROOT_ID;
|
||||
|
||||
@@ -1043,6 +1045,31 @@ pub trait FileSystem {
|
||||
Err(io::Error::from_raw_os_error(libc::ENOSYS))
|
||||
}
|
||||
|
||||
/// Setup a mapping so that guest can access files in DAX style.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn setupmapping<T: FsCacheReqHandler>(
|
||||
&self,
|
||||
_ctx: Context,
|
||||
inode: Self::Inode,
|
||||
handle: Self::Handle,
|
||||
foffset: u64,
|
||||
len: u64,
|
||||
flags: u64,
|
||||
moffset: u64,
|
||||
vu_req: &mut T,
|
||||
) -> io::Result<()> {
|
||||
Err(io::Error::from_raw_os_error(libc::ENOSYS))
|
||||
}
|
||||
|
||||
fn removemapping<T: FsCacheReqHandler>(
|
||||
&self,
|
||||
_ctx: Context,
|
||||
requests: Vec<RemovemappingOne>,
|
||||
vu_req: &mut T,
|
||||
) -> io::Result<()> {
|
||||
Err(io::Error::from_raw_os_error(libc::ENOSYS))
|
||||
}
|
||||
|
||||
/// Check file access permissions.
|
||||
///
|
||||
/// This method is called when a userspace process in the client makes an `access()` or
|
||||
|
||||
Reference in New Issue
Block a user