On Tue, Nov 03, 2009 at 02:49:55PM -0500, Daniel P. Berrange wrote:
* src/util/pci.c, src/util/pci.h: Make the pciDeviceList struct
opaque to callers of the API. Add accessor methods for managing
devices in the list
* src/qemu/qemu_driver.c: Update to use APIs instead of directly
accessing pciDeviceList fields
Sounds good !
[...]
> @@ -1417,33 +1419,39 @@ qemuPrepareHostDevices(virConnectPtr conn,
> * to pci-stub.ko
> */
> - for (i = 0; i < pcidevs->count; i++)
> - if (pciDeviceGetManaged(pcidevs->devs[i]) &&
> - pciDettachDevice(conn, pcidevs->devs[i]) < 0)
> - goto error;
> + for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
> + pciDevice *dev = pciDeviceListGet(pcidevs, i);
> + if (pciDeviceGetManaged(dev) &&
> + pciDettachDevice(conn, dev) < 0)
> + goto cleanup;
> + }
I wasn't sure at first but since pciDeviceGetManaged() only error is
to return NULL then okay
ACK, looks fine !
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/