]> err.no Git - systemd/commitdiff
gudev: Fix up GUdevDeviceNumber
authorDavid Zeuthen <davidz@redhat.com>
Sun, 8 Nov 2009 17:25:55 +0000 (12:25 -0500)
committerDavid Zeuthen <davidz@redhat.com>
Sun, 8 Nov 2009 17:31:35 +0000 (12:31 -0500)
Actually dev_t is an unsigned quad type (e.g. 64-bit even on 32-bit
x86) so defining it to be an integer is wrong and not future
proof. Thus, redefine it to actually be a dev_t (as originally wanted)
and instead add a work-around for GNOME bug #584517, see

https://bugzilla.gnome.org/show_bug.cgi?id=584517

for details. This way, GObject Introspection will still work.

This change is technically an API/ABI break but

 - all released GUdev versions requires the user to understand that
   the API/ABI is unstable by requiring the G_UDEV_API_IS_SUBJECT_TO_CHANGE
   symbols to be defined

 - functions using GUdevDeviceNumber are rarely used

so we don't bump the so number.

Signed-off-by: David Zeuthen <davidz@redhat.com>
Makefile.am
extras/gudev/gudevtypes.h

index 2185614c43822572fccdf51f559c8b18d90b2255..92598a60c24f600a4a986e1cd043088694a31588 100644 (file)
@@ -378,7 +378,7 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil
                --pkg=gobject-2.0 \
                -I$(top_srcdir)/extras \
                -D_GUDEV_COMPILATION \
-               -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \
+               -D_GUDEV_WORK_AROUND_DEV_T_BUG \
                $(top_srcdir)/extras/gudev/gudev.h \
                $(top_srcdir)/extras/gudev/gudevtypes.h \
                $(top_srcdir)/extras/gudev/gudevenums.h \
index 66156723f2411d97630ecf667a07f1cf72f68f7d..b95cf9752945c615ce3491f846b023f08df62147 100644 (file)
@@ -26,6 +26,7 @@
 #define __G_UDEV_TYPES_H__
 
 #include <gudev/gudevenums.h>
+#include <sys/types.h>
 
 G_BEGIN_DECLS
 
@@ -36,9 +37,13 @@ typedef struct _GUdevDevice GUdevDevice;
  * GUdevDeviceNumber:
  *
  * Corresponds to the standard #dev_t type as defined by POSIX (Until
- * bug 584517 is resolved this is aliased to an integer).
+ * bug 584517 is resolved this work-around is needed).
  */
-typedef int GUdevDeviceNumber;
+#ifdef _GUDEV_WORK_AROUND_DEV_T_BUG
+typedef guint64 GUdevDeviceNumber; /* __UQUAD_TYPE */
+#else
+typedef dev_t GUdevDeviceNumber;
+#endif
 
 G_END_DECLS