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

[libvirt] [libvirt-glib 36/37] Add GVirConfigChardevTargetConsole



---
 libvirt-gconfig/Makefile.am                        |    2 +
 .../libvirt-gconfig-chardev-target-console.c       |   83 ++++++++++++++++++++
 .../libvirt-gconfig-chardev-target-console.h       |   68 ++++++++++++++++
 libvirt-gconfig/libvirt-gconfig.h                  |    1 +
 libvirt-gconfig/libvirt-gconfig.sym                |    4 +
 5 files changed, 158 insertions(+), 0 deletions(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-chardev-target-console.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-chardev-target-console.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 8df46f5..12e78fb 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -14,6 +14,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-chardev-source.h \
 			libvirt-gconfig-chardev-source-pty.h \
 			libvirt-gconfig-chardev-target.h \
+			libvirt-gconfig-chardev-target-console.h \
 			libvirt-gconfig-clock.h \
 			libvirt-gconfig-device.h \
 			libvirt-gconfig-device-chardev.h \
@@ -42,6 +43,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-chardev-source.c \
 			libvirt-gconfig-chardev-source-pty.c \
 			libvirt-gconfig-chardev-target.c \
+			libvirt-gconfig-chardev-target-console.c \
 			libvirt-gconfig-clock.c \
 			libvirt-gconfig-device.c \
 			libvirt-gconfig-device-chardev.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-chardev-target-console.c b/libvirt-gconfig/libvirt-gconfig-chardev-target-console.c
new file mode 100644
index 0000000..6e9a555
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-chardev-target-console.c
@@ -0,0 +1,83 @@
+/*
+ * libvirt-gobject-config-chardev-target-console.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 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_TARGET_CONSOLE_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_CHARDEV_TARGET_CONSOLE, GVirConfigChardevTargetConsolePrivate))
+
+struct _GVirConfigChardevTargetConsolePrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigChardevTargetConsole, gvir_config_chardev_target_console, GVIR_TYPE_CONFIG_CHARDEV_TARGET);
+
+
+static void gvir_config_chardev_target_console_class_init(GVirConfigChardevTargetConsoleClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigChardevTargetConsolePrivate));
+    gvir_config_chardev_target_class_set_nick(GVIR_TYPE_CONFIG_CHARDEV_TARGET_CONSOLE,
+                                              "console");
+}
+
+
+static void gvir_config_chardev_target_console_init(GVirConfigChardevTargetConsole *chardev_target_console)
+{
+    GVirConfigChardevTargetConsolePrivate *priv;
+
+    DEBUG("Init GVirConfigChardevTargetConsole=%p", chardev_target_console);
+
+    priv = chardev_target_console->priv = GVIR_CONFIG_CHARDEV_TARGET_CONSOLE_GET_PRIVATE(chardev_target_console);
+
+    memset(priv, 0, sizeof(*priv));
+}
+
+
+GVirConfigChardevTargetConsole *gvir_config_chardev_target_console_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_TYPE_CONFIG_CHARDEV_TARGET_CONSOLE,
+                                    "target", NULL);
+    return GVIR_CONFIG_CHARDEV_TARGET_CONSOLE(object);
+}
+
+GVirConfigChardevTargetConsole *gvir_config_chardev_target_console_new_from_xml(gchar *xml,
+                                                                                GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_CHARDEV_TARGET_CONSOLE,
+                                             "target", NULL, xml, error);
+    return GVIR_CONFIG_CHARDEV_TARGET_CONSOLE(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-chardev-target-console.h b/libvirt-gconfig/libvirt-gconfig-chardev-target-console.h
new file mode 100644
index 0000000..c340690
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-chardev-target-console.h
@@ -0,0 +1,68 @@
+/*
+ * libvirt-gobject-chardev-target-console.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 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_TARGET_CONSOLE_H__
+#define __LIBVIRT_GCONFIG_CHARDEV_TARGET_CONSOLE_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_CHARDEV_TARGET_CONSOLE            (gvir_config_chardev_target_console_get_type ())
+#define GVIR_CONFIG_CHARDEV_TARGET_CONSOLE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_CHARDEV_TARGET_CONSOLE, GVirConfigChardevTargetConsole))
+#define GVIR_CONFIG_CHARDEV_TARGET_CONSOLE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_CHARDEV_TARGET_CONSOLE, GVirConfigChardevTargetConsoleClass))
+#define GVIR_IS_CONFIG_CHARDEV_TARGET_CONSOLE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_CHARDEV_TARGET_CONSOLE))
+#define GVIR_IS_CONFIG_CHARDEV_TARGET_CONSOLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_CHARDEV_TARGET_CONSOLE))
+#define GVIR_CONFIG_CHARDEV_TARGET_CONSOLE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_CHARDEV_TARGET_CONSOLE, GVirConfigChardevTargetConsoleClass))
+
+typedef struct _GVirConfigChardevTargetConsole GVirConfigChardevTargetConsole;
+typedef struct _GVirConfigChardevTargetConsolePrivate GVirConfigChardevTargetConsolePrivate;
+typedef struct _GVirConfigChardevTargetConsoleClass GVirConfigChardevTargetConsoleClass;
+
+struct _GVirConfigChardevTargetConsole
+{
+    GVirConfigObject parent;
+
+    GVirConfigChardevTargetConsolePrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigChardevTargetConsoleClass
+{
+    GVirConfigObjectClass parent_class;
+
+    gpointer padding[20];
+};
+
+
+GType gvir_config_chardev_target_console_get_type(void);
+
+GVirConfigChardevTargetConsole *gvir_config_chardev_target_console_new(void);
+GVirConfigChardevTargetConsole *gvir_config_chardev_target_console_new_from_xml(gchar *xml,
+                                                                                GError **error);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_CHARDEV_TARGET_CONSOLE_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 0d338d7..8b4cb62 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -32,6 +32,7 @@
 #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-chardev-target-console.h>
 #include <libvirt-gconfig/libvirt-gconfig-device.h>
 #include <libvirt-gconfig/libvirt-gconfig-device-chardev.h>
 #include <libvirt-gconfig/libvirt-gconfig-device-disk.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index c9bdd96..cee96ca 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -16,6 +16,10 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_chardev_target_class_get_nick;
 	gvir_config_chardev_target_class_set_nick;
 
+	gvir_config_chardev_target_console_get_type;
+	gvir_config_chardev_target_console_new;
+	gvir_config_chardev_target_console_new_from_xml;
+
 	gvir_config_clock_get_type;
 	gvir_config_clock_offset_get_type;
 	gvir_config_clock_new;
-- 
1.7.7


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