From 165571947be770645900bb8d55ba7b6a3c58f8fd Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Mon, 4 Jan 2010 17:57:30 -0500 Subject: [PATCH] linux kernel lacks uintptr sadly only recent kernels include uintptr_t. change the cast to use unsigned long Change-Id: Ib69f7aa0f2d316c5ea8bdc960b15ee0f89f96250 Reviewed-on: http://gerrit.openafs.org/1059 Reviewed-by: Simon Wilkinson Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- acinclude.m4 | 3 +++ src/afs/afs_syscall.c | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 8be2c7b91d..45e1c3f3a9 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1485,6 +1485,9 @@ fi AC_TYPE_SOCKLEN_T AC_TYPE_SIGNAL AC_CHECK_SIZEOF(void *) +AC_CHECK_SIZEOF(unsigned long long) +AC_CHECK_SIZEOF(unsigned long) +AC_CHECK_SIZEOF(unsigned int) AC_TYPE_INTPTR_T AC_TYPE_UINTPTR_T AC_CHECK_TYPE(ssize_t, int) diff --git a/src/afs/afs_syscall.c b/src/afs/afs_syscall.c index c83e71e6c1..cc7ca9261e 100644 --- a/src/afs/afs_syscall.c +++ b/src/afs/afs_syscall.c @@ -341,13 +341,22 @@ struct iparam32 { #if defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN57_64BIT_ENV) || (defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)) || defined(NEED_IOCTL32) +#if SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT +# define uintptrsz unsigned int +#elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG +# define uintptrsz unsigned long +#elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG_LONG +# define uintptrsz unsigned long long +#else +# error "Unable to determine casting for pointers" +#endif static void iparam32_to_iparam(const struct iparam32 *src, struct iparam *dst) { - dst->param1 = (iparmtype)(uintptr_t)src->param1; - dst->param2 = (iparmtype)(uintptr_t)src->param2; - dst->param3 = (iparmtype)(uintptr_t)src->param3; - dst->param4 = (iparmtype)(uintptr_t)src->param4; + dst->param1 = (iparmtype)(uintptrsz)src->param1; + dst->param2 = (iparmtype)(uintptrsz)src->param2; + dst->param3 = (iparmtype)(uintptrsz)src->param3; + dst->param4 = (iparmtype)(uintptrsz)src->param4; } #endif