@@ -14,16 +14,7 @@ mod virtiofs {
1414 use std:: io;
1515 use std:: os:: unix:: io:: RawFd ;
1616
17- #[ cfg( feature = "vhost-user-fs" ) ]
18- use vhost:: vhost_user:: message:: {
19- VhostUserFSBackendMsg , VhostUserFSBackendMsgFlags , VHOST_USER_FS_BACKEND_ENTRIES ,
20- } ;
21- #[ cfg( feature = "vhost-user-fs" ) ]
22- use vhost:: vhost_user:: { Backend , VhostUserFrontendReqHandler } ;
23-
2417 use crate :: abi:: virtio_fs:: RemovemappingOne ;
25- #[ cfg( feature = "vhost-user-fs" ) ]
26- use crate :: abi:: virtio_fs:: SetupmappingFlags ;
2718
2819 /// Trait to support virtio-fs DAX Window operations.
2920 ///
@@ -52,45 +43,4 @@ mod virtiofs {
5243 /// Remove those mappings that provide the access to file data.
5344 fn unmap ( & mut self , requests : Vec < RemovemappingOne > ) -> io:: Result < ( ) > ;
5445 }
55-
56- #[ cfg( feature = "vhost-user-fs" ) ]
57- impl FsCacheReqHandler for Backend {
58- fn map (
59- & mut self ,
60- foffset : u64 ,
61- moffset : u64 ,
62- len : u64 ,
63- flags : u64 ,
64- fd : RawFd ,
65- ) -> io:: Result < ( ) > {
66- let mut msg: VhostUserFSBackendMsg = Default :: default ( ) ;
67- msg. fd_offset [ 0 ] = foffset;
68- msg. cache_offset [ 0 ] = moffset;
69- msg. len [ 0 ] = len;
70- msg. flags [ 0 ] = if ( flags & SetupmappingFlags :: WRITE . bits ( ) ) != 0 {
71- VhostUserFSBackendMsgFlags :: MAP_W | VhostUserFSBackendMsgFlags :: MAP_R
72- } else {
73- VhostUserFSBackendMsgFlags :: MAP_R
74- } ;
75-
76- self . fs_backend_map ( & msg, & fd) ?;
77-
78- Ok ( ( ) )
79- }
80-
81- fn unmap ( & mut self , requests : Vec < RemovemappingOne > ) -> io:: Result < ( ) > {
82- for chunk in requests. chunks ( VHOST_USER_FS_BACKEND_ENTRIES ) {
83- let mut msg: VhostUserFSBackendMsg = Default :: default ( ) ;
84-
85- for ( ind, req) in chunk. iter ( ) . enumerate ( ) {
86- msg. len [ ind] = req. len ;
87- msg. cache_offset [ ind] = req. moffset ;
88- }
89-
90- self . fs_backend_unmap ( & msg) ?;
91- }
92-
93- Ok ( ( ) )
94- }
95- }
9646}
0 commit comments