Extract general code from qemuUpdateActiveScsiHostdevs to virHostdevUpdateActiveScsiHostdevs Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx> --- src/qemu/qemu_hostdev.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index b6ee404..24ebb60 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -165,19 +165,15 @@ qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver, return virHostdevUpdateActiveUsbHostdevs(mgr, def); } -int -qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver, - virDomainDefPtr def) +static int +virHostdevUpdateActiveScsiHostdevs(virHostdevManagerPtr mgr, + virDomainDefPtr def) { virDomainHostdevDefPtr hostdev = NULL; size_t i; int ret = -1; virSCSIDevicePtr scsi = NULL; virSCSIDevicePtr tmp = NULL; - virHostdevManagerPtr mgr = driver->hostdevMgr; - - if (!def->nhostdevs) - return 0; virObjectLock(mgr->activeScsiHostdevs); for (i = 0; i < def->nhostdevs; i++) { @@ -217,6 +213,18 @@ cleanup: return ret; } +int +qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver, + virDomainDefPtr def) +{ + virHostdevManagerPtr mgr = driver->hostdevMgr; + + if (!def->nhostdevs) + return 0; + + return virHostdevUpdateActiveScsiHostdevs(mgr, def); +} + bool qemuHostdevHostSupportsPassthroughVFIO(void) -- 1.9.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list