Re: [PATCH v3 10/10] Turn virNetClient* into virObject instances

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

 



On 08/06/2012 05:53 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> Make all the virNetClient* objects use virObject APIs for
> reference counting
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/libvirt_probes.d          |    4 +-
>  src/lxc/lxc_monitor.c         |    4 +-
>  src/remote/remote_driver.c    |   20 ++++-----
>  src/rpc/gendispatch.pl        |    4 +-
>  src/rpc/virnetclient.c        |   96 +++++++++++++++++------------------------
>  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 +--
>  10 files changed, 110 insertions(+), 140 deletions(-)


> +++ b/src/rpc/virnetclient.h
> @@ -30,6 +30,7 @@
>  # endif
>  # include "virnetclientprogram.h"
>  # include "virnetclientstream.h"
> +# include "virobject.h"

Same comments about .c instead of .h.

> -void virNetClientProgramRef(virNetClientProgramPtr prog)
> +void virNetClientProgramDispose(void *obj ATTRIBUTE_UNUSED)
>  {
> -    prog->refs++;
> -}
> -
> -
> -void virNetClientProgramFree(virNetClientProgramPtr prog)
> -{
> -    if (!prog)
> -        return;
> -
> -    prog->refs--;
> -    if (prog->refs > 0)
> -        return;
> -
> -    VIR_FREE(prog);
>  }

And another no-op dispose where you could use NULL instead.

ACK with this squashed in:

diff --git i/cfg.mk w/cfg.mk
index 64af1ee..c0457e7 100644
--- i/cfg.mk
+++ w/cfg.mk
@@ -145,9 +145,6 @@ useless_free_options =				\
   --name=virJSONValueFree			\
   --name=virLastErrFreeData			\
   --name=virNetMessageFree                      \
-  --name=virNetClientFree                       \
-  --name=virNetClientProgramFree                \
-  --name=virNetClientStreamFree                 \
   --name=virNetServerMDNSFree                   \
   --name=virNetServerMDNSEntryFree              \
   --name=virNetServerMDNSGroupFree              \
diff --git i/src/libvirt_private.syms w/src/libvirt_private.syms
index 0543005..79b4a18 100644
--- i/src/libvirt_private.syms
+++ w/src/libvirt_private.syms
@@ -1304,7 +1304,6 @@ virNetClientAddProgram;
 virNetClientAddStream;
 virNetClientClose;
 virNetClientDupFD;
-virNetClientFree;
 virNetClientGetFD;
 virNetClientGetTLSKeySize;
 virNetClientHasPassFD;
@@ -1318,7 +1317,6 @@ virNetClientNewExternal;
 virNetClientNewSSH;
 virNetClientNewTCP;
 virNetClientNewUNIX;
-virNetClientRef;
 virNetClientRemoteAddrString;
 virNetClientRemoveStream;
 virNetClientSendNoReply;
@@ -1333,12 +1331,10 @@ virNetClientSetTLSSession;
 # virnetclientprogram.h
 virNetClientProgramCall;
 virNetClientProgramDispatch;
-virNetClientProgramFree;
 virNetClientProgramGetProgram;
 virNetClientProgramGetVersion;
 virNetClientProgramMatches;
 virNetClientProgramNew;
-virNetClientProgramRef;


 # virnetclientstream.h
@@ -1346,13 +1342,11 @@ virNetClientStreamEOF;
 virNetClientStreamEventAddCallback;
 virNetClientStreamEventRemoveCallback;
 virNetClientStreamEventUpdateCallback;
-virNetClientStreamFree;
 virNetClientStreamMatches;
 virNetClientStreamNew;
 virNetClientStreamQueuePacket;
 virNetClientStreamRaiseError;
 virNetClientStreamRecvPacket;
-virNetClientStreamRef;
 virNetClientStreamSendPacket;
 virNetClientStreamSetError;


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

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]