[libvirt-glib PATCHv3 07/27] Add gobject boilerplate for GVirConfigDomainOs

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

 



--
v3: rename from GVirConfigOs to GVirConfigDomainOs
---
 libvirt-gconfig/Makefile.am                 |    2 +
 libvirt-gconfig/libvirt-gconfig-domain-os.c |   79 +++++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain-os.h |   67 +++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig.h           |    3 +-
 libvirt-gconfig/libvirt-gconfig.sym         |    4 ++
 5 files changed, 154 insertions(+), 1 deletions(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-os.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-os.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 641aab3..1c65755 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -13,6 +13,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-capabilities.h \
 			libvirt-gconfig-domain.h \
 			libvirt-gconfig-domain-clock.h \
+			libvirt-gconfig-domain-os.h \
 			libvirt-gconfig-domain-snapshot.h \
 			libvirt-gconfig-domain-timer.h \
 			libvirt-gconfig-helpers.h \
@@ -31,6 +32,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-capabilities.c \
 			libvirt-gconfig-domain.c \
 			libvirt-gconfig-domain-clock.c \
+			libvirt-gconfig-domain-os.c \
 			libvirt-gconfig-domain-snapshot.c \
 			libvirt-gconfig-domain-timer.c \
 			libvirt-gconfig-enum-types.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-os.c b/libvirt-gconfig/libvirt-gconfig-domain-os.c
new file mode 100644
index 0000000..7c8bfbb
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-os.c
@@ -0,0 +1,79 @@
+/*
+ * libvirt-gobject-config-domain-os.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@xxxxxxxxx>
+ */
+
+#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_DOMAIN_OS_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_OS, GVirConfigDomainOsPrivate))
+
+struct _GVirConfigDomainOsPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainOs, gvir_config_domain_os, GVIR_TYPE_CONFIG_OBJECT);
+
+
+static void gvir_config_domain_os_class_init(GVirConfigDomainOsClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigDomainOsPrivate));
+}
+
+
+static void gvir_config_domain_os_init(GVirConfigDomainOs *os)
+{
+    GVirConfigDomainOsPrivate *priv;
+
+    DEBUG("Init GVirConfigDomainOs=%p", os);
+
+    priv = os->priv = GVIR_CONFIG_DOMAIN_OS_GET_PRIVATE(os);
+
+    memset(priv, 0, sizeof(*priv));
+}
+
+
+GVirConfigDomainOs *gvir_config_domain_os_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_OS, "os", NULL);
+    return GVIR_CONFIG_DOMAIN_OS(object);
+}
+
+GVirConfigDomainOs *gvir_config_domain_os_new_from_xml(const gchar *xml, GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_OS, "os",
+                                             NULL, xml, error);
+    return GVIR_CONFIG_DOMAIN_OS(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-os.h b/libvirt-gconfig/libvirt-gconfig-domain-os.h
new file mode 100644
index 0000000..8d5d6a9
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-os.h
@@ -0,0 +1,67 @@
+/*
+ * libvirt-gobject-domain-os.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@xxxxxxxxx>
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
+#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
+#endif
+
+#ifndef __LIBVIRT_GCONFIG_DOMAIN_OS_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_OS_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_DOMAIN_OS            (gvir_config_domain_os_get_type ())
+#define GVIR_CONFIG_DOMAIN_OS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_OS, GVirConfigDomainOs))
+#define GVIR_CONFIG_DOMAIN_OS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_OS, GVirConfigDomainOsClass))
+#define GVIR_IS_CONFIG_DOMAIN_OS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_OS))
+#define GVIR_IS_CONFIG_DOMAIN_OS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_OS))
+#define GVIR_CONFIG_DOMAIN_OS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_OS, GVirConfigDomainOsClass))
+
+typedef struct _GVirConfigDomainOs GVirConfigDomainOs;
+typedef struct _GVirConfigDomainOsPrivate GVirConfigDomainOsPrivate;
+typedef struct _GVirConfigDomainOsClass GVirConfigDomainOsClass;
+
+struct _GVirConfigDomainOs
+{
+    GVirConfigObject parent;
+
+    GVirConfigDomainOsPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainOsClass
+{
+    GVirConfigObjectClass parent_class;
+
+    gpointer padding[20];
+};
+
+
+GType gvir_config_domain_os_get_type(void);
+
+GVirConfigDomainOs *gvir_config_domain_os_new(void);
+GVirConfigDomainOs *gvir_config_domain_os_new_from_xml(const gchar *xml, GError **error);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_OS_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 3c00788..c9d06cf 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -30,14 +30,15 @@
 #include <libvirt-gconfig/libvirt-gconfig-capabilities.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-clock.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-os.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-timer.h>
 #include <libvirt-gconfig/libvirt-gconfig-enum-types.h>
 #include <libvirt-gconfig/libvirt-gconfig-helpers.h>
 #include <libvirt-gconfig/libvirt-gconfig-interface.h>
 #include <libvirt-gconfig/libvirt-gconfig-network.h>
-#include <libvirt-gconfig/libvirt-gconfig-node-device.h>
 #include <libvirt-gconfig/libvirt-gconfig-network-filter.h>
+#include <libvirt-gconfig/libvirt-gconfig-node-device.h>
 #include <libvirt-gconfig/libvirt-gconfig-secret.h>
 #include <libvirt-gconfig/libvirt-gconfig-storage-pool.h>
 #include <libvirt-gconfig/libvirt-gconfig-storage-vol.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index ab4fce8..ed04457 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -23,6 +23,10 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_domain_clock_set_timezone;
 	gvir_config_domain_clock_set_variable_offset;
 
+	gvir_config_domain_os_get_type;
+	gvir_config_domain_os_new;
+	gvir_config_domain_os_new_from_xml;
+
 	gvir_config_domain_snapshot_get_type;
 	gvir_config_domain_snapshot_new;
 	gvir_config_domain_snapshot_new_from_xml;
-- 
1.7.7.3

--
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]