[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [RFC PATCH 1/4] qemuGetPciHostDeviceList take hostdev list directly



Update qemuGetPciHostDeviceList to take a hostdev list and count
directly, rather than getting this indirectly from domain definition.
This will allow reuse for the attach-device case.

Cc: Alex Williamson <alex williamson redhat com>
Cc: Don Dutile <ddutile redhat com>
Cc: Chris Lalancette <clalance redhat com>
Cc: Mark McLoughlin <markmc redhat com>
Signed-off-by: Chris Wright <chrisw redhat com>
---
 src/qemu/qemu_driver.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c96788b..6e18d41 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2827,7 +2827,7 @@ cleanup:
 
 
 static pciDeviceList *
-qemuGetPciHostDeviceList(virDomainDefPtr def)
+qemuGetPciHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
 {
     pciDeviceList *list;
     int i;
@@ -2835,8 +2835,8 @@ qemuGetPciHostDeviceList(virDomainDefPtr def)
     if (!(list = pciDeviceListNew()))
         return NULL;
 
-    for (i = 0 ; i < def->nhostdevs ; i++) {
-        virDomainHostdevDefPtr hostdev = def->hostdevs[i];
+    for (i = 0 ; i < nhostdevs ; i++) {
+        virDomainHostdevDefPtr hostdev = hostdevs[i];
         pciDevice *dev;
 
         if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
@@ -2876,7 +2876,7 @@ qemuUpdateActivePciHostdevs(struct qemud_driver *driver,
     if (!def->nhostdevs)
         return 0;
 
-    if (!(pcidevs = qemuGetPciHostDeviceList(def)))
+    if (!(pcidevs = qemuGetPciHostDeviceList(def->hostdevs, def->nhostdevs)))
         return -1;
 
     for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
@@ -2904,7 +2904,7 @@ qemuPrepareHostPCIDevices(struct qemud_driver *driver,
     int i;
     int ret = -1;
 
-    if (!(pcidevs = qemuGetPciHostDeviceList(def)))
+    if (!(pcidevs = qemuGetPciHostDeviceList(def->hostdevs, def->nhostdevs)))
         return -1;
 
     /* We have to use 3 loops here. *All* devices must
@@ -3056,7 +3056,7 @@ qemuDomainReAttachHostDevices(struct qemud_driver *driver,
     if (!def->nhostdevs)
         return;
 
-    if (!(pcidevs = qemuGetPciHostDeviceList(def))) {
+    if (!(pcidevs = qemuGetPciHostDeviceList(def->hostdevs, def->nhostdevs))) {
         virErrorPtr err = virGetLastError();
         VIR_ERROR(_("Failed to allocate pciDeviceList: %s"),
                   err ? err->message : _("unknown error"));
-- 
1.7.1.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]