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

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



From: "Daniel P. Berrange" <berrange redhat com>

---
 libvirt-gobject/libvirt-gobject-domain.c |   41 ++++++++++++++++++++++++++++++
 libvirt-gobject/libvirt-gobject-domain.h |    6 ++++
 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
+ * @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


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