[libvirt] [libvirt-glib 35/37] Add GVirConfigChardevSourcePty

Christophe Fergeau cfergeau at redhat.com
Thu Nov 10 20:34:07 UTC 2011


---
 libvirt-gconfig/Makefile.am                        |    2 +
 .../libvirt-gconfig-chardev-source-pty.c           |   82 ++++++++++++++++++++
 .../libvirt-gconfig-chardev-source-pty.h           |   68 ++++++++++++++++
 libvirt-gconfig/libvirt-gconfig.h                  |    1 +
 libvirt-gconfig/libvirt-gconfig.sym                |    4 +
 5 files changed, 157 insertions(+), 0 deletions(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-chardev-source-pty.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-chardev-source-pty.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 3144955..8df46f5 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -12,6 +12,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-object.h \
 			libvirt-gconfig-capabilities.h \
 			libvirt-gconfig-chardev-source.h \
+			libvirt-gconfig-chardev-source-pty.h \
 			libvirt-gconfig-chardev-target.h \
 			libvirt-gconfig-clock.h \
 			libvirt-gconfig-device.h \
@@ -39,6 +40,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-object.c \
 			libvirt-gconfig-capabilities.c \
 			libvirt-gconfig-chardev-source.c \
+			libvirt-gconfig-chardev-source-pty.c \
 			libvirt-gconfig-chardev-target.c \
 			libvirt-gconfig-clock.c \
 			libvirt-gconfig-device.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-chardev-source-pty.c b/libvirt-gconfig/libvirt-gconfig-chardev-source-pty.c
new file mode 100644
index 0000000..f0a2c8d
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-chardev-source-pty.c
@@ -0,0 +1,82 @@
+/*
+ * libvirt-gobject-config-chardev-source-pty.c: libvirt glib integration
+ *
+ * Copyright (C) 2011 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: Christophe Fergeau <cfergeau at gmail.com>
+ */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <libxml/tree.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+
+extern gboolean debugFlag;
+
+#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
+
+#define GVIR_CONFIG_CHARDEV_SOURCE_PTY_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_CHARDEV_SOURCE_PTY, GVirConfigChardevSourcePtyPrivate))
+
+struct _GVirConfigChardevSourcePtyPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigChardevSourcePty, gvir_config_chardev_source_pty, GVIR_TYPE_CONFIG_CHARDEV_SOURCE);
+
+
+static void gvir_config_chardev_source_pty_class_init(GVirConfigChardevSourcePtyClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigChardevSourcePtyPrivate));
+    gvir_config_chardev_source_class_set_nick(GVIR_TYPE_CONFIG_CHARDEV_SOURCE_PTY, "pty");
+}
+
+
+static void gvir_config_chardev_source_pty_init(GVirConfigChardevSourcePty *pty)
+{
+    GVirConfigChardevSourcePtyPrivate *priv;
+
+    DEBUG("Init GVirConfigChardevSourcePty=%p", pty);
+
+    priv = pty->priv = GVIR_CONFIG_CHARDEV_SOURCE_PTY_GET_PRIVATE(pty);
+
+    memset(priv, 0, sizeof(*priv));
+}
+
+
+GVirConfigChardevSourcePty *gvir_config_chardev_source_pty_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_TYPE_CONFIG_CHARDEV_SOURCE_PTY,
+                                    "source", NULL);
+    return GVIR_CONFIG_CHARDEV_SOURCE_PTY(object);
+}
+
+GVirConfigChardevSourcePty *gvir_config_chardev_source_pty_new_from_xml(const gchar *xml,
+                                                                        GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_CHARDEV_SOURCE_PTY,
+                                             "source", NULL, xml, error);
+    return GVIR_CONFIG_CHARDEV_SOURCE_PTY(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-chardev-source-pty.h b/libvirt-gconfig/libvirt-gconfig-chardev-source-pty.h
new file mode 100644
index 0000000..39b40bc
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-chardev-source-pty.h
@@ -0,0 +1,68 @@
+/*
+ * libvirt-gobject-chardev-source-pty.c: libvirt gobject integration
+ *
+ * Copyright (C) 2011 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: Christophe Fergeau <cfergeau at gmail.com>
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
+#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
+#endif
+
+#ifndef __LIBVIRT_GCONFIG_CHARDEV_SOURCE_PTY_H__
+#define __LIBVIRT_GCONFIG_CHARDEV_SOURCE_PTY_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_CHARDEV_SOURCE_PTY            (gvir_config_chardev_source_pty_get_type ())
+#define GVIR_CONFIG_CHARDEV_SOURCE_PTY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_CHARDEV_SOURCE_PTY, GVirConfigChardevSourcePty))
+#define GVIR_CONFIG_CHARDEV_SOURCE_PTY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_CHARDEV_SOURCE_PTY, GVirConfigChardevSourcePtyClass))
+#define GVIR_IS_CONFIG_CHARDEV_SOURCE_PTY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_CHARDEV_SOURCE_PTY))
+#define GVIR_IS_CONFIG_CHARDEV_SOURCE_PTY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_CHARDEV_SOURCE_PTY))
+#define GVIR_CONFIG_CHARDEV_SOURCE_PTY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_CHARDEV_SOURCE_PTY, GVirConfigChardevSourcePtyClass))
+
+typedef struct _GVirConfigChardevSourcePty GVirConfigChardevSourcePty;
+typedef struct _GVirConfigChardevSourcePtyPrivate GVirConfigChardevSourcePtyPrivate;
+typedef struct _GVirConfigChardevSourcePtyClass GVirConfigChardevSourcePtyClass;
+
+struct _GVirConfigChardevSourcePty
+{
+    GVirConfigObject parent;
+
+    GVirConfigChardevSourcePtyPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigChardevSourcePtyClass
+{
+    GVirConfigObjectClass parent_class;
+
+    gpointer padding[20];
+};
+
+
+GType gvir_config_chardev_source_pty_get_type(void);
+
+GVirConfigChardevSourcePty *gvir_config_chardev_source_pty_new(void);
+GVirConfigChardevSourcePty *gvir_config_chardev_source_pty_new_from_xml(const gchar *xml,
+                                                                        GError **error);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_CHARDEV_SOURCE_PTY_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 28e09b9..0d338d7 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -30,6 +30,7 @@
 #include <libvirt-gconfig/libvirt-gconfig-capabilities.h>
 #include <libvirt-gconfig/libvirt-gconfig-clock.h>
 #include <libvirt-gconfig/libvirt-gconfig-chardev-source.h>
+#include <libvirt-gconfig/libvirt-gconfig-chardev-source-pty.h>
 #include <libvirt-gconfig/libvirt-gconfig-chardev-target.h>
 #include <libvirt-gconfig/libvirt-gconfig-device.h>
 #include <libvirt-gconfig/libvirt-gconfig-device-chardev.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 0889a53..c9bdd96 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -8,6 +8,10 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_chardev_source_class_get_nick;
 	gvir_config_chardev_source_class_set_nick;
 
+	gvir_config_chardev_source_pty_get_type;
+	gvir_config_chardev_source_pty_new;
+	gvir_config_chardev_source_pty_new_from_xml;
+
 	gvir_config_chardev_target_get_type;
 	gvir_config_chardev_target_class_get_nick;
 	gvir_config_chardev_target_class_set_nick;
-- 
1.7.7




More information about the libvir-list mailing list