Fix new UKERNEL warnings on 64-bit
authorMarc Dionne <marc.c.dionne@gmail.com>
Tue, 13 Apr 2010 22:58:11 +0000 (18:58 -0400)
committerDerrick Brashear <shadow@dementia.org>
Tue, 13 Apr 2010 23:21:36 +0000 (16:21 -0700)
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 <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/afs/UKERNEL/afs_usrops.c
src/afs/afs.h
src/afs/afs_lock.c
src/afs/afs_syscall.c

index e946b90..42ddd21 100644 (file)
@@ -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
        }
index d4da4f8..44f6679 100644 (file)
@@ -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 */
index 3b3608c..d227d53 100644 (file)
@@ -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;
 }
index f5dcf56..bc73da7 100644 (file)
@@ -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)
 {