Re: [PATCH 3/9] admin: Do not generate remoteAdminConnect{Open, Close}

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

 



On 13.10.2015 15:38, Erik Skultety wrote:
> As we plan to add more and more logic to remote connecting methods,
> these cannot be generated from admin_protocol.x anymore. Instead,
> this patch implements these to methods explicitly.
> ---
>  src/admin/admin_protocol.x |  4 ++--
>  src/libvirt-admin.c        | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 47 insertions(+), 2 deletions(-)
> 
> diff --git a/src/admin/admin_protocol.x b/src/admin/admin_protocol.x
> index cfc92ff..d0ca1a3 100644
> --- a/src/admin/admin_protocol.x
> +++ b/src/admin/admin_protocol.x
> @@ -64,12 +64,12 @@ enum admin_procedure {
>       *   in the function parameter list.
>       */
>      /**
> -     * @generate: client
> +     * @generate: none
>       */
>      ADMIN_PROC_CONNECT_OPEN = 1,
>  
>      /**
> -     * @generate: client
> +     * @generate: none
>       */
>      ADMIN_PROC_CONNECT_CLOSE = 2
>  };
> diff --git a/src/libvirt-admin.c b/src/libvirt-admin.c
> index f0824dd..e12e2b8 100644
> --- a/src/libvirt-admin.c
> +++ b/src/libvirt-admin.c
> @@ -126,6 +126,51 @@ call(virAdmConnectPtr conn,
>  static bool virAdmGlobalError;
>  static virOnceControl virAdmGlobalOnce = VIR_ONCE_CONTROL_INITIALIZER;
>  
> +static int
> +remoteAdminConnectOpen(virAdmConnectPtr conn, unsigned int flags)
> +{
> +    int rv = -1;
> +    remoteAdminPrivPtr priv = conn->privateData;
> +    admin_connect_open_args args;
> +
> +    virObjectLock(priv);
> +
> +    args.flags = flags;
> +
> +    if (call(conn, 0, ADMIN_PROC_CONNECT_OPEN,
> +             (xdrproc_t)xdr_admin_connect_open_args, (char *)&args,
> +             (xdrproc_t)xdr_void, (char *)NULL) == -1) {
> +        goto done;
> +    }
> +
> +    rv = 0;
> +
> + done:
> +    virObjectUnlock(priv);
> +    return rv;
> +}
> +
> +static int
> +remoteAdminConnectClose(virAdmConnectPtr conn)
> +{
> +    int rv = -1;
> +    remoteAdminPrivPtr priv = conn->privateData;
> +
> +    virObjectLock(priv);
> +
> +    if (call(conn, 0, ADMIN_PROC_CONNECT_CLOSE,
> +             (xdrproc_t)xdr_void, (char *)NULL,
> +             (xdrproc_t)xdr_void, (char *)NULL) == -1) {
> +        goto done;
> +    }
> +
> +    rv = 0;
> +
> + done:
> +    virObjectUnlock(priv);
> +    return rv;
> +}
> +
>  static void
>  remoteAdminPrivFree(void *opaque)
>  {
> 

I don't want to be picky, but these should really go into a separate
file. Perhaps somewhere under src/admin/?

Michal

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