On Fri, Jul 23, 2010 at 11:03:44PM -0700, Chris Wright wrote:
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(a)redhat.com>
Cc: Don Dutile <ddutile(a)redhat.com>
Cc: Chris Lalancette <clalance(a)redhat.com>
Cc: Mark McLoughlin <markmc(a)redhat.com>
Signed-off-by: Chris Wright <chrisw(a)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"));
ACK, looks fine, mechanical change
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/