Extract general code from qemuUpdateActiveUsbHostdevs to
virHostdevUpdateActiveUsbHostdevs.
Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
---
src/qemu/qemu_hostdev.c | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 1730ed8..1992aa0 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -115,20 +115,14 @@ qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver
ATTRIBUTE_UNUSED,
return virHostdevUpdateActivePciHostdevs(mgr, def);
}
-int
-qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
- virDomainDefPtr def)
+static int
+virHostdevUpdateActiveUsbHostdevs(virHostdevManagerPtr mgr,
+ virDomainDefPtr def)
{
virDomainHostdevDefPtr hostdev = NULL;
size_t i;
int ret = -1;
- virHostdevManagerPtr mgr;
- if (!def->nhostdevs)
- return 0;
- mgr = virHostdevManagerGetDefault();
- if (mgr == NULL)
- return -1;
virObjectLock(mgr->activeUsbHostdevs);
for (i = 0; i < def->nhostdevs; i++) {
virUSBDevicePtr usb = NULL;
@@ -164,6 +158,21 @@ cleanup:
}
int
+qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
+ virDomainDefPtr def)
+{
+ virHostdevManagerPtr mgr;
+
+ if (!def->nhostdevs)
+ return 0;
+ mgr = virHostdevManagerGetDefault();
+ if (mgr == NULL)
+ return -1;
+
+ return virHostdevUpdateActiveUsbHostdevs(mgr, def);
+}
+
+int
qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainDefPtr def)
{
--
1.6.0.2