mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
interrupt: Make notifier function return Option<EventFd>
In anticipation for supporting the notifier function for the legacy interrupt source group, we need this function to return an EventFd instead of a reference to this same EventFd. The reason is we can't return a reference when there's an Arc<Mutex<>> involved in the call chain. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Rob Bradford
parent
62c6efb2e5
commit
acfbee5b7a
@@ -74,8 +74,12 @@ impl InterruptRoute {
|
||||
self.irq_fd.write(1)
|
||||
}
|
||||
|
||||
pub fn notifier(&self) -> Option<&EventFd> {
|
||||
Some(&self.irq_fd)
|
||||
pub fn notifier(&self) -> Option<EventFd> {
|
||||
Some(
|
||||
self.irq_fd
|
||||
.try_clone()
|
||||
.expect("Failed cloning interrupt's EventFd"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +153,7 @@ where
|
||||
))
|
||||
}
|
||||
|
||||
fn notifier(&self, index: InterruptIndex) -> Option<&EventFd> {
|
||||
fn notifier(&self, index: InterruptIndex) -> Option<EventFd> {
|
||||
if let Some(route) = self.irq_routes.get(&index) {
|
||||
return route.notifier();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user