From 5296239f81a4a568d1f41b3ddd43b47cf6b3aa30 Mon Sep 17 00:00:00 2001 From: pravins Date: Tue, 25 Aug 2009 10:21:34 +0000 Subject: [PATCH] i=20339 reverting patch --- libcfs/autoconf/lustre-libcfs.m4 | 50 ++++++++++++++++++++++++++++ libcfs/include/libcfs/darwin/kp30.h | 2 ++ libcfs/include/libcfs/linux/kp30.h | 12 +++++++ libcfs/include/libcfs/posix/posix-wordsize.h | 12 +++++++ libcfs/include/libcfs/winnt/kp30.h | 2 ++ lustre/include/darwin/lustre_user.h | 4 +++ 6 files changed, 82 insertions(+) diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index 33b538b..601ccb7 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -212,6 +212,54 @@ LB_LINUX_TRY_COMPILE([ EXTRA_KCFLAGS="$tmp_flags" ]) +# check userland size_t type +AC_DEFUN([LIBCFS_SIZE_T_LONG], +[AC_MSG_CHECKING([size_t is unsigned long type]) +tmp_flags="$CFLAGS" +CFLAGS="$CFLAGS -Werror" +AC_COMPILE_IFELSE([ + #include + int main(void) { + unsigned long *data1; + size_t *data2; + + data1 = data2; + return 0; + } +],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_SIZE_T_LONG, 1, + [size_t is long type]) +],[ + AC_MSG_RESULT([no]) +]) +CFLAGS="$tmp_flags" +]) + +AC_DEFUN([LIBCFS_SSIZE_T_LONG], +[AC_MSG_CHECKING([ssize_t is signed long type]) +tmp_flags="$CFLAGS" +CFLAGS="$CFLAGS -Werror" +AC_COMPILE_IFELSE([ + #include + int main(void) { + long *data1; + ssize_t *data2; + + data1 = data2; + return 0; + } +],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_SSIZE_T_LONG, 1, + [ssize_t is long type]) +],[ + AC_MSG_RESULT([no]) +]) +CFLAGS="$tmp_flags" +]) + + # check if task_struct with rcu memeber AC_DEFUN([LIBCFS_TASK_RCU], [AC_MSG_CHECKING([if task_struct has a rcu field]) @@ -420,6 +468,8 @@ LIBCFS_STRUCT_PAGE_LIST LIBCFS_STRUCT_SIGHAND LIBCFS_FUNC_SHOW_TASK LIBCFS_U64_LONG_LONG +LIBCFS_SSIZE_T_LONG +LIBCFS_SIZE_T_LONG LIBCFS_TASK_RCU # 2.6.18 LIBCFS_TASKLIST_LOCK diff --git a/libcfs/include/libcfs/darwin/kp30.h b/libcfs/include/libcfs/darwin/kp30.h index 274b755..1fc1a1d 100644 --- a/libcfs/include/libcfs/darwin/kp30.h +++ b/libcfs/include/libcfs/darwin/kp30.h @@ -121,6 +121,8 @@ typedef struct { #define LPU64 "%llu" #define LPD64 "%lld" #define LPX64 "%#llx" +#define LPSZ "%lu" +#define LPSSZ "%ld" # define LI_POISON ((int)0x5a5a5a5a) # define LL_POISON ((long)0x5a5a5a5a) # define LP_POISON ((void *)(long)0x5a5a5a5a) diff --git a/libcfs/include/libcfs/linux/kp30.h b/libcfs/include/libcfs/linux/kp30.h index a8c3313..ae23e8c 100644 --- a/libcfs/include/libcfs/linux/kp30.h +++ b/libcfs/include/libcfs/linux/kp30.h @@ -376,6 +376,18 @@ extern int lwt_snapshot (cycles_t *now, int *ncpu, int *total_size, */ # define LPPID "%d" +#ifdef HAVE_SIZE_T_LONG +# define LPSZ "%lu" +#else +# define LPSZ "%u" +#endif + +#ifdef HAVE_SSIZE_T_LONG +# define LPSSZ "%ld" +#else +# define LPSSZ "%d" +#endif + #ifndef LPU64 # error "No word size defined" #endif diff --git a/libcfs/include/libcfs/posix/posix-wordsize.h b/libcfs/include/libcfs/posix/posix-wordsize.h index e191530..f70c3ed 100644 --- a/libcfs/include/libcfs/posix/posix-wordsize.h +++ b/libcfs/include/libcfs/posix/posix-wordsize.h @@ -131,6 +131,18 @@ typedef struct { # define LPF64 "l" #endif +#ifdef HAVE_SIZE_T_LONG +# define LPSZ "%lu" +#else +# define LPSZ "%u" +#endif + +#ifdef HAVE_SSIZE_T_LONG +# define LPSSZ "%ld" +#else +# define LPSSZ "%d" +#endif + #ifndef LPU64 # error "No word size defined" #endif diff --git a/libcfs/include/libcfs/winnt/kp30.h b/libcfs/include/libcfs/winnt/kp30.h index 5cc2f70..f2293ab 100644 --- a/libcfs/include/libcfs/winnt/kp30.h +++ b/libcfs/include/libcfs/winnt/kp30.h @@ -153,6 +153,8 @@ typedef struct { #define LPU64 "%I64u" #define LPD64 "%I64d" #define LPX64 "%#I64x" +#define LPSZ "%lu" +#define LPSSZ "%ld" /* * long_ptr_t & ulong_ptr_t, same to "long" for linux diff --git a/lustre/include/darwin/lustre_user.h b/lustre/include/darwin/lustre_user.h index 4756186..ad78b91 100644 --- a/lustre/include/darwin/lustre_user.h +++ b/lustre/include/darwin/lustre_user.h @@ -63,10 +63,14 @@ typedef struct stat lstat_t; # define LPU64 "%llu" # define LPD64 "%lld" # define LPX64 "%#llx" +# define LPSZ "%u" +# define LPSSZ "%d" #elif (BITS_PER_LONG == 64 || __WORDSIZE == 64) # define LPU64 "%lu" # define LPD64 "%ld" # define LPX64 "%#lx" +# define LPSZ "%lu" +# define LPSSZ "%ld" #endif #endif /* !LPU64 */ -- 1.8.3.1