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

@@ -319,6 +319,13 @@ impl VirtioCommon {
// Return the interrupt
Some(self.interrupt_cb.take().unwrap())
}
pub fn dup_eventfds(&self) -> (EventFd, EventFd) {
(
self.kill_evt.as_ref().unwrap().try_clone().unwrap(),
self.pause_evt.as_ref().unwrap().try_clone().unwrap(),
)
}
}
impl Pausable for VirtioCommon {