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

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

 



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@xxxxxxxxxx>
> Cc: Don Dutile <ddutile@xxxxxxxxxx>
> Cc: Chris Lalancette <clalance@xxxxxxxxxx>
> Cc: Mark McLoughlin <markmc@xxxxxxxxxx>
> Signed-off-by: Chris Wright <chrisw@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]