[libvirt] [PATCH 00/13] Introduce a virObject module fo reference counting

Daniel P. Berrange berrange at redhat.com
Wed Jul 11 13:35:40 UTC 2012


Last year Hu Tao posted a series which introduced a virObject
type and converted the QEMU driver to use this for some of its
objects

  https://www.redhat.com/archives/libvir-list/2011-April/msg00316.html

While the idea was generally encouraged, the impl was never updated
with review feedback, although some of the atomic ops code was updated
and merged.

This series is an attempt to address the same problem. The significant
things in this series

 - Instead of storing a 'destroy' pointer in virObject itself,
   introduce a separate 'virClass' concept. As we add more
   functionality to virObject, the benefit of not duplicating
   class-level data in each object instance will be great

 - The virObject APIs take a 'void *' instead of virObjectPtr
   to avoid the need to litter the code with casts, albeit at
   a slight loss in compile time type safety checking

 - Replace our current atomic ops code with GLib's impl
   which is more complete, in particular it has Win32 support

 - Add a macro to facilitate creating one-time init functions
   usig virOnce

 - Convert all our public API objects to use this new code

 - Convert all code in src/rpc, src/conf and src/qemu to the
   new object APIs

In the future the things I plan to do are

 - Add a mutex to virObject - nearly all subclasses make use of
   a mutex, so it makes sense to provide one in the base class

 - Add generic support for callbacks. Currently each module
   deals with callbacks in a rather adhoc fashion. THis will
   create something similar in concept to GLib's 'signal'
   capabilities, though somewhat simpler.


 .gitignore                        |    1 
 configure.ac                      |   59 ++
 daemon/libvirtd.c                 |   27 -
 daemon/remote.c                   |    8 
 daemon/stream.c                   |   19 
 src/Makefile.am                   |    7 
 src/conf/domain_conf.c            |   59 --
 src/conf/domain_conf.h            |    8 
 src/conf/domain_event.c           |    8 
 src/datatypes.c                   |  999 ++++++++------------------------------
 src/datatypes.h                   |  264 +++-------
 src/libvirt.c                     |  131 +---
 src/libvirt_atomic.syms           |    3 
 src/libvirt_private.syms          |   42 -
 src/libvirt_probes.d              |   31 -
 src/libxl/libxl_driver.c          |    6 
 src/lxc/lxc_controller.c          |    8 
 src/nwfilter/nwfilter_dhcpsnoop.c |   48 -
 src/openvz/openvz_conf.c          |   17 
 src/phyp/phyp_driver.c            |   14 
 src/qemu/qemu_agent.c             |   86 +--
 src/qemu/qemu_agent.h             |    3 
 src/qemu/qemu_command.c           |    2 
 src/qemu/qemu_domain.c            |   49 -
 src/qemu/qemu_domain.h            |    8 
 src/qemu/qemu_driver.c            |    2 
 src/qemu/qemu_migration.c         |   34 -
 src/qemu/qemu_migration.h         |    4 
 src/qemu/qemu_monitor.c           |   97 +--
 src/qemu/qemu_monitor.h           |    3 
 src/qemu/qemu_process.c           |   52 -
 src/remote/remote_driver.c        |   26 
 src/rpc/gendispatch.pl            |    4 
 src/rpc/virkeepalive.c            |   73 +-
 src/rpc/virkeepalive.h            |    4 
 src/rpc/virnetclient.c            |  117 +---
 src/rpc/virnetclient.h            |    4 
 src/rpc/virnetclientprogram.c     |   43 -
 src/rpc/virnetclientprogram.h     |    5 
 src/rpc/virnetclientstream.c      |   65 +-
 src/rpc/virnetclientstream.h      |    5 
 src/rpc/virnetsaslcontext.c       |  106 +---
 src/rpc/virnetsaslcontext.h       |    8 
 src/rpc/virnetserver.c            |   82 +--
 src/rpc/virnetserver.h            |    5 
 src/rpc/virnetserverclient.c      |  134 ++---
 src/rpc/virnetserverclient.h      |    5 
 src/rpc/virnetserverprogram.c     |   49 -
 src/rpc/virnetserverprogram.h     |    8 
 src/rpc/virnetserverservice.c     |   97 +--
 src/rpc/virnetserverservice.h     |    5 
 src/rpc/virnetsocket.c            |   85 +--
 src/rpc/virnetsocket.h            |    3 
 src/rpc/virnettlscontext.c        |  110 +---
 src/rpc/virnettlscontext.h        |   10 
 src/storage/storage_driver.c      |    4 
 src/util/logging.c                |   54 --
 src/util/logging.h                |    2 
 src/util/threads.h                |   49 +
 src/util/viratomic.c              |   35 +
 src/util/viratomic.h              |  424 +++++++++++++---
 src/util/virfile.c                |    4 
 src/util/virnodesuspend.c         |   25 
 src/util/virnodesuspend.h         |    1 
 src/util/virobject.c              |  203 +++++++
 src/util/virobject.h              |   60 ++
 src/vbox/vbox_tmpl.c              |    2 
 src/vmware/vmware_conf.c          |    4 
 src/xen/xend_internal.c           |    4 
 tests/Makefile.am                 |    5 
 tests/qemuxml2argvtest.c          |   21 
 tests/qemuxmlnstest.c             |    2 
 tests/sexpr2xmltest.c             |    2 
 tests/viratomictest.c             |  180 ++++++
 tests/virnetsockettest.c          |   26 
 tests/virnettlscontexttest.c      |   10 
 tests/xmconfigtest.c              |    4 
 77 files changed, 2105 insertions(+), 2168 deletions(-)





More information about the libvir-list mailing list