[libvirt] [libvirt-glib 1/2] Add GVirConfigDomainInterfaceUser boilerplate

Christophe Fergeau cfergeau at redhat.com
Wed Dec 7 10:02:33 UTC 2011


---
 libvirt-gconfig/Makefile.am                        |    2 +
 .../libvirt-gconfig-domain-interface-user.c        |   77 ++++++++++++++++++++
 .../libvirt-gconfig-domain-interface-user.h        |   68 +++++++++++++++++
 libvirt-gconfig/libvirt-gconfig.h                  |    1 +
 libvirt-gconfig/libvirt-gconfig.sym                |    4 +
 5 files changed, 152 insertions(+), 0 deletions(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-interface-user.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-interface-user.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 6363f88..e44ca85 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -28,6 +28,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-domain-input.h \
 			libvirt-gconfig-domain-interface.h \
 			libvirt-gconfig-domain-interface-network.h \
+			libvirt-gconfig-domain-interface-user.h \
 			libvirt-gconfig-domain-memballoon.h \
 			libvirt-gconfig-domain-os.h \
 			libvirt-gconfig-domain-seclabel.h \
@@ -71,6 +72,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-domain-input.c \
 			libvirt-gconfig-domain-interface.c \
 			libvirt-gconfig-domain-interface-network.c \
+			libvirt-gconfig-domain-interface-user.c \
 			libvirt-gconfig-domain-memballoon.c \
 			libvirt-gconfig-domain-os.c \
 			libvirt-gconfig-domain-seclabel.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-user.c b/libvirt-gconfig/libvirt-gconfig-domain-interface-user.c
new file mode 100644
index 0000000..2c03af2
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-user.c
@@ -0,0 +1,77 @@
+/*
+ * libvirt-gconfig-domain-interface-user.c: libvirt domain interface configuration
+ *
+ * Copyright (C) 2008 Daniel P. Berrange
+ * Copyright (C) 2011 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: Daniel P. Berrange <berrange at redhat.com>
+ * Author: Christophe Fergeau <cfergeau at redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
+#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
+
+#define GVIR_CONFIG_DOMAIN_INTERFACE_USER_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_INTERFACE_USER, GVirConfigDomainInterfaceUserPrivate))
+
+struct _GVirConfigDomainInterfaceUserPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainInterfaceUser, gvir_config_domain_interface_user, GVIR_TYPE_CONFIG_DOMAIN_INTERFACE);
+
+
+static void gvir_config_domain_interface_user_class_init(GVirConfigDomainInterfaceUserClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigDomainInterfaceUserPrivate));
+}
+
+
+static void gvir_config_domain_interface_user_init(GVirConfigDomainInterfaceUser *conn)
+{
+    g_debug("Init GVirConfigDomainInterfaceUser=%p", conn);
+
+    conn->priv = GVIR_CONFIG_DOMAIN_INTERFACE_USER_GET_PRIVATE(conn);
+}
+
+
+GVirConfigDomainInterfaceUser *gvir_config_domain_interface_user_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_INTERFACE_USER,
+                                    "interface", NULL);
+    gvir_config_object_set_attribute(object, "type", "user", NULL);
+    return GVIR_CONFIG_DOMAIN_INTERFACE_USER(object);
+}
+
+GVirConfigDomainInterfaceUser *gvir_config_domain_interface_user_new_from_xml(const gchar *xml,
+                                                                              GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_INTERFACE_USER,
+                                             "interface", NULL, xml, error);
+    if (object == NULL)
+        return NULL;
+    gvir_config_object_set_attribute(object, "type", "user", NULL);
+    return GVIR_CONFIG_DOMAIN_INTERFACE_USER(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-user.h b/libvirt-gconfig/libvirt-gconfig-domain-interface-user.h
new file mode 100644
index 0000000..bf76412
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-user.h
@@ -0,0 +1,68 @@
+/*
+ * libvirt-gconfig-domain-interface-user.c: libvirt domain interface configuration
+ *
+ * Copyright (C) 2011 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: Daniel P. Berrange <berrange at redhat.com>
+ * 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_INTERFACE_USER_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_USER_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_DOMAIN_INTERFACE_USER            (gvir_config_domain_interface_user_get_type ())
+#define GVIR_CONFIG_DOMAIN_INTERFACE_USER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_INTERFACE, GVirConfigDomainInterfaceUser))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_USER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_INTERFACE, GVirConfigDomainInterfaceUserClass))
+#define GVIR_IS_CONFIG_DOMAIN_INTERFACE_USER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_INTERFACE))
+#define GVIR_IS_CONFIG_DOMAIN_INTERFACE_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_INTERFACE))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_USER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_INTERFACE, GVirConfigDomainInterfaceUserClass))
+
+typedef struct _GVirConfigDomainInterfaceUser GVirConfigDomainInterfaceUser;
+typedef struct _GVirConfigDomainInterfaceUserPrivate GVirConfigDomainInterfaceUserPrivate;
+typedef struct _GVirConfigDomainInterfaceUserClass GVirConfigDomainInterfaceUserClass;
+
+struct _GVirConfigDomainInterfaceUser
+{
+    GVirConfigDomainInterface parent;
+
+    GVirConfigDomainInterfaceUserPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainInterfaceUserClass
+{
+    GVirConfigDomainInterfaceClass parent_class;
+
+    gpointer padding[20];
+};
+
+GType gvir_config_domain_interface_user_get_type(void);
+
+GVirConfigDomainInterfaceUser *gvir_config_domain_interface_user_new(void);
+GVirConfigDomainInterfaceUser *gvir_config_domain_interface_user_new_from_xml(const gchar *xml,
+                                                                              GError **error);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_USER_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 252f51c..5ea8c2f 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -45,6 +45,7 @@
 #include <libvirt-gconfig/libvirt-gconfig-domain-input.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-interface.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-interface-network.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-interface-user.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-memballoon.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-os.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-seclabel.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 48e2fd7..b06231c 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -117,6 +117,10 @@ LIBVIRT_GCONFIG_0.0.1 {
 	gvir_config_domain_interface_network_new_from_xml;
 	gvir_config_domain_interface_network_set_source;
 
+	gvir_config_domain_interface_user_get_type;
+	gvir_config_domain_interface_user_new;
+	gvir_config_domain_interface_user_new_from_xml;
+
 	gvir_config_domain_memballoon_get_type;
 	gvir_config_domain_memballoon_model_get_type;
 	gvir_config_domain_memballoon_new;
-- 
1.7.7.3




More information about the libvir-list mailing list