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

Re: [libvirt] [PATCH v3 09/10] Turn virNetServer* into virObject instances



On 08/06/2012 05:53 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> Make all the virNetServer* objects use the virObject APIs
> for reference counting
> 
> Signed-off-by: Daniel P. Berrange <berrange redhat com>
> ---
>  daemon/libvirtd.c             |   22 ++++-----
>  daemon/stream.c               |   19 ++------
>  src/libvirt_private.syms      |    7 ---
>  src/libvirt_probes.d          |    4 +-
>  src/lxc/lxc_controller.c      |    8 +--
>  src/rpc/virnetserver.c        |   79 ++++++++++++++----------------
>  src/rpc/virnetserver.h        |    5 +-
>  src/rpc/virnetserverclient.c  |  108 ++++++++++++++++++-----------------------
>  src/rpc/virnetserverclient.h  |    5 +-
>  src/rpc/virnetserverprogram.c |   49 ++++++++++---------
>  src/rpc/virnetserverprogram.h |    8 +--
>  src/rpc/virnetserverservice.c |   83 +++++++++++++++----------------
>  src/rpc/virnetserverservice.h |    5 +-
>  13 files changed, 172 insertions(+), 230 deletions(-)

I hit a minor merge conflict when applying this, thanks to my recent
HAVE_AVAHI stuff, but shouldn't be too hard for you to figure out.

> @@ -227,7 +243,7 @@ static int virNetServerDispatchNewMessage(virNetServerClientPtr client,
>          job->msg = msg;
>  
>          if (prog) {
> -            virNetServerProgramRef(prog);
> +            virObjectRef(prog);
>              job->prog = prog;

You could collapse these two lines into one if you want.

> +++ b/src/rpc/virnetserverclient.h
> @@ -26,6 +26,7 @@
>  
>  # include "virnetsocket.h"
>  # include "virnetmessage.h"
> +# include "virobject.h"

Another place where I wonder if this would be better in the .c instead
of the .h.

> -void virNetServerProgramFree(virNetServerProgramPtr prog)
> +void virNetServerProgramDispose(void *obj ATTRIBUTE_UNUSED)
>  {
> -    if (!prog)
> -        return;
> -
> -    VIR_DEBUG("prog=%p refs=%d", prog, prog->refs);
> -
> -    prog->refs--;
> -    if (prog->refs > 0)
> -        return;
> -
> -    VIR_FREE(prog);
>  }

This is a no-op; is it worth passing NULL instead of wasting space in
the executable for the stub function?

> +++ b/src/rpc/virnetserverservice.h
> @@ -25,6 +25,7 @@
>  # define __VIR_NET_SERVER_SERVICE_H__
>  
>  # include "virnetserverprogram.h"
> +# include "virobject.h"

And another possible candidate for .c instead of .h.

Meanwhile, I noticed a couple missing changes, some required for 'make
check' to be happy; ACK once you squash this in:

diff --git i/cfg.mk w/cfg.mk
index 535d67b..64af1ee 100644
--- i/cfg.mk
+++ w/cfg.mk
@@ -148,13 +148,9 @@ useless_free_options =				\
   --name=virNetClientFree                       \
   --name=virNetClientProgramFree                \
   --name=virNetClientStreamFree                 \
-  --name=virNetServerFree                       \
-  --name=virNetServerClientFree                 \
   --name=virNetServerMDNSFree                   \
   --name=virNetServerMDNSEntryFree              \
   --name=virNetServerMDNSGroupFree              \
-  --name=virNetServerProgramFree                \
-  --name=virNetServerServiceFree                \
   --name=virNWFilterDefFree			\
   --name=virNWFilterEntryFree			\
   --name=virNWFilterHashTableFree		\
diff --git i/src/libvirt_private.syms w/src/libvirt_private.syms
index e071fe1..0543005 100644
--- i/src/libvirt_private.syms
+++ w/src/libvirt_private.syms
@@ -1555,13 +1555,11 @@ virNetServerProgramUnknownError;

 # virnetserverservice.h
 virNetServerServiceClose;
-virNetServerServiceFree;
 virNetServerServiceGetAuth;
 virNetServerServiceGetPort;
 virNetServerServiceIsReadonly;
 virNetServerServiceNewTCP;
 virNetServerServiceNewUNIX;
-virNetServerServiceRef;
 virNetServerServiceSetDispatcher;
 virNetServerServiceToggle;


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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