@@ -71,12 +71,7 @@ struct AddrMapping {
7171 gpa_base : u64 ,
7272}
7373
74- pub struct VhostUserHandler < S , V , B >
75- where
76- S : VhostUserBackend < V , B > ,
77- V : VringT < GM < B > > ,
78- B : Bitmap + ' static ,
79- {
74+ pub struct VhostUserHandler < S , V , B : Bitmap + ' static > {
8075 backend : S ,
8176 handlers : Vec < Arc < VringEpollHandler < S , V , B > > > ,
8277 owned : bool ,
@@ -92,11 +87,12 @@ where
9287 worker_threads : Vec < thread:: JoinHandle < VringEpollResult < ( ) > > > ,
9388}
9489
90+ // Ensure VhostUserHandler: Clone + Send + Sync + 'static.
9591impl < S , V , B > VhostUserHandler < S , V , B >
9692where
97- S : VhostUserBackend < V , B > + Clone ,
93+ S : VhostUserBackend < V , B > + Clone + ' static ,
9894 V : VringT < GM < B > > + Clone + Send + Sync + ' static ,
99- B : Bitmap + Clone + Send + Sync ,
95+ B : Bitmap + Clone + Send + Sync + ' static ,
10096{
10197 pub ( crate ) fn new ( backend : S , atomic_mem : GM < B > ) -> VhostUserHandlerResult < Self > {
10298 let num_queues = backend. num_queues ( ) ;
@@ -151,16 +147,7 @@ where
151147 }
152148}
153149
154- impl < S , V , B > VhostUserHandler < S , V , B >
155- where
156- S : VhostUserBackend < V , B > ,
157- V : VringT < GM < B > > ,
158- B : Bitmap ,
159- {
160- pub ( crate ) fn get_epoll_handlers ( & self ) -> Vec < Arc < VringEpollHandler < S , V , B > > > {
161- self . handlers . clone ( )
162- }
163-
150+ impl < S , V , B : Bitmap > VhostUserHandler < S , V , B > {
164151 pub ( crate ) fn send_exit_event ( & self ) {
165152 for handler in self . handlers . iter ( ) {
166153 handler. send_exit_event ( ) ;
@@ -176,6 +163,17 @@ where
176163
177164 Err ( VhostUserHandlerError :: MissingMemoryMapping )
178165 }
166+ }
167+
168+ impl < S , V , B > VhostUserHandler < S , V , B >
169+ where
170+ S : VhostUserBackend < V , B > ,
171+ V : VringT < GM < B > > ,
172+ B : Bitmap ,
173+ {
174+ pub ( crate ) fn get_epoll_handlers ( & self ) -> Vec < Arc < VringEpollHandler < S , V , B > > > {
175+ self . handlers . clone ( )
176+ }
179177
180178 fn vring_needs_init ( & self , vring : & V ) -> bool {
181179 let vring_state = vring. get_ref ( ) ;
@@ -581,12 +579,7 @@ where
581579 }
582580}
583581
584- impl < S , V , B > Drop for VhostUserHandler < S , V , B >
585- where
586- S : VhostUserBackend < V , B > ,
587- V : VringT < GM < B > > ,
588- B : Bitmap ,
589- {
582+ impl < S , V , B : Bitmap > Drop for VhostUserHandler < S , V , B > {
590583 fn drop ( & mut self ) {
591584 // Signal all working threads to exit.
592585 self . send_exit_event ( ) ;
0 commit comments