Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx> --- src/qemu/qemu_hostdev.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 972ea09..c35a5df 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -43,6 +43,7 @@ static int virHostdevUpdateActivePciHostdevs(virHostdevManagerPtr mgr, + const char *drv_name, virDomainDefPtr def) { @@ -80,7 +81,7 @@ virHostdevUpdateActivePciHostdevs(virHostdevManagerPtr mgr, goto cleanup; } - virPCIDeviceSetUsedBy(dev, QEMU_DRIVER_NAME, def->name); + virPCIDeviceSetUsedBy(dev, drv_name, def->name); /* Setup the original states for the PCI device */ virPCIDeviceSetUnbindFromStub(dev, hostdev->origstates.states.pci.unbind_from_stub); @@ -112,11 +113,12 @@ qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, if (mgr == NULL) return -1; - return virHostdevUpdateActivePciHostdevs(mgr, def); + return virHostdevUpdateActivePciHostdevs(mgr, QEMU_DRIVER_NAME, def); } static int virHostdevUpdateActiveUsbHostdevs(virHostdevManagerPtr mgr, + const char *drv_name, virDomainDefPtr def) { virDomainHostdevDefPtr hostdev = NULL; @@ -144,7 +146,7 @@ virHostdevUpdateActiveUsbHostdevs(virHostdevManagerPtr mgr, continue; } - virUSBDeviceSetUsedBy(usb, QEMU_DRIVER_NAME, def->name); + virUSBDeviceSetUsedBy(usb, drv_name, def->name); if (virUSBDeviceListAdd(mgr->activeUsbHostdevs, usb) < 0) { virUSBDeviceFree(usb); @@ -169,11 +171,12 @@ qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, if (mgr == NULL) return -1; - return virHostdevUpdateActiveUsbHostdevs(mgr, def); + return virHostdevUpdateActiveUsbHostdevs(mgr, QEMU_DRIVER_NAME, def); } static int virHostdevUpdateActiveScsiHostdevs(virHostdevManagerPtr mgr, + const char *drv_name, virDomainDefPtr def) { virDomainHostdevDefPtr hostdev = NULL; @@ -200,13 +203,13 @@ virHostdevUpdateActiveScsiHostdevs(virHostdevManagerPtr mgr, goto cleanup; if ((tmp = virSCSIDeviceListFind(mgr->activeScsiHostdevs, scsi))) { - if (virSCSIDeviceSetUsedBy(tmp, QEMU_DRIVER_NAME, def->name) < 0) { + if (virSCSIDeviceSetUsedBy(tmp, drv_name, def->name) < 0) { virSCSIDeviceFree(scsi); goto cleanup; } virSCSIDeviceFree(scsi); } else { - if (virSCSIDeviceSetUsedBy(scsi, QEMU_DRIVER_NAME, def->name) < 0 || + if (virSCSIDeviceSetUsedBy(scsi, drv_name, def->name) < 0 || virSCSIDeviceListAdd(mgr->activeScsiHostdevs, scsi) < 0) { virSCSIDeviceFree(scsi); goto cleanup; @@ -220,7 +223,6 @@ cleanup: return ret; } - int qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, virDomainDefPtr def) @@ -233,7 +235,7 @@ qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, if (mgr == NULL) return -1; - return virHostdevUpdateActiveScsiHostdevs(mgr, def); + return virHostdevUpdateActiveScsiHostdevs(mgr, QEMU_DRIVER_NAME, def); } bool -- 1.6.0.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list