Whamcloud - gitweb
LU-5018 libcfs: don't depend on configure for lustre_user.h 40/11840/2
authorAndreas Dilger <andreas.dilger@intel.com>
Tue, 9 Sep 2014 23:24:54 +0000 (17:24 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 2 Nov 2014 02:33:12 +0000 (02:33 +0000)
Don't depend on configure to detect the presence of <linux/types.h>
in order to define the __u8, __u16, __u32, and __u64 types.  Instead,
just define these types directly if <linux/types.h> is not included
already.

The <linux/types.h> header is available on Linux systems with GCC
installed, which is required to build Lustre anyway.  On non-Linux
systems they should create an appropriate <linux/types.h> compat
header in the include path.

Lustre-change: http://review.whamcloud.com/10258
Lustre-commit: 241cdb8ba008d47fd96f0b6529797ce922e2b635

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: Ida0915fe1b5829f3378e459c782844cf9df060e6
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/11840
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/include/libcfs/linux/kp30.h
libcfs/include/libcfs/posix/posix-types.h

index e6d7e5d..9542aa4 100644 (file)
@@ -436,46 +436,6 @@ AC_CHECK_TYPE([umode_t],
        [],
        [#include <asm/types.h>])
 
-AC_CHECK_TYPE([__s8],
-       [AC_DEFINE(HAVE___S8, 1, [__s8 is defined])],
-       [],
-       [#include <asm/types.h>])
-
-AC_CHECK_TYPE([__u8],
-       [AC_DEFINE(HAVE___U8, 1, [__u8 is defined])],
-       [],
-       [#include <asm/types.h>])
-
-AC_CHECK_TYPE([__s16],
-       [AC_DEFINE(HAVE___S16, 1, [__s16 is defined])],
-       [],
-       [#include <asm/types.h>])
-
-AC_CHECK_TYPE([__u16],
-       [AC_DEFINE(HAVE___U16, 1, [__u16 is defined])],
-       [],
-       [#include <asm/types.h>])
-
-AC_CHECK_TYPE([__s32],
-       [AC_DEFINE(HAVE___S32, 1, [__s32 is defined])],
-       [],
-       [#include <asm/types.h>])
-
-AC_CHECK_TYPE([__u32],
-       [AC_DEFINE(HAVE___U32, 1, [__u32 is defined])],
-       [],
-       [#include <asm/types.h>])
-
-AC_CHECK_TYPE([__u64],
-       [AC_DEFINE(HAVE___U64, 1, [__u64 is defined])],
-       [],
-       [#include <asm/types.h>])
-
-AC_CHECK_TYPE([__s64],
-       [AC_DEFINE(HAVE___S64, 1, [__s64 is defined])],
-       [],
-       [#include <asm/types.h>])
-
 # check userland __u64 type
 AC_MSG_CHECKING([userspace __u64 is long long type])
 tmp_flags="$CFLAGS"
index 274c599..d745717 100644 (file)
@@ -233,8 +233,7 @@ extern int  lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size,
 
 #define _LWORDSIZE BITS_PER_LONG
 
-#if (defined(__KERNEL__) && defined(HAVE_KERN__U64_LONG_LONG)) || \
-    (!defined(__KERNEL__) && defined(HAVE_USER__U64_LONG_LONG))
+#if defined(HAVE_KERN__U64_LONG_LONG)
 # define LPU64 "%llu"
 # define LPD64 "%lld"
 # define LPX64 "%#llx"
index d4a378d..fca6225 100644 (file)
 #ifndef _LUSTRE_POSIX_TYPES_H
 #define _LUSTRE_POSIX_TYPES_H
 
-#include <asm/types.h>
+#ifdef __linux__
+# include <linux/types.h>
+#endif
 #include <stdbool.h> /* for bool */
 #ifndef HAVE_UMODE_T
 typedef unsigned short umode_t;
 #else
 #endif
 
+#ifndef _LINUX_TYPES_H
 /*
  * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
  * header files exported to user space
  */
 
 #ifndef HAVE___S8
+#define HAVE___S8
 typedef __signed__ char __s8;
 #endif
 #ifndef HAVE___U8
+#define HAVE___U8
 typedef unsigned char __u8;
 #endif
 
 #ifndef HAVE___S16
+#define HAVE___S16
 typedef __signed__ short __s16;
 #endif
 #ifndef HAVE___U16
+#define HAVE___U16
 typedef unsigned short __u16;
 #endif
 
 #ifndef HAVE___S32
+#define HAVE___S32
 typedef __signed__ int __s32;
 #endif
 #ifndef HAVE___U32
+#define HAVE___U32
 typedef unsigned int __u32;
 #endif
 
@@ -81,19 +90,24 @@ typedef unsigned int __u32;
  */
 #if defined(__powerpc64__) && !defined(__KERNEL__)
 # ifndef HAVE___S64
+# define HAVE___S64
 typedef __signed__ long __s64;
 # endif
 # ifndef HAVE___U64
+# define HAVE___U64
 typedef unsigned long __u64;
 # endif
 #else /* !defined(__powerpc64__) || defined(__KERNEL__) */
 # ifndef HAVE___S64
+# define HAVE___S64
 typedef __signed__ long long __s64;
 # endif
 # ifndef HAVE___U64
+# define HAVE___U64
 typedef unsigned long long __u64;
 # endif
-#endif
+#endif /* defined(__powerpc64__) && !defined(__KERNEL__) */
+#endif /* _LINUX_TYPES_H */
 
 /* long integer with size equal to pointer */
 typedef unsigned long ulong_ptr_t;