Extract general code from qemuUpdateActivePciHostdevs to
virHostdevUpdateActivePciHostdevs.
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 9fe4019..b52f7ac 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -41,18 +41,14 @@
#define VIR_FROM_THIS VIR_FROM_QEMU
-int
-qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver,
- virDomainDefPtr def)
+static int
+virHostdevUpdateActivePciHostdevs(virHostdevManagerPtr mgr,
+ virDomainDefPtr def)
{
virDomainHostdevDefPtr hostdev = NULL;
virPCIDevicePtr dev = NULL;
size_t i;
int ret = -1;
- virHostdevManagerPtr mgr = driver->hostdevMgr;
-
- if (!def->nhostdevs)
- return 0;
virObjectLock(mgr->activePciHostdevs);
virObjectLock(mgr->inactivePciHostdevs);
@@ -104,6 +100,18 @@ cleanup:
}
int
+qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver,
+ virDomainDefPtr def)
+{
+ virHostdevManagerPtr mgr = driver->hostdevMgr;
+
+ if (!def->nhostdevs)
+ return 0;
+
+ return virHostdevUpdateActivePciHostdevs(mgr, def);
+}
+
+int
qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver,
virDomainDefPtr def)
{
--
1.9.0