Re: [PATCH libvirt-glib 2/2] Add binding for virDomainOpenGraphics

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

 



On Mon, Dec 12, 2011 at 04:04:45PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> ---
>  libvirt-gobject/libvirt-gobject-domain.c |   41 ++++++++++++++++++++++++++++++
>  libvirt-gobject/libvirt-gobject-domain.h |    6 ++++

No addition to the .sym file?

>  2 files changed, 47 insertions(+), 0 deletions(-)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
> index 331a533..677d64b 100644
> --- a/libvirt-gobject/libvirt-gobject-domain.c
> +++ b/libvirt-gobject/libvirt-gobject-domain.c
> @@ -637,3 +637,44 @@ cleanup:
>          virStreamFree(st);
>      return ret;
>  }
> +
> +
> +/**
> + * gvir_domain_open_graphics:
> + * @dom: the domain
> + * @idx: the graphics index

idx refers to the index of the <graphics> device node we are interested in
in the domain config? The API looks a bit complicated to me, but I'm not
sure it's easy to come up with something nicer :-/

The rest looks good to me.

Christophe
> + * @fd: pre-opened socket pair
> + * @flags: extra flags, currently unused
> + *
> + * Open a connection to the local graphics display, connecting it to the
> + * socket pair file descriptor passed in as @fd.
> + *
> + * Returns: TRUE if the graphics connection was opened, FALSE otherwise.
> + */
> +gboolean gvir_domain_open_graphics(GVirDomain *dom,
> +                                   guint idx,
> +                                   int fd,
> +                                   unsigned int flags,
> +                                   GError **err)
> +{
> +    GVirDomainPrivate *priv;
> +    gboolean ret = FALSE;
> +
> +    g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
> +
> +    priv = dom->priv;
> +
> +    if (virDomainOpenGraphics(priv->handle,
> +                              idx,
> +                              fd,
> +                              flags) < 0) {
> +        gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
> +                               0,
> +                               "Unable to open graphics");
> +        goto cleanup;
> +    }
> +
> +    ret = TRUE;
> +cleanup:
> +    return ret;
> +}
> diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
> index 3a4dd02..6fcec8d 100644
> --- a/libvirt-gobject/libvirt-gobject-domain.h
> +++ b/libvirt-gobject/libvirt-gobject-domain.h
> @@ -147,6 +147,12 @@ gboolean gvir_domain_open_console(GVirDomain *dom,
>                                    guint flags,
>                                    GError **err);
>  
> +gboolean gvir_domain_open_graphics(GVirDomain *dom,
> +                                   guint idx,
> +                                   int fd,
> +                                   unsigned int flags,
> +                                   GError **err);
> +
>  G_END_DECLS
>  
>  #endif /* __LIBVIRT_GOBJECT_DOMAIN_H__ */
> -- 
> 1.7.7.3
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgpU9fFsJDuOU.pgp
Description: PGP 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]