mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-03 11:25:20 +00:00
virtio-devices: block: Rearrange activate() to match other devices
Rearrange the code to match other devices which makes it easier to prep for sharing this between other devices. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
56f03db69c
commit
008cf4a5ae
@ -482,7 +482,9 @@ impl<T: 'static + DiskFile + Send> VirtioDevice for Block<T> {
|
|||||||
})?;
|
})?;
|
||||||
self.pause_evt = Some(self_pause_evt);
|
self.pause_evt = Some(self_pause_evt);
|
||||||
|
|
||||||
let disk_image_id = build_disk_image_id(&self.disk_path);
|
// Save the interrupt EventFD as we need to return it on reset
|
||||||
|
// but clone it to pass into the thread.
|
||||||
|
self.interrupt_cb = Some(interrupt_cb.clone());
|
||||||
|
|
||||||
let mut tmp_queue_evts: Vec<EventFd> = Vec::new();
|
let mut tmp_queue_evts: Vec<EventFd> = Vec::new();
|
||||||
for queue_evt in queue_evts.iter() {
|
for queue_evt in queue_evts.iter() {
|
||||||
@ -495,6 +497,7 @@ impl<T: 'static + DiskFile + Send> VirtioDevice for Block<T> {
|
|||||||
}
|
}
|
||||||
self.queue_evts = Some(tmp_queue_evts);
|
self.queue_evts = Some(tmp_queue_evts);
|
||||||
|
|
||||||
|
let disk_image_id = build_disk_image_id(&self.disk_path);
|
||||||
let event_idx = self.common.feature_acked(VIRTIO_RING_F_EVENT_IDX.into());
|
let event_idx = self.common.feature_acked(VIRTIO_RING_F_EVENT_IDX.into());
|
||||||
self.update_writeback();
|
self.update_writeback();
|
||||||
|
|
||||||
@ -542,10 +545,6 @@ impl<T: 'static + DiskFile + Send> VirtioDevice for Block<T> {
|
|||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the interrupt EventFD as we need to return it on reset
|
|
||||||
// but clone it to pass into the thread.
|
|
||||||
self.interrupt_cb = Some(interrupt_cb);
|
|
||||||
|
|
||||||
self.epoll_threads = Some(epoll_threads);
|
self.epoll_threads = Some(epoll_threads);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user