This is an abstract type which will be used as a base class for all objects stored in the <devices> section of a domain. -- v3: rename to GVirConfigDomainDevice --- libvirt-gconfig/Makefile.am | 2 + libvirt-gconfig/libvirt-gconfig-domain-device.c | 61 +++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-device.h | 64 +++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig.h | 1 + libvirt-gconfig/libvirt-gconfig.sym | 3 + 5 files changed, 131 insertions(+), 0 deletions(-) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-device.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-device.h diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index 1c65755..b5cbd7c 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -13,6 +13,7 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-capabilities.h \ libvirt-gconfig-domain.h \ libvirt-gconfig-domain-clock.h \ + libvirt-gconfig-domain-device.h \ libvirt-gconfig-domain-os.h \ libvirt-gconfig-domain-snapshot.h \ libvirt-gconfig-domain-timer.h \ @@ -32,6 +33,7 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-capabilities.c \ libvirt-gconfig-domain.c \ libvirt-gconfig-domain-clock.c \ + libvirt-gconfig-domain-device.c \ libvirt-gconfig-domain-os.c \ libvirt-gconfig-domain-snapshot.c \ libvirt-gconfig-domain-timer.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device.c b/libvirt-gconfig/libvirt-gconfig-domain-device.c new file mode 100644 index 0000000..63cf289 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-device.c @@ -0,0 +1,61 @@ +/* + * libvirt-gobject-config-domain-device.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_DOMAIN_DEVICE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_DEVICE, GVirConfigDomainDevicePrivate)) + +struct _GVirConfigDomainDevicePrivate +{ + gboolean unused; +}; + +G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainDevice, gvir_config_domain_device, GVIR_TYPE_CONFIG_OBJECT); + + +static void gvir_config_domain_device_class_init(GVirConfigDomainDeviceClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainDevicePrivate)); +} + + +static void gvir_config_domain_device_init(GVirConfigDomainDevice *device) +{ + GVirConfigDomainDevicePrivate *priv; + + DEBUG("Init GVirConfigDomainDevice=%p", device); + + priv = device->priv = GVIR_CONFIG_DOMAIN_DEVICE_GET_PRIVATE(device); + + memset(priv, 0, sizeof(*priv)); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device.h b/libvirt-gconfig/libvirt-gconfig-domain-device.h new file mode 100644 index 0000000..ba15cbb --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-device.h @@ -0,0 +1,64 @@ +/* + * libvirt-gobject-domain-device.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_DOMAIN_DEVICE_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_DEVICE_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_DEVICE (gvir_config_domain_device_get_type ()) +#define GVIR_CONFIG_DOMAIN_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_DEVICE, GVirConfigDomainDevice)) +#define GVIR_CONFIG_DOMAIN_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_DEVICE, GVirConfigDomainDeviceClass)) +#define GVIR_IS_CONFIG_DOMAIN_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_DEVICE)) +#define GVIR_IS_CONFIG_DOMAIN_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_DEVICE)) +#define GVIR_CONFIG_DOMAIN_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_DEVICE, GVirConfigDomainDeviceClass)) + +typedef struct _GVirConfigDomainDevice GVirConfigDomainDevice; +typedef struct _GVirConfigDomainDevicePrivate GVirConfigDomainDevicePrivate; +typedef struct _GVirConfigDomainDeviceClass GVirConfigDomainDeviceClass; + +struct _GVirConfigDomainDevice +{ + GVirConfigObject parent; + + GVirConfigDomainDevicePrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainDeviceClass +{ + GVirConfigObjectClass parent_class; + + gpointer padding[20]; +}; + + +GType gvir_config_domain_device_get_type(void); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_DEVICE_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index c9d06cf..c3f8603 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-domain.h> #include <libvirt-gconfig/libvirt-gconfig-domain-clock.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-device.h> #include <libvirt-gconfig/libvirt-gconfig-domain-os.h> #include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h> #include <libvirt-gconfig/libvirt-gconfig-domain-timer.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index bb8568b..bfdd125 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -4,6 +4,7 @@ LIBVIRT_GOBJECT_0.0.1 { gvir_config_capabilities_new; gvir_config_capabilities_new_from_xml; + gvir_config_domain_get_type; gvir_config_domain_new; gvir_config_domain_new_from_xml; @@ -26,6 +27,8 @@ LIBVIRT_GOBJECT_0.0.1 { gvir_config_domain_clock_set_timezone; gvir_config_domain_clock_set_variable_offset; + gvir_config_domain_device_get_type; + gvir_config_domain_os_get_type; gvir_config_domain_os_boot_device_get_type; gvir_config_domain_os_sm_bios_mode_get_type; -- 1.7.7.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list