---
libvirt-gconfig/Makefile.am | 2 +
.../libvirt-gconfig-domain-address-usb.c | 94 ++++++++++++++++++++
.../libvirt-gconfig-domain-address-usb.h | 71 +++++++++++++++
libvirt-gconfig/libvirt-gconfig.h | 1 +
libvirt-gconfig/libvirt-gconfig.sym | 6 ++
5 files changed, 174 insertions(+)
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-address-usb.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-address-usb.h
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index b69ed9d..e1b67b2 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -15,6 +15,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain.h \
libvirt-gconfig-domain-address.h \
libvirt-gconfig-domain-address-pci.h \
+ libvirt-gconfig-domain-address-usb.h \
libvirt-gconfig-domain-channel.h \
libvirt-gconfig-domain-chardev.h \
libvirt-gconfig-domain-chardev-source.h \
@@ -72,6 +73,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain.c \
libvirt-gconfig-domain-address.c \
libvirt-gconfig-domain-address-pci.c \
+ libvirt-gconfig-domain-address-usb.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-usb.c
b/libvirt-gconfig/libvirt-gconfig-domain-address-usb.c
new file mode 100644
index 0000000..8bac902
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-address-usb.c
@@ -0,0 +1,94 @@
+/*
+ * libvirt-gconfig-domain-address-usb.c: libvirt USB 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(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_ADDRESS_USB_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_ADDRESS_USB,
GVirConfigDomainAddressUsbPrivate))
+
+struct _GVirConfigDomainAddressUsbPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainAddressUsb, gvir_config_domain_address_usb,
GVIR_CONFIG_TYPE_DOMAIN_ADDRESS);
+
+
+static void gvir_config_domain_address_usb_class_init(GVirConfigDomainAddressUsbClass
*klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainAddressUsbPrivate));
+}
+
+
+static void gvir_config_domain_address_usb_init(GVirConfigDomainAddressUsb *address)
+{
+ g_debug("Init GVirConfigDomainAddressUsb=%p", address);
+
+ address->priv = GVIR_CONFIG_DOMAIN_ADDRESS_USB_GET_PRIVATE(address);
+}
+
+
+GVirConfigDomainAddressUsb *gvir_config_domain_address_usb_new(void)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_ADDRESS_USB,
+ "address", NULL);
+ return GVIR_CONFIG_DOMAIN_ADDRESS_USB(object);
+}
+
+GVirConfigDomainAddressUsb *gvir_config_domain_address_usb_new_from_xml(const gchar
*xml,
+ GError **error)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_ADDRESS_USB,
+ "address", NULL, xml, error);
+ return GVIR_CONFIG_DOMAIN_ADDRESS_USB(object);
+}
+
+void gvir_config_domain_address_usb_set_bus(GVirConfigDomainAddressUsb *address,
+ guint16 bus)
+{
+ gchar *bus_str;
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_USB(address));
+ g_return_if_fail(bus <= 0xfff);
+
+ bus_str = g_strdup_printf("0x%03x", bus);
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(address),
+ "bus", bus_str, NULL);
+ g_free(bus_str);
+}
+
+void gvir_config_domain_address_usb_set_port(GVirConfigDomainAddressUsb *address,
+ const char *port)
+{
+ /* port is a dotted notation of up to four octets, such as 1.2 or 2.1.3.1,
+ * that's why the argument is a char * and not an unsigned int */
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_USB(address));
+
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(address),
+ "port", port, NULL);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-address-usb.h
b/libvirt-gconfig/libvirt-gconfig-domain-address-usb.h
new file mode 100644
index 0000000..c7f2f78
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-address-usb.h
@@ -0,0 +1,71 @@
+/*
+ * libvirt-gconfig-domain-address-usb.h: libvirt USB 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(a)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_USB_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_ADDRESS_USB_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_ADDRESS_USB
(gvir_config_domain_address_usb_get_type ())
+#define GVIR_CONFIG_DOMAIN_ADDRESS_USB(obj) (G_TYPE_CHECK_INSTANCE_CAST
((obj), GVIR_CONFIG_TYPE_DOMAIN_ADDRESS_USB, GVirConfigDomainAddressUsb))
+#define GVIR_CONFIG_DOMAIN_ADDRESS_USB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
GVIR_CONFIG_TYPE_DOMAIN_ADDRESS_USB, GVirConfigDomainAddressUsbClass))
+#define GVIR_CONFIG_IS_DOMAIN_ADDRESS_USB(obj) (G_TYPE_CHECK_INSTANCE_TYPE
((obj), GVIR_CONFIG_TYPE_DOMAIN_ADDRESS_USB))
+#define GVIR_CONFIG_IS_DOMAIN_ADDRESS_USB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
GVIR_CONFIG_TYPE_DOMAIN_ADDRESS_USB))
+#define GVIR_CONFIG_DOMAIN_ADDRESS_USB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GVIR_CONFIG_TYPE_DOMAIN_ADDRESS_USB, GVirConfigDomainAddressUsbClass))
+
+typedef struct _GVirConfigDomainAddressUsb GVirConfigDomainAddressUsb;
+typedef struct _GVirConfigDomainAddressUsbPrivate GVirConfigDomainAddressUsbPrivate;
+typedef struct _GVirConfigDomainAddressUsbClass GVirConfigDomainAddressUsbClass;
+
+struct _GVirConfigDomainAddressUsb
+{
+ GVirConfigDomainAddress parent;
+
+ GVirConfigDomainAddressUsbPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainAddressUsbClass
+{
+ GVirConfigDomainAddressClass parent_class;
+
+ gpointer padding[20];
+};
+
+GType gvir_config_domain_address_usb_get_type(void);
+
+GVirConfigDomainAddressUsb *gvir_config_domain_address_usb_new(void);
+GVirConfigDomainAddressUsb *gvir_config_domain_address_usb_new_from_xml(const gchar
*xml,
+ GError **error);
+void gvir_config_domain_address_usb_set_bus(GVirConfigDomainAddressUsb *address,
+ guint16 bus);
+void gvir_config_domain_address_usb_set_port(GVirConfigDomainAddressUsb *address,
+ const char *port);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_ADDRESS_USB_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 28d9c86..fde6f03 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -32,6 +32,7 @@
#include <libvirt-gconfig/libvirt-gconfig-domain.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-address.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-address-pci.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-address-usb.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 57eb04f..b2d4480 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -36,6 +36,12 @@ LIBVIRT_GCONFIG_0.0.4 {
gvir_config_domain_address_get_type;
+ gvir_config_domain_address_usb_get_type;
+ gvir_config_domain_address_usb_new;
+ gvir_config_domain_address_usb_new_from_xml;
+ gvir_config_domain_address_usb_set_bus;
+ gvir_config_domain_address_usb_set_port;
+
gvir_config_domain_address_pci_get_type;
gvir_config_domain_address_pci_new;
gvir_config_domain_address_pci_new_from_xml;
--
1.7.9.3