Extract general code from qemuUpdateActiveUsbHostdevs to
virHostdevUpdateActiveUsbHostdevs.
Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
---
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 b52f7ac..b6ee404 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -111,17 +111,13 @@ qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver,
return virHostdevUpdateActivePciHostdevs(mgr, def);
}
-int
-qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver,
- virDomainDefPtr def)
+static int
+virHostdevUpdateActiveUsbHostdevs(virHostdevManagerPtr mgr,
+ virDomainDefPtr def)
{
virDomainHostdevDefPtr hostdev = NULL;
size_t i;
int ret = -1;
- virHostdevManagerPtr mgr = driver->hostdevMgr;
-
- if (!def->nhostdevs)
- return 0;
virObjectLock(mgr->activeUsbHostdevs);
for (i = 0; i < def->nhostdevs; i++) {
@@ -158,6 +154,18 @@ cleanup:
}
int
+qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver,
+ virDomainDefPtr def)
+{
+ virHostdevManagerPtr mgr = driver->hostdevMgr;
+
+ if (!def->nhostdevs)
+ return 0;
+
+ return virHostdevUpdateActiveUsbHostdevs(mgr, def);
+}
+
+int
qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver,
virDomainDefPtr def)
{
--
1.9.0