[libvirt] [PATCH v13 05/49] qemu: use general virhostdev lists instead of its own

Daniel P. Berrange berrange at redhat.com
Tue Mar 4 12:38:40 UTC 2014


On Sat, Mar 01, 2014 at 02:29:00PM +0800, Chunyan Liu wrote:
> 
> Signed-off-by: Chunyan Liu <cyliu at suse.com>
> ---
>  src/qemu/qemu_conf.h    |    8 --
>  src/qemu/qemu_driver.c  |   74 +++++++++----------
>  src/qemu/qemu_hostdev.c |  192 ++++++++++++++++++++++++++++-------------------
>  src/qemu/qemu_hotplug.c |    1 +
>  4 files changed, 151 insertions(+), 124 deletions(-)
> 
> diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
> index ece185b..2ac88fb 100644
> --- a/src/qemu/qemu_conf.h
> +++ b/src/qemu/qemu_conf.h
> @@ -215,14 +215,6 @@ struct _virQEMUDriver {
>      /* Immutable pointer. self-locking APIs */
>      virSecurityManagerPtr securityManager;
>  
> -    /* Immutable pointers. Requires locks to be held before
> -     * calling APIs. activePciHostdevs must be locked before
> -     * inactivePciHostdevs */
> -    virPCIDeviceListPtr activePciHostdevs;
> -    virPCIDeviceListPtr inactivePciHostdevs;
> -    virUSBDeviceListPtr activeUsbHostdevs;
> -    virSCSIDeviceListPtr activeScsiHostdevs;
> -
>      /* Immutable pointer. Unsafe APIs. XXX */
>      virHashTablePtr sharedDevices;
>  
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index f36a8b4..7d924b2 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -95,6 +95,7 @@
>  #include "viraccessapicheck.h"
>  #include "viraccessapicheckqemu.h"
>  #include "storage/storage_driver.h"
> +#include "virhostdev.h"
>  
>  #define VIR_FROM_THIS VIR_FROM_QEMU
>  
> @@ -695,18 +696,6 @@ qemuStateInitialize(bool privileged,
>      if (qemuSecurityInit(qemu_driver) < 0)
>          goto error;
>  
> -    if ((qemu_driver->activePciHostdevs = virPCIDeviceListNew()) == NULL)
> -        goto error;
> -
> -    if ((qemu_driver->activeUsbHostdevs = virUSBDeviceListNew()) == NULL)
> -        goto error;
> -
> -    if ((qemu_driver->inactivePciHostdevs = virPCIDeviceListNew()) == NULL)
> -        goto error;
> -
> -    if ((qemu_driver->activeScsiHostdevs = virSCSIDeviceListNew()) == NULL)
> -        goto error;
> -

I think we should obtain the hostdev manager instance here, and save a
reference to it, so that later functions do not need to worry about
failure of virHostdevManagerGetDefault()


> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 5546693..eeb1f24 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -50,6 +50,7 @@
>  #include "virstoragefile.h"
>  #include "virstring.h"
>  #include "virtime.h"
> +#include "virhostdev.h"

This seems bogus as you're not adding any code to this file which would
use those APIs

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list