(&mut self, context: crate::device::ActivationContext)
| 242 | } |
| 243 | |
| 244 | fn activate(&mut self, context: crate::device::ActivationContext) -> ActivateResult { |
| 245 | let crate::device::ActivationContext { |
| 246 | mem, |
| 247 | interrupt_cb, |
| 248 | queues, |
| 249 | device_status, |
| 250 | } = context; |
| 251 | self.vu_common |
| 252 | .virtio_common |
| 253 | .activate(&queues, interrupt_cb.clone())?; |
| 254 | self.guest_memory = Some(mem.clone()); |
| 255 | |
| 256 | let backend_req_handler: Option<FrontendReqHandler<BackendReqHandler>> = None; |
| 257 | // Run a dedicated thread for handling potential reconnections with |
| 258 | // the backend. |
| 259 | let (kill_evt, pause_evt) = self.vu_common.virtio_common.dup_eventfds(); |
| 260 | |
| 261 | let mut handler = self.vu_common.activate( |
| 262 | mem, |
| 263 | &queues, |
| 264 | interrupt_cb.clone(), |
| 265 | self.vu_common.virtio_common.acked_features, |
| 266 | backend_req_handler, |
| 267 | kill_evt, |
| 268 | pause_evt, |
| 269 | )?; |
| 270 | |
| 271 | let paused = self.vu_common.virtio_common.paused.clone(); |
| 272 | let paused_sync = self.vu_common.virtio_common.paused_sync.clone(); |
| 273 | |
| 274 | let mut epoll_threads = Vec::new(); |
| 275 | spawn_virtio_thread( |
| 276 | &self.id, |
| 277 | &self.seccomp_action, |
| 278 | Thread::VirtioVhostFs, |
| 279 | &mut epoll_threads, |
| 280 | &self.exit_evt, |
| 281 | device_status.clone(), |
| 282 | interrupt_cb.clone(), |
| 283 | move || handler.run(&paused, paused_sync.as_ref().unwrap()), |
| 284 | )?; |
| 285 | self.vu_common.epoll_thread = Some(epoll_threads.remove(0)); |
| 286 | |
| 287 | event!("virtio-device", "activated", "id", &self.id); |
| 288 | Ok(()) |
| 289 | } |
| 290 | |
| 291 | fn reset(&mut self) { |
| 292 | self.vu_common.reset(&self.id); |
nothing calls this directly
no test coverage detected