-- v3: rename to GVirConfigDomainDisk --- libvirt-gconfig/Makefile.am | 2 + libvirt-gconfig/libvirt-gconfig-domain-disk.c | 81 +++++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-domain-disk.h | 68 +++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig.h | 1 + libvirt-gconfig/libvirt-gconfig.sym | 5 +- 5 files changed, 156 insertions(+), 1 deletions(-) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-disk.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-disk.h
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index b5cbd7c..4945554 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -14,6 +14,7 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain.h \ libvirt-gconfig-domain-clock.h \ libvirt-gconfig-domain-device.h \ + libvirt-gconfig-domain-disk.h \ libvirt-gconfig-domain-os.h \ libvirt-gconfig-domain-snapshot.h \ libvirt-gconfig-domain-timer.h \ @@ -34,6 +35,7 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain.c \ libvirt-gconfig-domain-clock.c \ libvirt-gconfig-domain-device.c \ + libvirt-gconfig-domain-disk.c \ libvirt-gconfig-domain-os.c \ libvirt-gconfig-domain-snapshot.c \ libvirt-gconfig-domain-timer.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.c b/libvirt-gconfig/libvirt-gconfig-domain-disk.c new file mode 100644 index 0000000..41f456b --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.c @@ -0,0 +1,81 @@ +/* + * libvirt-gobject-config-domain-disk.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 <cferg...@gmail.com> + */ + +#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_DISK_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_DISK, GVirConfigDomainDiskPrivate)) + +struct _GVirConfigDomainDiskPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainDisk, gvir_config_domain_disk, GVIR_TYPE_CONFIG_DOMAIN_DEVICE); + + +static void gvir_config_domain_disk_class_init(GVirConfigDomainDiskClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainDiskPrivate)); +} + + +static void gvir_config_domain_disk_init(GVirConfigDomainDisk *disk) +{ + GVirConfigDomainDiskPrivate *priv; + + DEBUG("Init GVirConfigDomainDisk=%p", disk); + + priv = disk->priv = GVIR_CONFIG_DOMAIN_DISK_GET_PRIVATE(disk); + + memset(priv, 0, sizeof(*priv)); +} + + +GVirConfigDomainDisk *gvir_config_domain_disk_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_DISK, + "disk", NULL); + return GVIR_CONFIG_DOMAIN_DISK(object); +} + +GVirConfigDomainDisk *gvir_config_domain_disk_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_DISK, + "disk", NULL, xml, error); + return GVIR_CONFIG_DOMAIN_DISK(object); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.h b/libvirt-gconfig/libvirt-gconfig-domain-disk.h new file mode 100644 index 0000000..98835f7 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.h @@ -0,0 +1,68 @@ +/* + * libvirt-gobject-domain-disk.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 <cferg...@gmail.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_DISK_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_DISK_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_DISK (gvir_config_domain_disk_get_type ()) +#define GVIR_CONFIG_DOMAIN_DISK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_DISK, GVirConfigDomainDisk)) +#define GVIR_CONFIG_DOMAIN_DISK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_DISK, GVirConfigDomainDiskClass)) +#define GVIR_IS_CONFIG_DOMAIN_DISK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_DISK)) +#define GVIR_IS_CONFIG_DOMAIN_DISK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_DISK)) +#define GVIR_CONFIG_DOMAIN_DISK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_DISK, GVirConfigDomainDiskClass)) + +typedef struct _GVirConfigDomainDisk GVirConfigDomainDisk; +typedef struct _GVirConfigDomainDiskPrivate GVirConfigDomainDiskPrivate; +typedef struct _GVirConfigDomainDiskClass GVirConfigDomainDiskClass; + +struct _GVirConfigDomainDisk +{ + GVirConfigDomainDevice parent; + + GVirConfigDomainDiskPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainDiskClass +{ + GVirConfigDomainDeviceClass parent_class; + + gpointer padding[20]; +}; + + +GType gvir_config_domain_disk_get_type(void); + +GVirConfigDomainDisk *gvir_config_domain_disk_new(void); +GVirConfigDomainDisk *gvir_config_domain_disk_new_from_xml(const gchar *xml, + GError **error); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_DISK_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index c3f8603..5d1d8dd 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -31,6 +31,7 @@ #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-disk.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 bfdd125..1bc03ec 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -4,7 +4,6 @@ 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; @@ -29,6 +28,10 @@ LIBVIRT_GOBJECT_0.0.1 { gvir_config_domain_device_get_type; + gvir_config_domain_disk_get_type; + gvir_config_domain_disk_new; + gvir_config_domain_disk_new_from_xml; + 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@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list