[libvirt] [libvirt-gconfig PATCHv2 13/32] Add gobject boilerplate for GVirConfigOs

2011-11-21 Thread Christophe Fergeau
---
 libvirt-gconfig/Makefile.am  |2 +
 libvirt-gconfig/libvirt-gconfig-os.c |   79 ++
 libvirt-gconfig/libvirt-gconfig-os.h |   67 
 libvirt-gconfig/libvirt-gconfig.h|3 +-
 libvirt-gconfig/libvirt-gconfig.sym  |4 ++
 5 files changed, 154 insertions(+), 1 deletions(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-os.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-os.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 13655f9..648ded0 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -19,6 +19,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-network.h \
libvirt-gconfig-network-filter.h \
libvirt-gconfig-node-device.h \
+   libvirt-gconfig-os.h \
libvirt-gconfig-secret.h \
libvirt-gconfig-timer.h \
libvirt-gconfig-storage-pool.h \
@@ -38,6 +39,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-network.c \
libvirt-gconfig-network-filter.c \
libvirt-gconfig-node-device.c \
+   libvirt-gconfig-os.c \
libvirt-gconfig-secret.c \
libvirt-gconfig-timer.c \
libvirt-gconfig-storage-pool.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-os.c 
b/libvirt-gconfig/libvirt-gconfig-os.c
new file mode 100644
index 000..c09e32a
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-os.c
@@ -0,0 +1,79 @@
+/*
+ * libvirt-gobject-config_os.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 
+ */
+
+#include 
+
+#include 
+
+#include 
+
+#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_OS_GET_PRIVATE(obj) \
+(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_OS, 
GVirConfigOsPrivate))
+
+struct _GVirConfigOsPrivate
+{
+gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigOs, gvir_config_os, GVIR_TYPE_CONFIG_OBJECT);
+
+
+static void gvir_config_os_class_init(GVirConfigOsClass *klass)
+{
+g_type_class_add_private(klass, sizeof(GVirConfigOsPrivate));
+}
+
+
+static void gvir_config_os_init(GVirConfigOs *os)
+{
+GVirConfigOsPrivate *priv;
+
+DEBUG("Init GVirConfigOs=%p", os);
+
+priv = os->priv = GVIR_CONFIG_OS_GET_PRIVATE(os);
+
+memset(priv, 0, sizeof(*priv));
+}
+
+
+GVirConfigOs *gvir_config_os_new(void)
+{
+GVirConfigObject *object;
+
+object = gvir_config_object_new(GVIR_TYPE_CONFIG_OS, "os", NULL);
+return GVIR_CONFIG_OS(object);
+}
+
+GVirConfigOs *gvir_config_os_new_from_xml(const gchar *xml, GError **error)
+{
+GVirConfigObject *object;
+
+object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_OS, "os",
+ NULL, xml, error);
+return GVIR_CONFIG_OS(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-os.h 
b/libvirt-gconfig/libvirt-gconfig-os.h
new file mode 100644
index 000..716f588
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-os.h
@@ -0,0 +1,67 @@
+/*
+ * libvirt-gobject-os.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: 

Re: [libvirt] [libvirt-gconfig PATCHv2 13/32] Add gobject boilerplate for GVirConfigOs

2011-11-22 Thread Daniel P. Berrange
On Mon, Nov 21, 2011 at 07:04:10PM +0100, Christophe Fergeau wrote:
> ---
>  libvirt-gconfig/Makefile.am  |2 +
>  libvirt-gconfig/libvirt-gconfig-os.c |   79 
> ++
>  libvirt-gconfig/libvirt-gconfig-os.h |   67 
>  libvirt-gconfig/libvirt-gconfig.h|3 +-
>  libvirt-gconfig/libvirt-gconfig.sym  |4 ++
>  5 files changed, 154 insertions(+), 1 deletions(-)
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-os.c
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-os.h

ACK


> +static void gvir_config_os_init(GVirConfigOs *os)
> +{
> +GVirConfigOsPrivate *priv;
> +
> +DEBUG("Init GVirConfigOs=%p", os);
> +
> +priv = os->priv = GVIR_CONFIG_OS_GET_PRIVATE(os);
> +
> +memset(priv, 0, sizeof(*priv));
> +}

Can drop the memset() since we previously figured out we don't need that.

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 13/32] Add gobject boilerplate for GVirConfigOs

2011-11-22 Thread Daniel P. Berrange
On Tue, Nov 22, 2011 at 01:01:17PM +, Daniel P. Berrange wrote:
> On Mon, Nov 21, 2011 at 07:04:10PM +0100, Christophe Fergeau wrote:
> > ---
> >  libvirt-gconfig/Makefile.am  |2 +
> >  libvirt-gconfig/libvirt-gconfig-os.c |   79 
> > ++
> >  libvirt-gconfig/libvirt-gconfig-os.h |   67 
> >  libvirt-gconfig/libvirt-gconfig.h|3 +-
> >  libvirt-gconfig/libvirt-gconfig.sym  |4 ++
> >  5 files changed, 154 insertions(+), 1 deletions(-)
> >  create mode 100644 libvirt-gconfig/libvirt-gconfig-os.c
> >  create mode 100644 libvirt-gconfig/libvirt-gconfig-os.h
> 
> ACK

Sorry, needs renaming to GVirConfigDomainOs.


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 13/32] Add gobject boilerplate for GVirConfigOs

2011-11-23 Thread Christophe Fergeau
On Tue, Nov 22, 2011 at 01:01:17PM +, Daniel P. Berrange wrote:
> On Mon, Nov 21, 2011 at 07:04:10PM +0100, Christophe Fergeau wrote:
> > +static void gvir_config_os_init(GVirConfigOs *os)
> > +{
> > +GVirConfigOsPrivate *priv;
> > +
> > +DEBUG("Init GVirConfigOs=%p", os);
> > +
> > +priv = os->priv = GVIR_CONFIG_OS_GET_PRIVATE(os);
> > +
> > +memset(priv, 0, sizeof(*priv));
> > +}
> 
> Can drop the memset() since we previously figured out we don't need that.

Dropped everywhere in an additional patch in v3

Christophe


pgp5yYaoMCerI.pgp
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list