[libvirt] [libvirt-glib 03/13] Add GVirConfigDomainControllerUsb boilerplate

Christophe Fergeau cfergeau at redhat.com
Fri Apr 6 12:51:38 UTC 2012


---
 libvirt-gconfig/Makefile.am                        |    2 +
 .../libvirt-gconfig-domain-controller-usb.c        |   72 ++++++++++++++++++++
 .../libvirt-gconfig-domain-controller-usb.h        |   66 ++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig.h                  |    3 +-
 libvirt-gconfig/libvirt-gconfig.sym                |    4 ++
 5 files changed, 146 insertions(+), 1 deletion(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-controller-usb.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 06b95af..43582b0 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -21,6 +21,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-domain-clock.h \
 			libvirt-gconfig-domain-console.h \
 			libvirt-gconfig-domain-controller.h \
+			libvirt-gconfig-domain-controller-usb.h \
 			libvirt-gconfig-domain-device.h \
 			libvirt-gconfig-domain-disk.h \
 			libvirt-gconfig-domain-filesys.h \
@@ -75,6 +76,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-domain-clock.c \
 			libvirt-gconfig-domain-console.c \
 			libvirt-gconfig-domain-controller.c \
+			libvirt-gconfig-domain-controller-usb.c \
 			libvirt-gconfig-domain-device.c \
 			libvirt-gconfig-domain-disk.c \
 			libvirt-gconfig-domain-filesys.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c b/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c
new file mode 100644
index 0000000..2b7e0b6
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c
@@ -0,0 +1,72 @@
+/*
+ * libvirt-gconfig-domain-controller-usb.c: libvirt domain USB controller 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_CONTROLLER_USB_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB, GVirConfigDomainControllerUsbPrivate))
+
+struct _GVirConfigDomainControllerUsbPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainControllerUsb, gvir_config_domain_controller_usb, GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER);
+
+
+static void gvir_config_domain_controller_usb_class_init(GVirConfigDomainControllerUsbClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigDomainControllerUsbPrivate));
+}
+
+
+static void gvir_config_domain_controller_usb_init(GVirConfigDomainControllerUsb *controller_usb)
+{
+    g_debug("Init GVirConfigDomainControllerUsb=%p", controller_usb);
+
+    controller_usb->priv = GVIR_CONFIG_DOMAIN_CONTROLLER_USB_GET_PRIVATE(controller_usb);
+}
+
+
+GVirConfigDomainControllerUsb *gvir_config_domain_controller_usb_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB,
+                                    "controller", NULL);
+    gvir_config_object_set_attribute(object, "type", "usb", NULL);
+    return GVIR_CONFIG_DOMAIN_CONTROLLER_USB(object);
+}
+
+GVirConfigDomainControllerUsb *gvir_config_domain_controller_usb_new_from_xml(const gchar *xml,
+                                                                       GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB,
+                                             "controller", NULL, xml, error);
+    gvir_config_object_set_attribute(object, "type", "usb", NULL);
+    return GVIR_CONFIG_DOMAIN_CONTROLLER_USB(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.h b/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.h
new file mode 100644
index 0000000..2d50340
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-controller-usb.h
@@ -0,0 +1,66 @@
+/*
+ * libvirt-gconfig-domain-controller-usb.h: libvirt domain USB controller 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_CONTROLLER_USB_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_CONTROLLER_USB_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB            (gvir_config_domain_controller_usb_get_type ())
+#define GVIR_CONFIG_DOMAIN_CONTROLLER_USB(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB, GVirConfigDomainControllerUsb))
+#define GVIR_CONFIG_DOMAIN_CONTROLLER_USB_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB, GVirConfigDomainControllerUsbClass))
+#define GVIR_CONFIG_IS_DOMAIN_CONTROLLER_USB(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB))
+#define GVIR_CONFIG_IS_DOMAIN_CONTROLLER_USB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB))
+#define GVIR_CONFIG_DOMAIN_CONTROLLER_USB_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB, GVirConfigDomainControllerUsbClass))
+
+typedef struct _GVirConfigDomainControllerUsb GVirConfigDomainControllerUsb;
+typedef struct _GVirConfigDomainControllerUsbPrivate GVirConfigDomainControllerUsbPrivate;
+typedef struct _GVirConfigDomainControllerUsbClass GVirConfigDomainControllerUsbClass;
+
+struct _GVirConfigDomainControllerUsb
+{
+    GVirConfigDomainController parent;
+
+    GVirConfigDomainControllerUsbPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainControllerUsbClass
+{
+    GVirConfigDomainControllerClass parent_class;
+
+    gpointer padding[20];
+};
+
+GType gvir_config_domain_controller_usb_get_type(void);
+
+GVirConfigDomainControllerUsb *gvir_config_domain_controller_usb_new(void);
+GVirConfigDomainControllerUsb *gvir_config_domain_controller_usb_new_from_xml(const gchar *xml,
+                                                                              GError **error);
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_CONTROLLER_USB_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index c433060..846a1d3 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -1,7 +1,7 @@
 /*
  * libvirt-gconfig.h: libvirt gconfig integration
  *
- * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010-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
@@ -38,6 +38,7 @@
 #include <libvirt-gconfig/libvirt-gconfig-domain-clock.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-console.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-controller.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-controller-usb.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-device.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-filesys.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index a7d2c19..9453a97 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -73,6 +73,10 @@ LIBVIRT_GCONFIG_0.0.4 {
 	gvir_config_domain_controller_get_index;
 	gvir_config_domain_controller_set_index;
 
+	gvir_config_domain_controller_usb_get_type;
+	gvir_config_domain_controller_usb_new;
+	gvir_config_domain_controller_usb_new_from_xml;
+
 	gvir_config_domain_device_get_type;
 
 	gvir_config_domain_disk_get_type;
-- 
1.7.9.3




More information about the libvir-list mailing list