pci: Remove ioeventfds() from PciDevice trait

The PciDevice trait is supposed to describe only functions related to
PCI. The specific method ioeventfds() has nothing to do with PCI, but
instead would be more specific to virtio transport devices.

This commit removes the ioeventfds() method from the PciDevice trait,
adding some convenient helper as_any() to retrieve the Any trait from
the structure behing the PciDevice trait. This is the only way to keep
calling into ioeventfds() function from VirtioPciDevice, so that we can
still properly reprogram the PCI BAR.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2019-10-30 08:15:38 -07:00
committed by Samuel Ortiz
parent 3be95dbf93
commit de21c9ba4f
5 changed files with 42 additions and 26 deletions

View File

@@ -20,6 +20,7 @@ use pci::{
PciCapabilityID, PciClassCode, PciConfiguration, PciDevice, PciDeviceError, PciHeaderType,
PciSubclass, MSIX_TABLE_ENTRY_SIZE,
};
use std::any::Any;
use std::os::unix::io::AsRawFd;
use std::ptr::null_mut;
use std::sync::Arc;
@@ -1045,4 +1046,8 @@ impl PciDevice for VfioPciDevice {
Ok(())
}
fn as_any(&mut self) -> &mut dyn Any {
self
}
}