Re: [libvirt] [PATCH libvirt-glib 1/3] Add GVirDomainDevice abstract class

2011-11-14 Thread Christophe Fergeau
Hey,

On Thu, Nov 10, 2011 at 04:10:32PM -0500, Marc-André Lureau wrote:
> - Mensaje original -
> > > +G_GNUC_INTERNAL
> > > +virDomainPtr gvir_domain_device_get_domain_handle(GVirDomainDevice
> > > *self)
> > 
> > G_GNUC_INTERNAL isn't needed here since it's the default setting for
> > symbols not listed in the .sym file.
> > 
> 
> I think it's better to be explicit about it. It's a way to declare in the
> code that this function is private, without having to look into the sym
> file. I wish we could do the same for the rest of the prviate functions.

Given that having it or not will have exactly the same result, I have
doubts we'll consistently mark all private functions with G_GNUC_INTERNAL.
Only having some of the private functions marked with it, and the others
without the marking will only create more confusion.
If we are careful about marking all private functions with G_GNUC_INTERNAL,
then why not.

Christophe


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

Re: [libvirt] [PATCH libvirt-glib 1/3] Add GVirDomainDevice abstract class

2011-11-10 Thread Marc-André Lureau
Hi

- Mensaje original -
> > +G_GNUC_INTERNAL
> > +virDomainPtr gvir_domain_device_get_domain_handle(GVirDomainDevice
> > *self)
> 
> G_GNUC_INTERNAL isn't needed here since it's the default setting for
> symbols not listed in the .sym file.
> 

I think it's better to be explicit about it. It's a way to declare in the code 
that this function is private, without having to look into the sym file. I wish 
we could do the same for the rest of the prviate functions.

regards

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


Re: [libvirt] [PATCH libvirt-glib 1/3] Add GVirDomainDevice abstract class

2011-11-10 Thread Christophe Fergeau
Hey, a few preliminary comments,

On Thu, Nov 10, 2011 at 09:33:41PM +0100, Marc-André Lureau wrote:
> +
> +G_GNUC_INTERNAL
> +virDomainPtr gvir_domain_device_get_domain_handle(GVirDomainDevice *self)

G_GNUC_INTERNAL isn't needed here since it's the default setting for
symbols not listed in the .sym file.

Christophe


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

[libvirt] [PATCH libvirt-glib 1/3] Add GVirDomainDevice abstract class

2011-11-10 Thread Marc-André Lureau
---
 libvirt-gobject/Makefile.am|3 +
 .../libvirt-gobject-domain-device-private.h|   31 +
 libvirt-gobject/libvirt-gobject-domain-device.c|  139 
 libvirt-gobject/libvirt-gobject-domain-device.h|   64 +
 libvirt-gobject/libvirt-gobject.h  |1 +
 libvirt-gobject/libvirt-gobject.sym|2 +
 6 files changed, 240 insertions(+), 0 deletions(-)
 create mode 100644 libvirt-gobject/libvirt-gobject-domain-device-private.h
 create mode 100644 libvirt-gobject/libvirt-gobject-domain-device.c
 create mode 100644 libvirt-gobject/libvirt-gobject-domain-device.h

diff --git a/libvirt-gobject/Makefile.am b/libvirt-gobject/Makefile.am
index 4f84b8b..56a047e 100644
--- a/libvirt-gobject/Makefile.am
+++ b/libvirt-gobject/Makefile.am
@@ -7,6 +7,7 @@ GOBJECT_HEADER_FILES = \
libvirt-gobject.h \
libvirt-gobject-main.h \
libvirt-gobject-domain-snapshot.h \
+   libvirt-gobject-domain-device.h \
libvirt-gobject-domain.h \
libvirt-gobject-interface.h \
libvirt-gobject-network.h \
@@ -21,6 +22,7 @@ GOBJECT_HEADER_FILES = \
 GOBJECT_SOURCE_FILES = \
libvirt-gobject-main.c \
libvirt-gobject-domain-snapshot.c \
+   libvirt-gobject-domain-device.c \
libvirt-gobject-domain.c \
libvirt-gobject-interface.c \
libvirt-gobject-network.c \
@@ -42,6 +44,7 @@ libvirt_gobject_1_0_la_HEADERS = \
$(GOBJECT_HEADER_FILES) \
libvirt-gobject-input-stream.h
 nodist_libvirt_gobject_1_0_la_HEADERS = \
+   libvirt-gobject-domain-device-private.h \
libvirt-gobject-enums.h
 libvirt_gobject_1_0_la_SOURCES = \
$(libvirt_gobject_1_0_la_HEADERS) \
diff --git a/libvirt-gobject/libvirt-gobject-domain-device-private.h 
b/libvirt-gobject/libvirt-gobject-domain-device-private.h
new file mode 100644
index 000..2a34309
--- /dev/null
+++ b/libvirt-gobject/libvirt-gobject-domain-device-private.h
@@ -0,0 +1,31 @@
+/*
+ * libvirt-gobject-domain-device-private.h: 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: Marc-André Lureau 
+ */
+#ifndef __LIBVIRT_GOBJECT_DOMAIN_DEVICE_PRIVATE_H__
+#define __LIBVIRT_GOBJECT_DOMAIN_DEVICE_PRIVATEH__
+
+G_BEGIN_DECLS
+
+virDomainPtr gvir_domain_device_get_domain_handle(GVirDomainDevice *self);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GOBJECT_DOMAIN_DEVICE_PRIVATEH__ */
diff --git a/libvirt-gobject/libvirt-gobject-domain-device.c 
b/libvirt-gobject/libvirt-gobject-domain-device.c
new file mode 100644
index 000..ae03489
--- /dev/null
+++ b/libvirt-gobject/libvirt-gobject-domain-device.c
@@ -0,0 +1,139 @@
+/*
+ * 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: Marc-André Lureau 
+ */
+
+#include 
+
+#include 
+#include 
+
+#include "libvirt-glib/libvirt-glib.h"
+#include "libvirt-gobject/libvirt-gobject.h"
+
+#include "libvirt-gobject/libvirt-gobject-domain-device-private.h"
+
+extern gboolean debugFlag;
+
+#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## 
__VA_ARGS__); } while (0)
+
+#define GVIR_DOMAIN_DEVICE_GET_PRIVATE(o