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

Christophe Fergeau cfergeau at redhat.com
Thu Dec 15 16:59:31 UTC 2011


On Mon, Dec 12, 2011 at 04:04:45PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> ---
>  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 at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111215/6f721874/attachment-0001.sig>


More information about the libvir-list mailing list