[libvirt] [PATCH 20/20] remote/rpc: Use virNetServerGetProgram() to determine the program

Marc Hartmayer mhartmay at linux.vnet.ibm.com
Thu Mar 15 19:12:10 UTC 2018


On Thu, Mar 08, 2018 at 01:20 PM +0100, Marc Hartmayer <mhartmay at linux.vnet.ibm.com> wrote:
> Use virNetServerGetProgram() to determine the virNetServerProgram
> instead of using hard coded global variables. This allows us to remove
> the global variables @remoteProgram and @qemuProgram as they're now no
> longer necessary.
>
> Signed-off-by: Marc Hartmayer <mhartmay at linux.vnet.ibm.com>
> Reviewed-by: Boris Fiuczynski <fiuczy at linux.vnet.ibm.com>
> ---

[…snip…]

>
>
> +/**
> + * virNetServerGetProgram:
> + * @srv: server (must NOT be locked by the caller)
> + * @msg: message
> + *
> + * Searches @srv for the right program for a given message @msg.
> + *
> + * Returns a pointer to the server program or NULL if not found.
> + */
> +virNetServerProgramPtr
> +virNetServerGetProgram(virNetServerPtr srv,
> +                       virNetMessagePtr msg)
> +{
> +    virNetServerProgramPtr ret = NULL;

The initialization to NULL is useless here… :) Will change it for v2.

> +
> +    virObjectLock(srv);
> +    ret = virNetServerGetProgramLocked(srv, msg);
> +    virObjectUnlock(srv);
> +
> +    return ret;
> +}
> +
> +
>  static int virNetServerDispatchNewMessage(virNetServerClientPtr client,
>                                            virNetMessagePtr msg,
>                                            void *opaque)
> diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h
> index a79c39fdb2e7..1867e46664ba 100644
> --- a/src/rpc/virnetserver.h
> +++ b/src/rpc/virnetserver.h
> @@ -76,6 +76,8 @@ int virNetServerSetTLSContext(virNetServerPtr srv,
>                                virNetTLSContextPtr tls);
>  # endif
>
> +virNetServerProgramPtr virNetServerGetProgram(virNetServerPtr srv,
> +                                              virNetMessagePtr msg);
>
>  int virNetServerAddClient(virNetServerPtr srv,
>                            virNetServerClientPtr client);
> -- 
> 2.13.4
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list





More information about the libvir-list mailing list