Re: [libvirt] [libvirt-gconfig PATCHv2 18/32] Add gobject boilerplate for GVirConfigDevice

2011-11-22 Thread Daniel P. Berrange
On Mon, Nov 21, 2011 at 07:04:15PM +0100, Christophe Fergeau wrote:
 This is an abstract type which will be used as a base class for
 all objects stored in the devices section of a domain.
 ---
  libvirt-gconfig/Makefile.am  |2 +
  libvirt-gconfig/libvirt-gconfig-device.c |   61 
  libvirt-gconfig/libvirt-gconfig-device.h |   64 
 ++
  libvirt-gconfig/libvirt-gconfig.h|1 +
  libvirt-gconfig/libvirt-gconfig.sym  |2 +
  5 files changed, 130 insertions(+), 0 deletions(-)
  create mode 100644 libvirt-gconfig/libvirt-gconfig-device.c
  create mode 100644 libvirt-gconfig/libvirt-gconfig-device.h

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-gconfig PATCHv2 18/32] Add gobject boilerplate for GVirConfigDevice

2011-11-22 Thread Daniel P. Berrange
On Tue, Nov 22, 2011 at 01:06:11PM +, Daniel P. Berrange wrote:
 On Mon, Nov 21, 2011 at 07:04:15PM +0100, Christophe Fergeau wrote:
  This is an abstract type which will be used as a base class for
  all objects stored in the devices section of a domain.
  ---
   libvirt-gconfig/Makefile.am  |2 +
   libvirt-gconfig/libvirt-gconfig-device.c |   61 
  
   libvirt-gconfig/libvirt-gconfig-device.h |   64 
  ++
   libvirt-gconfig/libvirt-gconfig.h|1 +
   libvirt-gconfig/libvirt-gconfig.sym  |2 +
   5 files changed, 130 insertions(+), 0 deletions(-)
   create mode 100644 libvirt-gconfig/libvirt-gconfig-device.c
   create mode 100644 libvirt-gconfig/libvirt-gconfig-device.h
 
 ACK

Sorry, needs renaming to GVirConfigDomainDevice


Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [libvirt-gconfig PATCHv2 18/32] Add gobject boilerplate for GVirConfigDevice

2011-11-21 Thread Christophe Fergeau
This is an abstract type which will be used as a base class for
all objects stored in the devices section of a domain.
---
 libvirt-gconfig/Makefile.am  |2 +
 libvirt-gconfig/libvirt-gconfig-device.c |   61 
 libvirt-gconfig/libvirt-gconfig-device.h |   64 ++
 libvirt-gconfig/libvirt-gconfig.h|1 +
 libvirt-gconfig/libvirt-gconfig.sym  |2 +
 5 files changed, 130 insertions(+), 0 deletions(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-device.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-device.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 648ded0..dda41e8 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -12,6 +12,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-object.h \
libvirt-gconfig-capabilities.h \
libvirt-gconfig-clock.h \
+   libvirt-gconfig-device.h \
libvirt-gconfig-domain.h \
libvirt-gconfig-domain-snapshot.h \
libvirt-gconfig-helpers.h \
@@ -31,6 +32,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-object.c \
libvirt-gconfig-capabilities.c \
libvirt-gconfig-clock.c \
+   libvirt-gconfig-device.c \
libvirt-gconfig-domain.c \
libvirt-gconfig-domain-snapshot.c \
libvirt-gconfig-enum-types.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-device.c 
b/libvirt-gconfig/libvirt-gconfig-device.c
new file mode 100644
index 000..ad08222
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-device.c
@@ -0,0 +1,61 @@
+/*
+ * libvirt-gobject-config-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 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_DEVICE_GET_PRIVATE(obj) \
+(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DEVICE, 
GVirConfigDevicePrivate))
+
+struct _GVirConfigDevicePrivate
+{
+gboolean unused;
+};
+
+G_DEFINE_ABSTRACT_TYPE(GVirConfigDevice, gvir_config_device, 
GVIR_TYPE_CONFIG_OBJECT);
+
+
+static void gvir_config_device_class_init(GVirConfigDeviceClass *klass)
+{
+g_type_class_add_private(klass, sizeof(GVirConfigDevicePrivate));
+}
+
+
+static void gvir_config_device_init(GVirConfigDevice *device)
+{
+GVirConfigDevicePrivate *priv;
+
+DEBUG(Init GVirConfigDevice=%p, device);
+
+priv = device-priv = GVIR_CONFIG_DEVICE_GET_PRIVATE(device);
+
+memset(priv, 0, sizeof(*priv));
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-device.h 
b/libvirt-gconfig/libvirt-gconfig-device.h
new file mode 100644
index 000..abd10c2
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-device.h
@@ -0,0 +1,64 @@
+/*
+ * libvirt-gobject-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 cferg...@gmail.com
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__)  !defined(LIBVIRT_GCONFIG_BUILD)
+#error Only libvirt-gconfig/libvirt-gconfig.h can be included