[libvirt] [PATCH v13 05/49] qemu: use general virhostdev lists instead of its own
Daniel P. Berrange
berrange at redhat.com
Wed Mar 5 10:46:26 UTC 2014
On Wed, Mar 05, 2014 at 04:03:19PM +0800, Chunyan Liu wrote:
> 2014-03-04 20:38 GMT+08:00 Daniel P. Berrange <berrange at redhat.com>:
>
> > 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()
> >
> > we could:
> add .hostdev_mgr to _virQEMUDriver, and add
> qemu_driver->hostdev_mgr = virHostdevManagerGetDefault() here.
> Is that OK?
Yes, that would be good, and the same for LXC + libxl drivers too.
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