virtio-devices: Clone Queue with method from vm-virtio

Rely on the newly added helper from vm-virtio crate to keep cloning the
list of Queue structures.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2022-05-12 15:28:21 +02:00
parent c622b43f85
commit 64c76693c4
2 changed files with 4 additions and 3 deletions

View File

@ -672,7 +672,8 @@ impl VirtioPciDevice {
let mem = self.memory.as_ref().unwrap().clone();
let mut device = self.device.lock().unwrap();
let mut queue_evts = Vec::new();
let mut queues = self.queues.clone();
let mut queues: Vec<Queue<GuestMemoryAtomic<GuestMemoryMmap>>> =
self.queues.iter().map(vm_virtio::clone_queue).collect();
queues.retain(|q| q.state.ready);
for (i, queue) in queues.iter().enumerate() {
queue_evts.push(self.queue_evts[i].try_clone().unwrap());

View File

@ -224,7 +224,7 @@ impl<S: VhostUserMasterReqHandler> VhostUserEpollHandler<S> {
vhost_user
.reinitialize_vhost_user(
self.mem.memory().deref(),
self.queues.clone(),
self.queues.iter().map(vm_virtio::clone_queue).collect(),
self.queue_evts
.iter()
.map(|q| q.try_clone().unwrap())
@ -324,7 +324,7 @@ impl VhostUserCommon {
.unwrap()
.setup_vhost_user(
&mem.memory(),
queues.clone(),
queues.iter().map(vm_virtio::clone_queue).collect(),
queue_evts.iter().map(|q| q.try_clone().unwrap()).collect(),
&interrupt_cb,
acked_features,