[libvirt-glib 18/37] Add gobject boilerplate for GVirConfigDeviceDisk

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

 



---
 libvirt-gconfig/Makefile.am                   |    2 +
 libvirt-gconfig/libvirt-gconfig-device-disk.c |   82 +++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-device-disk.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-device-disk.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-device-disk.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 86a7065..82063df 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -13,6 +13,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-capabilities.h \
 			libvirt-gconfig-clock.h \
 			libvirt-gconfig-device.h \
+			libvirt-gconfig-device-disk.h \
 			libvirt-gconfig-domain.h \
 			libvirt-gconfig-domain-snapshot.h \
 			libvirt-gconfig-helpers.h \
@@ -32,6 +33,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-capabilities.c \
 			libvirt-gconfig-clock.c \
 			libvirt-gconfig-device.c \
+			libvirt-gconfig-device-disk.c \
 			libvirt-gconfig-domain.c \
 			libvirt-gconfig-domain-snapshot.c \
 			libvirt-gconfig-enum-types.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-device-disk.c b/libvirt-gconfig/libvirt-gconfig-device-disk.c
new file mode 100644
index 0000000..ba2ef47
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-device-disk.c
@@ -0,0 +1,82 @@
+/*
+ * libvirt-gobject-config-device-disk.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_DEVICE_DISK_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DEVICE_DISK, GVirConfigDeviceDiskPrivate))
+
+struct _GVirConfigDeviceDiskPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDeviceDisk, gvir_config_device_disk, GVIR_TYPE_CONFIG_DEVICE);
+
+
+static void gvir_config_device_disk_class_init(GVirConfigDeviceDiskClass *klass)
+{
+
+    g_type_class_add_private(klass, sizeof(GVirConfigDeviceDiskPrivate));
+}
+
+
+static void gvir_config_device_disk_init(GVirConfigDeviceDisk *disk)
+{
+    GVirConfigDeviceDiskPrivate *priv;
+
+    DEBUG("Init GVirConfigDeviceDisk=%p", disk);
+
+    priv = disk->priv = GVIR_CONFIG_DEVICE_DISK_GET_PRIVATE(disk);
+
+    memset(priv, 0, sizeof(*priv));
+}
+
+
+GVirConfigDeviceDisk *gvir_config_device_disk_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_TYPE_CONFIG_DEVICE_DISK,
+                                    "disk", NULL);
+    return GVIR_CONFIG_DEVICE_DISK(object);
+}
+
+GVirConfigDeviceDisk *gvir_config_device_disk_new_from_xml(const gchar *xml,
+                                                           GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DEVICE_DISK,
+                                             "disk", NULL, xml, error);
+    return GVIR_CONFIG_DEVICE_DISK(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-device-disk.h b/libvirt-gconfig/libvirt-gconfig-device-disk.h
new file mode 100644
index 0000000..4e9d622
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-device-disk.h
@@ -0,0 +1,68 @@
+/*
+ * libvirt-gobject-device-disk.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_DEVICE_DISK_H__
+#define __LIBVIRT_GCONFIG_DEVICE_DISK_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_DEVICE_DISK            (gvir_config_device_disk_get_type ())
+#define GVIR_CONFIG_DEVICE_DISK(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DEVICE_DISK, GVirConfigDeviceDisk))
+#define GVIR_CONFIG_DEVICE_DISK_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DEVICE_DISK, GVirConfigDeviceDiskClass))
+#define GVIR_IS_CONFIG_DEVICE_DISK(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DEVICE_DISK))
+#define GVIR_IS_CONFIG_DEVICE_DISK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DEVICE_DISK))
+#define GVIR_CONFIG_DEVICE_DISK_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DEVICE_DISK, GVirConfigDeviceDiskClass))
+
+typedef struct _GVirConfigDeviceDisk GVirConfigDeviceDisk;
+typedef struct _GVirConfigDeviceDiskPrivate GVirConfigDeviceDiskPrivate;
+typedef struct _GVirConfigDeviceDiskClass GVirConfigDeviceDiskClass;
+
+struct _GVirConfigDeviceDisk
+{
+    GVirConfigObject parent;
+
+    GVirConfigDeviceDiskPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDeviceDiskClass
+{
+    GVirConfigObjectClass parent_class;
+
+    gpointer padding[20];
+};
+
+
+GType gvir_config_device_disk_get_type(void);
+
+GVirConfigDeviceDisk *gvir_config_device_disk_new(void);
+GVirConfigDeviceDisk *gvir_config_device_disk_new_from_xml(const gchar *xml,
+                                                           GError **error);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DEVICE_DISK_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index e13dbdc..01a1af3 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-device.h>
+#include <libvirt-gconfig/libvirt-gconfig-device-disk.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h>
 #include <libvirt-gconfig/libvirt-gconfig-enum-types.h>
 #include <libvirt-gconfig/libvirt-gconfig-helpers.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 3aaca0b..b19e1c1 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -14,6 +14,10 @@ LIBVIRT_GOBJECT_0.0.1 {
 
 	gvir_config_device_get_type;
 
+	gvir_config_device_disk_get_type;
+	gvir_config_device_disk_new;
+	gvir_config_device_disk_new_from_xml;
+
 	gvir_config_domain_get_type;
 	gvir_config_domain_new;
 	gvir_config_domain_new_from_xml;
-- 
1.7.7

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