From 241cdb8ba008d47fd96f0b6529797ce922e2b635 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Thu, 8 May 2014 22:38:58 -0600 Subject: [PATCH] LU-5018 libcfs: don't depend on configure for lustre_user.h Don't depend on configure to detect the presence of in order to define the __u8, __u16, __u32, and __u64 types. Instead, just define these types directly if is not included already. The 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 compat header in the include path. Signed-off-by: Andreas Dilger Change-Id: Ida0915fe1b5829f3378e459c782844cf9df060e6 Reviewed-on: http://review.whamcloud.com/10258 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- libcfs/autoconf/lustre-libcfs.m4 | 65 ------------------------------- libcfs/include/libcfs/linux/kp30.h | 3 +- libcfs/include/libcfs/posix/posix-types.h | 16 +++++++- 3 files changed, 15 insertions(+), 69 deletions(-) diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index dba971d..ac5c413 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -377,71 +377,6 @@ AC_CHECK_TYPE([umode_t], [], [#include ]) -AC_CHECK_TYPE([__s8], - [AC_DEFINE(HAVE___S8, 1, [__s8 is defined])], - [], - [#include ]) - -AC_CHECK_TYPE([__u8], - [AC_DEFINE(HAVE___U8, 1, [__u8 is defined])], - [], - [#include ]) - -AC_CHECK_TYPE([__s16], - [AC_DEFINE(HAVE___S16, 1, [__s16 is defined])], - [], - [#include ]) - -AC_CHECK_TYPE([__u16], - [AC_DEFINE(HAVE___U16, 1, [__u16 is defined])], - [], - [#include ]) - -AC_CHECK_TYPE([__s32], - [AC_DEFINE(HAVE___S32, 1, [__s32 is defined])], - [], - [#include ]) - -AC_CHECK_TYPE([__u32], - [AC_DEFINE(HAVE___U32, 1, [__u32 is defined])], - [], - [#include ]) - -AC_CHECK_TYPE([__u64], - [AC_DEFINE(HAVE___U64, 1, [__u64 is defined])], - [], - [#include ]) - -AC_CHECK_TYPE([__s64], - [AC_DEFINE(HAVE___S64, 1, [__s64 is defined])], - [], - [#include ]) - -# check userland __u64 type -tmp_flags="$CFLAGS" -CFLAGS="$CFLAGS -Werror" -AC_CACHE_CHECK([if userspace '__u64' is 'long long' type], -lb_cv_compile_userspace_u64_long_long, [ -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ - #include - #include - #include - int main(void) { - unsigned long long *data1; - __u64 *data2 = NULL; - data1 = data2; - data2 = data1; - return 0; - } -])], - [lb_cv_compile_userspace_u64_long_long="yes"], - [lb_cv_compile_userspace_u64_long_long="no"]) -]) -CFLAGS="$tmp_flags" -AS_IF([test "x$lb_cv_compile_userspace_u64_long_long" = xyes], - [AC_DEFINE(HAVE_USER__U64_LONG_LONG, 1, - [__u64 is long long type])]) - # -------- Check for required packages -------------- AC_MSG_NOTICE([LibCFS required packages checks diff --git a/libcfs/include/libcfs/linux/kp30.h b/libcfs/include/libcfs/linux/kp30.h index 2dfdf6c..e100620 100644 --- a/libcfs/include/libcfs/linux/kp30.h +++ b/libcfs/include/libcfs/linux/kp30.h @@ -125,8 +125,7 @@ #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" diff --git a/libcfs/include/libcfs/posix/posix-types.h b/libcfs/include/libcfs/posix/posix-types.h index 510b17848..ee722a5 100644 --- a/libcfs/include/libcfs/posix/posix-types.h +++ b/libcfs/include/libcfs/posix/posix-types.h @@ -42,7 +42,7 @@ #ifndef _LUSTRE_POSIX_TYPES_H #define _LUSTRE_POSIX_TYPES_H -#ifdef HAVE_LINUX_TYPES_H +#ifdef __linux__ # include #endif #include /* for bool */ @@ -51,29 +51,36 @@ 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 @@ -83,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; -- 1.8.3.1