Extract general code from qemuUpdateActiveScsiHostdevs to
virHostdevUpdateActiveScsiHostdevs
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 1992aa0..972ea09 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -172,22 +172,16 @@ qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver
ATTRIBUTE_UNUSED,
return virHostdevUpdateActiveUsbHostdevs(mgr, def);
}
-int
-qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
- 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;
- if (!def->nhostdevs)
- return 0;
- mgr = virHostdevManagerGetDefault();
- if (mgr == NULL)
- return -1;
virObjectLock(mgr->activeScsiHostdevs);
for (i = 0; i < def->nhostdevs; i++) {
hostdev = def->hostdevs[i];
@@ -227,6 +221,21 @@ cleanup:
}
+int
+qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
+ virDomainDefPtr def)
+{
+ virHostdevManagerPtr mgr;
+
+ if (!def->nhostdevs)
+ return 0;
+ mgr = virHostdevManagerGetDefault();
+ if (mgr == NULL)
+ return -1;
+
+ return virHostdevUpdateActiveScsiHostdevs(mgr, def);
+}
+
bool
qemuHostdevHostSupportsPassthroughVFIO(void)
{
--
1.6.0.2