mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: Make EpollHandler more generic
Instead of passing only the event type through the handle_event() callback, we make the trait slightly more generic by providing the epoll event to each virtio device implementation. This is particularly useful for vsock as it will need the event set. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Rob Bradford
parent
1e0b516a84
commit
01e7bd7276
@@ -33,7 +33,7 @@ pub const EPOLL_HELPER_EVENT_LAST: u16 = 15;
|
||||
|
||||
pub trait EpollHelperHandler {
|
||||
// Return true if execution of the loop should be stopped
|
||||
fn handle_event(&mut self, helper: &mut EpollHelper, event: u16) -> bool;
|
||||
fn handle_event(&mut self, helper: &mut EpollHelper, event: &epoll::Event) -> bool;
|
||||
}
|
||||
|
||||
impl EpollHelper {
|
||||
@@ -122,8 +122,8 @@ impl EpollHelper {
|
||||
// and every thread related to this virtio device.
|
||||
let _ = self.pause_evt.read();
|
||||
}
|
||||
id => {
|
||||
if handler.handle_event(self, id) {
|
||||
_ => {
|
||||
if handler.handle_event(self, event) {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user