virtio-devices: Add helper to VirtioCommon for EventFd duplication

Add a helper to VirtioCommon which returns duplicates of the EventFds
for kill and pause event.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford
2021-06-02 18:08:06 +00:00
committed by Bo Chen
parent df92495e31
commit 280bef834b
13 changed files with 21 additions and 284 deletions

View File

@@ -402,26 +402,7 @@ impl VirtioDevice for Console {
}
}
let kill_evt = self
.common
.kill_evt
.as_ref()
.unwrap()
.try_clone()
.map_err(|e| {
error!("failed to clone kill_evt eventfd: {}", e);
ActivateError::BadActivate
})?;
let pause_evt = self
.common
.pause_evt
.as_ref()
.unwrap()
.try_clone()
.map_err(|e| {
error!("failed to clone pause_evt eventfd: {}", e);
ActivateError::BadActivate
})?;
let (kill_evt, pause_evt) = self.common.dup_eventfds();
let mut handler = ConsoleEpollHandler {
queues,