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

Re: [libvirt] [PATCH 07/23] Refactor RPC client private data setup



On 08/09/2012 09:20 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> Currently there is a hook function that is invoked when a
> new client connection comes in, which allows an app to
> setup private data. This setup will make it difficult to
> serialize client state during process re-exec(). Change to
> a model where the app registers a callback when creating
> the virNetServerPtr instance, which is used to allocate
> the client private data immediately during virNetClientPtr
> construction.
> 
> Signed-off-by: Daniel P. Berrange <berrange redhat com>
> ---
>  daemon/libvirtd.c            |  1 +
>  daemon/remote.c              | 15 ++++++---------
>  daemon/remote.h              |  6 +++---
>  src/lxc/lxc_controller.c     | 23 +++++++++++++++++------
>  src/rpc/virnetserver.c       | 24 +++++++++++++-----------
>  src/rpc/virnetserver.h       |  9 +++------
>  src/rpc/virnetserverclient.c | 31 +++++++++++++------------------
>  src/rpc/virnetserverclient.h | 13 +++++++------
>  8 files changed, 63 insertions(+), 59 deletions(-)

Fails 'make check':

  GEN    check-symfile
Expected symbol virNetServerClientSetPrivateData is not in ELF library

> +++ b/src/lxc/lxc_controller.c
> +static void *virLXCControllerClientPrivateNew(virNetServerClientPtr client,
> +                                              void *opaque)
>  {
>      virLXCControllerPtr ctrl = opaque;
> -    virNetServerClientSetPrivateData(client, ctrl, NULL);
> +    int *dummy;
> +
> +    if (VIR_ALLOC(dummy) < 0) {
> +        virReportOOMError();
> +        return NULL;
> +    }

Maybe use strdup("") instead of dummy as your magic allocation?  Doesn't
matter at the end of the day, though.  And if you never store into the
allocated storage, do you even need to allocate something, or could you
return ((void*)1) and have the free function be a no-op instead of a
VIR_FREE, since the only reason you have to return non-NULL is to
indicate success?

ACK with this squashed in:

diff --git i/src/libvirt_private.syms w/src/libvirt_private.syms
index 75fd7bf..24915e2 100644
--- i/src/libvirt_private.syms
+++ w/src/libvirt_private.syms
@@ -1524,7 +1524,6 @@ virNetServerClientSendMessage;
 virNetServerClientSetCloseHook;
 virNetServerClientSetDispatcher;
 virNetServerClientSetIdentity;
-virNetServerClientSetPrivateData;
 virNetServerClientStartKeepAlive;
 virNetServerClientWantClose;


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