From: Marc Dionne Date: Tue, 13 Apr 2010 22:58:11 +0000 (-0400) Subject: Fix new UKERNEL warnings on 64-bit X-Git-Tag: openafs-devel-1_5_74~30 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=ea44842df8f5098798e3b8ffb1b6ff62cbfcc246 Fix new UKERNEL warnings on 64-bit Commit 830cb48c enabled new warnings when building UKERNEL, which causes builds with --enable-checking to fail. These are 64-bit specific warnings from int to pointer conversions and one printf warning. Changes: - cast printf argument to (int) in afs_usrops.c - use (iparmtype)(uintptrsz) to convert 32-bit integers to pointers - move the definition of uintptrsz to src/afs/afs.h so its available to other source files, and remove the original definition in afs_syscall.c Change-Id: Id0a5fd762cf10a741f89e3a2ed0a85556137df49 Reviewed-on: http://gerrit.openafs.org/1748 Reviewed-by: Andrew Deason Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/afs/UKERNEL/afs_usrops.c b/src/afs/UKERNEL/afs_usrops.c index e946b90..42ddd21 100644 --- a/src/afs/UKERNEL/afs_usrops.c +++ b/src/afs/UKERNEL/afs_usrops.c @@ -1286,7 +1286,7 @@ SweepAFSCache(int *vFilesFound) printf("\tinode=%d, name='%s'\n", currp->d_ino, currp->d_name); #else - printf("\tinode=%d, reclen=%d, name='%s'\n", currp->d_ino, + printf("\tinode=%d, reclen=%d, name='%s'\n", (int)currp->d_ino, currp->d_reclen, currp->d_name); #endif } diff --git a/src/afs/afs.h b/src/afs/afs.h index d4da4f8..44f6679 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -1013,6 +1013,16 @@ typedef long iparmtype; #endif #endif +#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 + struct afs_ioctl { uparmtype in; /* input buffer */ uparmtype out; /* output buffer */ diff --git a/src/afs/afs_lock.c b/src/afs/afs_lock.c index 3b3608c..d227d53 100644 --- a/src/afs/afs_lock.c +++ b/src/afs/afs_lock.c @@ -272,10 +272,10 @@ afs_BozonLock(struct afs_bozoLock *alock, struct vcache *avc) while (1) { if (alock->count == 0) { /* lock not held, we win */ - alock->proc = afs_int_to_pointer(MyPidxx2Pid(MyPidxx)); + alock->proc = afs_int_to_pointer((iparmtype)(uintptrsz)MyPidxx2Pid(MyPidxx)); alock->count = 1; return; - } else if (alock->proc == afs_int_to_pointer(MyPidxx2Pid(MyPidxx))) { + } else if (alock->proc == afs_int_to_pointer((iparmtype)(uintptrsz)MyPidxx2Pid(MyPidxx))) { /* lock is held, but by us, so we win anyway */ alock->count++; return; @@ -325,7 +325,7 @@ afs_CheckBozonLockBlocking(struct afs_bozoLock *alock) { AFS_STATCNT(afs_CheckBozonLockBlocking); if (alock->count || (alock->flags & AFS_BOZONWAITING)) - if (alock->proc != afs_int_to_pointer(MyPidxx2Pid(MyPidxx))) + if (alock->proc != afs_int_to_pointer((iparmtype)(uintptrsz)MyPidxx2Pid(MyPidxx))) return 1; return 0; } diff --git a/src/afs/afs_syscall.c b/src/afs/afs_syscall.c index f5dcf56..bc73da7 100644 --- a/src/afs/afs_syscall.c +++ b/src/afs/afs_syscall.c @@ -346,15 +346,6 @@ 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) {