vm-virtio: pci: Add virtio_device() accessor

Add an accessor to return the underlying VirtioDevice. This is useful
for managing the removal of the device from internal datastructures when
handling virtio-pci device unplug.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-04-09 11:44:48 +01:00 committed by Samuel Ortiz
parent 476e4ce24f
commit 2fa652aa4c

View File

@ -564,6 +564,10 @@ impl VirtioPciDevice {
self.write_bar(0, bar_offset as u64, data)
}
}
pub fn virtio_device(&self) -> Arc<Mutex<dyn VirtioDevice>> {
self.device.clone()
}
}
impl VirtioTransport for VirtioPciDevice {