On Mon, Aug 06, 2012 at 01:56:33PM -0600, Eric Blake wrote:
On 08/06/2012 05:53 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange(a)redhat.com>
>
> Make all the virNetClient* objects use virObject APIs for
> reference counting
>
> Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
> ---
> 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;
Thanks for all the reviews. This series is now merged, with the changes
you suggested for cfg.mk and libvirt_private.syms
Now we're in a position to consider removing locking from some places
which only use it for the purpose of protecting ref counts....
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 :|