summaryrefslogtreecommitdiff
path: root/lib/blkid
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2006-04-09 08:41:55 -0400
committerTheodore Ts'o <tytso@mit.edu>2006-04-09 08:41:55 -0400
commit4ea7ea007bb227727ee1d4dca997c4f5b21d3a30 (patch)
treea984da943ed78f0b99fa22834495255619f8a61e /lib/blkid
parentcef2ac104d45c351344cd10ac1419ad5f6422d8b (diff)
downloade2fsprogs-4ea7ea007bb227727ee1d4dca997c4f5b21d3a30.tar.gz
Fix asm_types.h type conflicts
This caused FTBFS bugs on AMD64 platforms, since it uses a different 64-bit type when compared with IA64, so we need to make our autoconfiguration system more intelligent. Addresses Debian Bugs: #360661, #360317 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'lib/blkid')
-rw-r--r--lib/blkid/ChangeLog6
-rw-r--r--lib/blkid/Makefile.in7
-rw-r--r--lib/blkid/blkid_types.h.in113
-rw-r--r--lib/blkid/tst_types.c59
4 files changed, 164 insertions, 21 deletions
diff --git a/lib/blkid/ChangeLog b/lib/blkid/ChangeLog
index 8b4eea01..98542de9 100644
--- a/lib/blkid/ChangeLog
+++ b/lib/blkid/ChangeLog
@@ -1,3 +1,9 @@
+2006-04-09 Theodore Ts'o <tytso@mit.edu>
+
+ * blkid_types.h.in, Makefile.in, tst_types.c: Use the asm_types.h
+ file to define the __[us]{8,16,32,64} types. Add a
+ tst_types program to make sure the types are correct.
+
2006-03-23 Theodore Ts'o <tytso@mit.edu>
* probe.c (blkid_verify): Fix file descriptor leak on error.
diff --git a/lib/blkid/Makefile.in b/lib/blkid/Makefile.in
index 046f182e..07b72ac1 100644
--- a/lib/blkid/Makefile.in
+++ b/lib/blkid/Makefile.in
@@ -112,6 +112,10 @@ tst_tag: $(srcdir)/tag.c $(DEPLIBS_BLKID)
@echo " LD $@"
@$(CC) -o tst_tag -DTEST_PROGRAM $(srcdir)/tag.c $(LIBS_BLKID) $(ALL_CFLAGS)
+tst_types: tst_types.o blkid_types.h
+ @echo " LD $@"
+ @$(CC) -o tst_types tst_types.o
+
../../misc/blkid.o: $(top_srcdir)/misc/blkid.c blkid.h
@echo " CC $@"
@$(CC) $(ALL_CFLAGS) -c $(top_srcdir)/misc/blkid.c \
@@ -129,8 +133,9 @@ test_probe: test_probe.in Makefile
@chmod +x test_probe
check:: all tst_cache tst_dev tst_devname tst_devno tst_getsize tst_probe \
- tst_read tst_resolve tst_save tst_tag test_probe
+ tst_read tst_resolve tst_save tst_tag test_probe tst_types
./test_probe
+ ./tst_types
blkid.pc: $(srcdir)/blkid.pc.in $(top_builddir)/config.status
@echo " CONFIG.STATUS $@"
diff --git a/lib/blkid/blkid_types.h.in b/lib/blkid/blkid_types.h.in
index 0fde69fa..cb5b10d5 100644
--- a/lib/blkid/blkid_types.h.in
+++ b/lib/blkid/blkid_types.h.in
@@ -7,55 +7,128 @@
!defined(_EXT2_TYPES_H))
#define _BLKID_TYPES_H
+@ASM_TYPES_HEADER@
+
+#ifdef __U8_TYPEDEF
+typedef __U8_TYPEDEF __u8;
+#else
typedef unsigned char __u8;
+#endif
+
+#ifdef __S8_TYPEDEF
+typedef __S8_TYPEDEF __s8;
+#else
typedef signed char __s8;
+#endif
-#if (@SIZEOF_INT@ == 8)
-typedef int __s64;
-typedef unsigned int __u64;
+#ifdef __U16_TYPEDEF
+typedef __U16_TYPEDEF __u16;
#else
-#if (@SIZEOF_LONG@ == 8)
-typedef long __s64;
-typedef unsigned long __u64;
+#if (@SIZEOF_INT@ == 2)
+typedef unsigned int __u16;
#else
-#if (@SIZEOF_LONG_LONG@ == 8)
-#if defined(__GNUC__)
-typedef __signed__ long long __s64;
+#if (@SIZEOF_SHORT@ == 2)
+typedef unsigned short __u16;
#else
-typedef signed long long __s64;
-#endif /* __GNUC__ */
-typedef unsigned long long __u64;
-#endif /* SIZEOF_LONG_LONG == 8 */
-#endif /* SIZEOF_LONG == 8 */
-#endif /* SIZEOF_INT == 8 */
+ ?==error: undefined 16 bit type
+#endif /* SIZEOF_SHORT == 2 */
+#endif /* SIZEOF_INT == 2 */
+#endif /* __U16_TYPEDEF */
+#ifdef __S16_TYPEDEF
+typedef __S16_TYPEDEF __s16;
+#else
#if (@SIZEOF_INT@ == 2)
typedef int __s16;
-typedef unsigned int __u16;
#else
#if (@SIZEOF_SHORT@ == 2)
typedef short __s16;
-typedef unsigned short __u16;
#else
?==error: undefined 16 bit type
#endif /* SIZEOF_SHORT == 2 */
#endif /* SIZEOF_INT == 2 */
+#endif /* __S16_TYPEDEF */
+
+#ifdef __U32_TYPEDEF
+typedef __U32_TYPEDEF __u32;
+#else
#if (@SIZEOF_INT@ == 4)
-typedef int __s32;
typedef unsigned int __u32;
#else
#if (@SIZEOF_LONG@ == 4)
-typedef long __s32;
typedef unsigned long __u32;
#else
#if (@SIZEOF_SHORT@ == 4)
-typedef short __s32;
typedef unsigned short __u32;
#else
?== error: undefined 32 bit type
#endif /* SIZEOF_SHORT == 4 */
#endif /* SIZEOF_LONG == 4 */
#endif /* SIZEOF_INT == 4 */
+#endif /* __U32_TYPEDEF */
+
+#ifdef __S32_TYPEDEF
+typedef __S32_TYPEDEF __s32;
+#else
+#if (@SIZEOF_INT@ == 4)
+typedef int __s32;
+#else
+#if (@SIZEOF_LONG@ == 4)
+typedef long __s32;
+#else
+#if (@SIZEOF_SHORT@ == 4)
+typedef short __s32;
+#else
+ ?== error: undefined 32 bit type
+#endif /* SIZEOF_SHORT == 4 */
+#endif /* SIZEOF_LONG == 4 */
+#endif /* SIZEOF_INT == 4 */
+#endif /* __S32_TYPEDEF */
+
+#ifdef __U64_TYPEDEF
+typedef __U64_TYPEDEF __u64;
+#else
+#if (@SIZEOF_INT@ == 8)
+typedef unsigned int __u64;
+#else
+#if (@SIZEOF_LONG@ == 8)
+typedef unsigned long __u64;
+#else
+#if (@SIZEOF_LONG_LONG@ == 8)
+typedef unsigned long long __u64;
+#endif /* SIZEOF_LONG_LONG == 8 */
+#endif /* SIZEOF_LONG == 8 */
+#endif /* SIZEOF_INT == 8 */
+#endif /* __U64_TYPEDEF */
+
+#ifdef __S64_TYPEDEF
+typedef __S64_TYPEDEF __s64;
+#else
+#if (@SIZEOF_INT@ == 8)
+typedef int __s64;
+#else
+#if (@SIZEOF_LONG@ == 8)
+typedef long __s64;
+#else
+#if (@SIZEOF_LONG_LONG@ == 8)
+#if defined(__GNUC__)
+typedef __signed__ long long __s64;
+#else
+typedef signed long long __s64;
+#endif /* __GNUC__ */
+#endif /* SIZEOF_LONG_LONG == 8 */
+#endif /* SIZEOF_LONG == 8 */
+#endif /* SIZEOF_INT == 8 */
+#endif /* __S64_TYPEDEF */
+
+#undef __S8_TYPEDEF
+#undef __U8_TYPEDEF
+#undef __S16_TYPEDEF
+#undef __U16_TYPEDEF
+#undef __S32_TYPEDEF
+#undef __U32_TYPEDEF
+#undef __S64_TYPEDEF
+#undef __U64_TYPEDEF
#endif /* _*_TYPES_H */
diff --git a/lib/blkid/tst_types.c b/lib/blkid/tst_types.c
new file mode 100644
index 00000000..53cfc816
--- /dev/null
+++ b/lib/blkid/tst_types.c
@@ -0,0 +1,59 @@
+/*
+ * This testing program makes sure the blkid_types header file
+ *
+ * Copyright (C) 2006 by Theodore Ts'o.
+ *
+ * %Begin-Header%
+ * This file may be redistributed under the terms of the GNU Public
+ * License.
+ * %End-Header%
+ */
+
+#include "blkid/blkid_types.h"
+
+main(int argc, char **argv)
+{
+ if (sizeof(__u8) != 1) {
+ printf("Sizeof(__u8) is %d should be 1\n",
+ sizeof(__u8));
+ exit(1);
+ }
+ if (sizeof(__s8) != 1) {
+ printf("Sizeof(_s8) is %d should be 1\n",
+ sizeof(__s8));
+ exit(1);
+ }
+ if (sizeof(__u16) != 2) {
+ printf("Sizeof(__u16) is %d should be 2\n",
+ sizeof(__u16));
+ exit(1);
+ }
+ if (sizeof(__s16) != 2) {
+ printf("Sizeof(__s16) is %d should be 2\n",
+ sizeof(__s16));
+ exit(1);
+ }
+ if (sizeof(__u32) != 4) {
+ printf("Sizeof(__u32) is %d should be 4\n",
+ sizeof(__u32));
+ exit(1);
+ }
+ if (sizeof(__s32) != 4) {
+ printf("Sizeof(__s32) is %d should be 4\n",
+ sizeof(__s32));
+ exit(1);
+ }
+ if (sizeof(__u64) != 8) {
+ printf("Sizeof(__u64) is %d should be 8\n",
+ sizeof(__u64));
+ exit(1);
+ }
+ if (sizeof(__s64) != 8) {
+ printf("Sizeof(__s64) is %d should be 8\n",
+ sizeof(__s64));
+ exit(1);
+ }
+ printf("The blkid_types.h types are correct.\n");
+ exit(0);
+}
+