]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
inttypes: detect and define missing integer types 1035/head
authorNoah Watkins <noahwatkins@gmail.com>
Sun, 21 Jul 2013 01:41:40 +0000 (18:41 -0700)
committerNoah Watkins <noahwatkins@gmail.com>
Thu, 2 Jan 2014 19:03:48 +0000 (11:03 -0800)
Working around missing integer types is pretty easy. For example, the
__u32 family are Linux-specific types, and using these in Ceph
internally is fine because we can typedef them.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
configure.ac
src/crush/builder.c
src/crush/crush.c
src/crush/mapper.c
src/include/int_types.h
src/include/linux_fiemap.h

index 8ed663dc1b83b7fb065ee1c18329447dc08d7aa1..fde34ee05abbfda9e129506c8ff20d8d257cdf11 100644 (file)
@@ -676,6 +676,14 @@ AC_CHECK_FUNC([pthread_spin_init],
 LIBS="$saved_LIBS"
 CFLAGS="$saved_CFLAGS"
 
+AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
+  int64_t, uint64_t])
+
+dnl check for Linux types
+AC_CHECK_HEADERS([linux/types.h])
+AC_CHECK_TYPES([__u8, __s8, __u16, __s16, __u32, __s32, __u64, __s64, __le16,
+  __be16, __le32, __be32, __le64, __be64], [], [], [[#include <linux/types.h>]])
+
 # Checks for typedefs, structures, and compiler characteristics.
 #AC_HEADER_STDBOOL
 #AC_C_CONST
index 9bfde0bd8e2597e446d6a8fe5cfb04d8aef68459..c524cfcf1e2e4961c8d3f7b01a6f9246249a0a8f 100644 (file)
@@ -6,6 +6,8 @@
 #include <assert.h>
 #include <errno.h>
 
+#include "include/int_types.h"
+
 #include "builder.h"
 #include "hash.h"
 
index ec7072d24c88516920b4a75f9b1f10655621a8ea..519793a02166cfce3f1454f33847d5ad103e537a 100644 (file)
@@ -6,6 +6,7 @@
 # include <assert.h>
 # define kfree(x) do { if (x) free(x); } while (0)
 # define BUG_ON(x) assert(!(x))
+# include "include/int_types.h"
 #endif
 
 #include "crush.h"
index 76c3b62d0da86dac21bd79b6b71b52cfd756b5fb..9baa231d12b7975c021a3263b54f9c58ddacc179 100644 (file)
@@ -17,6 +17,7 @@
 # define kmalloc(x, f) malloc(x)
 # define kfree(x) free(x)
 /*# define DEBUG_INDEP*/
+# include "include/int_types.h"
 #endif
 
 #include "crush.h"
index f290f9d8d2357bc5f2f6199b096f91e66ac4e68c..98220e9a52e57bcd83c276322fbadae538ef0cff 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "acconfig.h"
 
-#if defined(__linux__)
+#ifdef HAVE_LINUX_TYPES_H
 #include <linux/types.h>
 #endif
 
 #  endif
 #endif
 
-#if defined(__FreeBSD__)
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 
-typedef int8_t __s8;
+#ifndef HAVE___U8
 typedef uint8_t __u8;
-typedef int16_t __s16;
+#endif
+
+#ifndef HAVE___S8
+typedef int8_t __s8;
+#endif
+
+#ifndef HAVE___U16
 typedef uint16_t __u16;
-typedef int32_t __s32;
+#endif
+
+#ifndef HAVE___S16
+typedef int16_t __s16;
+#endif
+
+#ifndef HAVE___U32
 typedef uint32_t __u32;
-typedef int64_t __s64;
+#endif
+
+#ifndef HAVE___S32
+typedef int32_t __s32;
+#endif
+
+#ifndef HAVE___U64
 typedef uint64_t __u64;
+#endif
+
+#ifndef HAVE___S64
+typedef int64_t __s64;
+#endif
 
 #define __bitwise__
 
@@ -72,4 +96,3 @@ typedef __u64 __bitwise__ __le64;
 typedef __u64 __bitwise__ __be64;
 
 #endif
-#endif
index 352208b220783595ddb2260229d73c8229733db9..181104875041574113fe041446b1a75c639f560a 100644 (file)
@@ -18,6 +18,8 @@
 #include <sys/types.h>
 #endif
 
+#include "include/int_types.h"
+
 struct fiemap_extent {
        __u64 fe_logical;  /* logical offset in bytes for the start of
                            * the extent from the beginning of the file */