[libvirt] [libvirt-gconfig PATCHv2 07/14] Add GVirConfigDomainAddress abstract type

Christophe Fergeau cfergeau at redhat.com
Wed Apr 11 13:48:15 UTC 2012


This is an abstract type which will be the base class for device
addresses.
---
 libvirt-gconfig/Makefile.am                      |    2 +
 libvirt-gconfig/libvirt-gconfig-domain-address.c |   50 +++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain-address.h |   63 ++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig.h                |    1 +
 libvirt-gconfig/libvirt-gconfig.sym              |    2 +
 5 files changed, 118 insertions(+)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-address.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-address.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 43582b0..0172d06 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -13,6 +13,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-object.h \
 			libvirt-gconfig-capabilities.h \
 			libvirt-gconfig-domain.h \
+			libvirt-gconfig-domain-address.h \
 			libvirt-gconfig-domain-channel.h \
 			libvirt-gconfig-domain-chardev.h \
 			libvirt-gconfig-domain-chardev-source.h \
@@ -68,6 +69,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-main.c \
 			libvirt-gconfig-capabilities.c \
 			libvirt-gconfig-domain.c \
+			libvirt-gconfig-domain-address.c \
 			libvirt-gconfig-domain-channel.c \
 			libvirt-gconfig-domain-chardev.c \
 			libvirt-gconfig-domain-chardev-source.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-address.c b/libvirt-gconfig/libvirt-gconfig-domain-address.c
new file mode 100644
index 0000000..d0cf8c1
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-address.c
@@ -0,0 +1,50 @@
+/*
+ * libvirt-gconfig-domain-address.c: libvirt domain address configuration
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * 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 redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_ADDRESS_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_ADDRESS, GVirConfigDomainAddressPrivate))
+
+struct _GVirConfigDomainAddressPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainAddress, gvir_config_domain_address, GVIR_CONFIG_TYPE_OBJECT);
+
+
+static void gvir_config_domain_address_class_init(GVirConfigDomainAddressClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigDomainAddressPrivate));
+}
+
+
+static void gvir_config_domain_address_init(GVirConfigDomainAddress *address)
+{
+    g_debug("Init GVirConfigDomainAddress=%p", address);
+
+    address->priv = GVIR_CONFIG_DOMAIN_ADDRESS_GET_PRIVATE(address);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-address.h b/libvirt-gconfig/libvirt-gconfig-domain-address.h
new file mode 100644
index 0000000..6866ee8
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-address.h
@@ -0,0 +1,63 @@
+/*
+ * libvirt-gconfig-domain-address.h: libvirt device address configuration
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * 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 redhat.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_DOMAIN_ADDRESS_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_ADDRESS_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_ADDRESS            (gvir_config_domain_address_get_type ())
+#define GVIR_CONFIG_DOMAIN_ADDRESS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_ADDRESS, GVirConfigDomainAddress))
+#define GVIR_CONFIG_DOMAIN_ADDRESS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_ADDRESS, GVirConfigDomainAddressClass))
+#define GVIR_CONFIG_IS_DOMAIN_ADDRESS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_ADDRESS))
+#define GVIR_CONFIG_IS_DOMAIN_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_ADDRESS))
+#define GVIR_CONFIG_DOMAIN_ADDRESS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_ADDRESS, GVirConfigDomainAddressClass))
+
+typedef struct _GVirConfigDomainAddress GVirConfigDomainAddress;
+typedef struct _GVirConfigDomainAddressPrivate GVirConfigDomainAddressPrivate;
+typedef struct _GVirConfigDomainAddressClass GVirConfigDomainAddressClass;
+
+struct _GVirConfigDomainAddress
+{
+    GVirConfigObject parent;
+
+    GVirConfigDomainAddressPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainAddressClass
+{
+    GVirConfigObjectClass parent_class;
+
+    gpointer padding[20];
+};
+
+GType gvir_config_domain_address_get_type(void);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_ADDRESS_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 846a1d3..69fbd42 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -30,6 +30,7 @@
 #include <libvirt-gconfig/libvirt-gconfig-object.h>
 #include <libvirt-gconfig/libvirt-gconfig-capabilities.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-address.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-chardev.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-chardev-source.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 06d7b32..21c9530 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -34,6 +34,8 @@ LIBVIRT_GCONFIG_0.0.4 {
 	gvir_config_domain_set_virt_type;
 	gvir_config_domain_virt_type_get_type;
 
+	gvir_config_domain_address_get_type;
+
 	gvir_config_domain_channel_get_type;
 	gvir_config_domain_channel_new;
 	gvir_config_domain_channel_new_from_xml;
-- 
1.7.10




More information about the libvir-list mailing list