Rename printf cast helpers and clean up format string warnings
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Fri, 10 Jul 2009 23:41:02 +0000 (00:41 +0100)
committerRuss Allbery <rra@stanford.edu>
Sat, 11 Jul 2009 00:28:02 +0000 (18:28 -0600)
Some confusion had ensued about the usage of our printf cast helper
functions. Rename these to attempt to allay that confusion, and restore
the functions themselves to their original definitions.

Essentially, afs_printable_int32_ld() and friends are helpers to go
from afs specifc types to things that can be emitted by printf without
causing compiler warnings.

Also clean up some additional warnings from type mismatches between
escapes in printf format strings and the variables being printed.

Reviewed-on: http://gerrit.openafs.org/50
Verified-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Russ Allbery <rra@stanford.edu>

30 files changed:
src/auth/ktc.c
src/bozo/bnode.c
src/bozo/bos.c
src/bucoord/commands.c
src/butc/dump.c
src/butc/tcmain.c
src/config/stds.h
src/des/quad_cksum.c
src/kauth/admin_tools.c
src/libadmin/samples/cm_local_cell.c
src/libadmin/samples/rxdebug_conns.c
src/libadmin/samples/rxdebug_rx_stats.c
src/libadmin/samples/rxdebug_supported_stats.c
src/libadmin/test/util.h
src/libadmin/test/vos.c
src/rx/rx_event.c
src/ubik/utst_client.c
src/uss/uss_vol.c
src/viced/host.c
src/viced/viced.c
src/vlserver/vlserver.c
src/vol/fssync-debug.c
src/vol/fssync-server.c
src/vol/listinodes.c
src/vol/namei_ops.c
src/vol/vol-info.c
src/vol/vol-salvage.c
src/vol/volume.c
src/vol/vutil.c
src/volser/vos.c

index 466607c..01ec233 100644 (file)
@@ -1686,8 +1686,8 @@ ktc_newpag(void)
        sprintf(fname, "%s%d", prefix, getuid());
        sprintf(fname5, "%s%d", prefix5, getuid());
     } else {
-       sprintf(fname, "%sp%lu", prefix, afs_cast_uint32(pag));
-       sprintf(fname5, "%sp%lud", prefix5, (long unsigned int) pag);
+       sprintf(fname, "%sp%lu", prefix, afs_printable_uint32_lu(pag));
+       sprintf(fname5, "%sp%lud", prefix5, afs_printable_uint32_lu(pag));
     }
     ktc_set_tkt_string(fname);
 
index b3cd612..ddcc866 100644 (file)
@@ -700,15 +700,15 @@ SendNotifierData(register int fd, register struct bnode_proc *tp)
        buf1 = "(null)";
     (void)sprintf(bufp, "coreName: %s\n", buf1);
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "pid: %ld\n", afs_cast_int32(tp->pid));
+    (void)sprintf(bufp, "pid: %ld\n", afs_printable_int32_ld(tp->pid));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "lastExit: %ld\n", afs_cast_int32(tp->lastExit));
+    (void)sprintf(bufp, "lastExit: %ld\n", afs_printable_int32_ld(tp->lastExit));
     bufp += strlen(bufp);
 #ifdef notdef
-    (void)sprintf(bufp, "lastSignal: %ld\n", afs_cast_int32(tp->lastSignal));
+    (void)sprintf(bufp, "lastSignal: %ld\n", afs_printable_int32_ld(tp->lastSignal));
     bufp += strlen(bufp);
 #endif
-    (void)sprintf(bufp, "flags: %ld\n", afs_cast_int32(tp->flags));
+    (void)sprintf(bufp, "flags: %ld\n", afs_printable_int32_ld(tp->flags));
     bufp += strlen(bufp);
     (void)sprintf(bufp, "END bnode_proc\n");
     bufp += strlen(bufp);
@@ -725,21 +725,21 @@ SendNotifierData(register int fd, register struct bnode_proc *tp)
     bufp += strlen(bufp);
     (void)sprintf(bufp, "name: %s\n", tb->name);
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "rsTime: %ld\n", afs_cast_int32(tb->rsTime));
+    (void)sprintf(bufp, "rsTime: %ld\n", afs_printable_int32_ld(tb->rsTime));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "rsCount: %ld\n", afs_cast_int32(tb->rsCount));
+    (void)sprintf(bufp, "rsCount: %ld\n", afs_printable_int32_ld(tb->rsCount));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "procStartTime: %ld\n", afs_cast_int32(tb->procStartTime));
+    (void)sprintf(bufp, "procStartTime: %ld\n", afs_printable_int32_ld(tb->procStartTime));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "procStarts: %ld\n", afs_cast_int32(tb->procStarts));
+    (void)sprintf(bufp, "procStarts: %ld\n", afs_printable_int32_ld(tb->procStarts));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "lastAnyExit: %ld\n", afs_cast_int32(tb->lastAnyExit));
+    (void)sprintf(bufp, "lastAnyExit: %ld\n", afs_printable_int32_ld(tb->lastAnyExit));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "lastErrorExit: %ld\n", afs_cast_int32(tb->lastErrorExit));
+    (void)sprintf(bufp, "lastErrorExit: %ld\n", afs_printable_int32_ld(tb->lastErrorExit));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "errorCode: %ld\n", afs_cast_int32(tb->errorCode));
+    (void)sprintf(bufp, "errorCode: %ld\n", afs_printable_int32_ld(tb->errorCode));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "errorSignal: %ld\n", afs_cast_int32(tb->errorSignal));
+    (void)sprintf(bufp, "errorSignal: %ld\n", afs_printable_int32_ld(tb->errorSignal));
     bufp += strlen(bufp);
 /*
     (void) sprintf(bufp, "lastErrorName: %s\n", tb->lastErrorName);
index c7aa408..fc4bceb 100644 (file)
@@ -1355,14 +1355,14 @@ DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2,
        if (mrafsParm->OptDontAskFS)
            strcat(tbuffer, " -DontAskFS");
        if (mrafsParm->OptLogLevel) {
-           sprintf(pbuffer, " -LogLevel %ld", afs_cast_int32(mrafsParm->OptLogLevel));
+           sprintf(pbuffer, " -LogLevel %ld", afs_printable_int32_ld(mrafsParm->OptLogLevel));
            strcat(tbuffer, pbuffer);
        }
        if (mrafsParm->OptRxDebug)
            strcat(tbuffer, " -rxdebug");
        if (mrafsParm->OptResidencies) {
            sprintf(pbuffer, " -Residencies %lu", 
-                   afs_cast_uint32(mrafsParm->OptResidencies));
+                   afs_printable_uint32_lu(mrafsParm->OptResidencies));
            strcat(tbuffer, pbuffer);
        }
     }
index 88ba957..fc8ecb8 100644 (file)
@@ -940,7 +940,7 @@ bc_JobsCmd(struct cmd_syndesc *as, void *arock)
            if (statusPtr->dbDumpId)
                printf(": DumpID %u", statusPtr->dbDumpId);
            if (statusPtr->nKBytes)
-               printf(", %ld Kbytes", afs_cast_int32(statusPtr->nKBytes));
+               printf(", %ld Kbytes", afs_printable_int32_ld(statusPtr->nKBytes));
            if (strlen(statusPtr->volumeName) != 0)
                printf(", volume %s", statusPtr->volumeName);
 
index 437c989..c48141c 100644 (file)
@@ -1371,7 +1371,7 @@ Dumper(void *param)
                tmend.tm_hour, tmend.tm_min, tmend.tm_sec, hrs, min, sec,
                nodePtr->volumeSetName, dumpedvolumes,
                dumpedvolumes + failedvolumes,
-               dparams.tapeInfoPtr->kBytes + 1);
+               afs_printable_uint32_lu(dparams.tapeInfoPtr->kBytes + 1));
 
        fwrite(line, strlen(line), 1, centralLogIO);
        fflush(centralLogIO);
index bb18131..c2f12f0 100644 (file)
@@ -799,7 +799,7 @@ GetConfigParams(char *filename, afs_int32 port)
        statusSize *= BufferSize;
        if (statusSize < 0)
            statusSize = 0x7fffffff;    /*max size */
-       printf("Status every %ld Bytes\n", afs_cast_int32(statusSize));
+       printf("Status every %ld Bytes\n", afs_printable_int32_ld(statusSize));
     }
 
   error_exit:
index 2023fa7..5995aae 100644 (file)
@@ -309,12 +309,8 @@ typedef struct afsUUID afsUUID;
 #define hdr_static_inline(x) static inline x
 #endif
 
-#ifdef  AFS_64BIT_ENV
-hdr_static_inline(afs_int32) afs_cast_int32(afs_int32 d) { return (afs_int32) d; }
-hdr_static_inline(afs_uint32) afs_cast_uint32(afs_uint32 d) { return (afs_uint32) d; }
-#else
-hdr_static_inline(long) afs_cast_int32(afs_int32 d) { return (long) d; }
-hdr_static_inline(unsigned long) afs_cast_uint32(afs_uint32 d) { return (unsigned long) d; }
-#endif
+hdr_static_inline(long) afs_printable_int32_ld(afs_int32 d) { return (long) d; }
+
+hdr_static_inline(unsigned long) afs_printable_uint32_lu(afs_uint32 d) { return (unsigned long) d; }
 
 #endif /* OPENAFS_CONFIG_AFS_STDS_H */
index 636d69b..58af958 100644 (file)
@@ -147,7 +147,8 @@ des_quad_cksum(unsigned char *in, afs_uint32 * out, afs_int32 length,
            z = ((x * x) + (x2 * x2)) % 0x7fffffff;
            z2 = (x * (x2 + 83653421)) % 0x7fffffff;    /* modulo */
            if (des_debug & 8)
-               printf("%ld %ld\n", z, z2);
+               printf("%ld %ld\n", afs_printable_int32_ld(z),
+                      afs_printable_int32_ld(z2));
        }
 
        if (out != NULL) {
index 9f27b31..ccf9483 100644 (file)
@@ -411,11 +411,11 @@ parse_flags(char *name, char *inst, char *str, afs_int32 * flags)
     str = lcstring(bitspec, str, sizeof(bitspec));
     if (isdigit(*str)) {
        if (strncmp(str, "0x", 2) == 0) /* 0x => hex */
-           sscanf(str, "0x%lx", &f);
+           sscanf(str, "0x%lx", (long unsigned int *) &f);
        else if (*str == '0')   /* assume octal */
-           sscanf(str, "%lo", &f);
+           sscanf(str, "%lo", (long unsigned int *) &f);
        else                    /* just assume hex */
-           sscanf(str, "%lx", &f);
+           sscanf(str, "%lx", (long unsigned int *) &f);
     } else {
        if (*str == '=') {
            str++;
@@ -1078,7 +1078,7 @@ GetRandomKey(struct cmd_syndesc *as, void *arock)
        ka_PrintBytes((char *)&key, sizeof(key));
        printf(" (");
        for (i = 0; i < sizeof(key); i++) {
-           printf("%0.2x", ((char *)&key)[i] & 0xff);
+           printf("%.2x", ((char *)&key)[i] & 0xff);
            if (i == 3)
                printf(" ");
            else if (i != 7)
@@ -1114,7 +1114,7 @@ Statistics(struct cmd_syndesc *as, void *arock)
           (double)dynamics.hashTableUtilization / 100.0);
     ka_timestr(dynamics.start_time, bob, KA_TIMESTR_LEN);
     printf("From host %lx started at %s:\n", 
-          afs_cast_uint32(dynamics.host), bob);
+          afs_printable_uint32_lu(dynamics.host), bob);
 
 #define print_stat(name) if (dynamics.name.requests) printf ("  of %d requests for %s, %d were aborted.\n", dynamics.name.requests, # name, dynamics.name.aborts)
     print_stat(Authenticate);
@@ -1205,7 +1205,7 @@ DebugInfo(struct cmd_syndesc *as, void *arock)
     }
     ka_timestr(info.startTime, bob, KA_TIMESTR_LEN);
     printf("From host %lx started %sat %s:\n", 
-          afs_cast_uint32(info.host),
+          afs_printable_uint32_lu(info.host),
           (info.noAuth ? "w/o authorization " : ""), bob);
     ka_timestr(info.lastTrans, bob, KA_TIMESTR_LEN);
     printf("Last trans was %s at %s\n", info.lastOperation, bob);
@@ -1220,8 +1220,8 @@ DebugInfo(struct cmd_syndesc *as, void *arock)
           info.updatesRemaining);
     if (info.cheader_lock || info.keycache_lock)
        printf("locks: cheader %08lx, keycache %08lx\n", 
-               afs_cast_uint32(info.cheader_lock),
-               afs_cast_uint32(info.keycache_lock));
+               afs_printable_uint32_lu(info.cheader_lock),
+               afs_printable_uint32_lu(info.keycache_lock));
     printf("Last authentication for %s, last admin user was %s\n",
           info.lastAuth, info.lastAdmin);
     printf("Last TGS op was a %s ticket was for %s\n", info.lastTGSServer,
index 3f32c3a..02aa98b 100644 (file)
@@ -109,7 +109,7 @@ main(int argc, char *argv[])
     }
 
     printf("\n");
-    printf("Client %s (port %d) is in cell %s\n", srvrName, srvrPort,
+    printf("Client %s (port %ld) is in cell %s\n", srvrName, srvrPort,
           cellName);
     printf("\n");
 
index 33cf83c..07a613c 100644 (file)
@@ -106,11 +106,11 @@ main(int argc, char *argv[])
 
     printf("\n");
     if (allconns) {
-       printf("Listing all connections for server %s (port %d)\n", srvrName,
+       printf("Listing all connections for server %s (port %ld)\n", srvrName,
               srvrPort);
     } else {
        printf
-           ("Listing only interesting connections for server %s (port %d)\n",
+           ("Listing only interesting connections for server %s (port %ld)\n",
             srvrName, srvrPort);
     }
 
index a07c6a4..43e11dd 100644 (file)
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
     }
 
     printf("\n");
-    printf("RX stats: host %s (port %d)\n", srvrName, srvrPort);
+    printf("RX stats: host %s (port %ld)\n", srvrName, srvrPort);
     printf("\n");
     printf("    packetRequests:              %d\n", stats.packetRequests);
     printf("    receivePktAllocFailures:     %d\n",
index e14c853..4a2153a 100644 (file)
@@ -36,7 +36,7 @@ pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER;
 #endif /* AFS_DARWIN_ENV */
 
 void
-Usage()
+Usage(void)
 {
     fprintf(stderr, "Usage: rxdebug_supported_stats <host> <port>\n");
     exit(1);
index 5ea0bfb..dd1bb55 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
+#ifndef AFS_NT40_ENV
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#endif
 
 #include <pthread.h>
 
index 57b1204..ea09921 100644 (file)
@@ -138,11 +138,13 @@ GetAddressFromString(const char *addr_str)
     return ntohl(addr);
 }
 
+#if 0
 static void
 PrintMessage(vos_messageType_t type, char *message)
 {
     printf("%s\n", message);
 }
+#endif
 
 int
 DoVosBackupVolumeCreate(struct cmd_syndesc *as, void *arock)
@@ -1539,7 +1541,6 @@ int
 DoVosPartitionNameToId(struct cmd_syndesc *as, void *arock)
 {
     typedef enum { PARTITION } DoVosPartitionNameToId_parm_t;
-    afs_status_t st = 0;
     unsigned int partition_id = 0;
 
     if (as->parms[PARTITION].items) {
@@ -1673,7 +1674,7 @@ Print_vos_volintInfo(afs_uint32 server, afs_uint32 partition, volintInfo* pinfo,
     
     
     printf("%sname\t\t%s\n",prefix, pinfo->name);
-    printf("%sid\t\t%lu\n",prefix, pinfo->volid);
+    printf("%sid\t\t%lu\n",prefix, afs_printable_uint32_lu(pinfo->volid));
     printf("%sserv\t\t%s\t%s\n",prefix, address,hostname);
     printf("%spart\t\t%u\n", prefix,partition);
     
@@ -1688,9 +1689,12 @@ Print_vos_volintInfo(afs_uint32 server, afs_uint32 partition, volintInfo* pinfo,
        printf("%sstatus\t\tUNATTACHABLE\n",prefix);
        return;
     }
-    printf("%sbackupID\t%lu\n",prefix, pinfo->backupID);
-    printf("%sparentID\t%lu\n",prefix, pinfo->parentID);
-    printf("%scloneID\t%lu\n",prefix, pinfo->cloneID);
+    printf("%sbackupID\t%lu\n",prefix,
+          afs_printable_uint32_lu(pinfo->backupID));
+    printf("%sparentID\t%lu\n",prefix,
+          afs_printable_uint32_lu(pinfo->parentID));
+    printf("%scloneID\t%lu\n",prefix,
+          afs_printable_uint32_lu(pinfo->cloneID));
     printf("%sinUse\t\t%s\n",prefix, pinfo->inUse ? "Y" : "N");
     printf("%sneedsSalvaged\t%s\n",prefix, pinfo->needsSalvaged ? "Y" : "N");
     /* 0xD3 is from afs/volume.h since I had trouble including the file */
@@ -1709,21 +1713,30 @@ Print_vos_volintInfo(afs_uint32 server, afs_uint32 partition, volintInfo* pinfo,
        printf("%stype\t\t?\n",prefix);
        break;
     }
-    printf("%screationDate\t%-9lu\n", prefix,pinfo->creationDate);
-    printf("%saccessDate\t%-9lu\n", prefix,pinfo->accessDate);
-    printf("%supdateDate\t%-9lu\n", prefix,pinfo->updateDate);
-    printf("%sbackupDate\t%-9lu\n", prefix,pinfo->backupDate);
-    printf("%scopyDate\t%-9lu\n", prefix,pinfo->copyDate);
+    printf("%screationDate\t%-9lu\n", prefix,
+          afs_printable_uint32_lu(pinfo->creationDate));
+    printf("%saccessDate\t%-9lu\n", prefix,
+          afs_printable_uint32_lu(pinfo->accessDate));
+    printf("%supdateDate\t%-9lu\n", prefix,
+          afs_printable_uint32_lu(pinfo->updateDate));
+    printf("%sbackupDate\t%-9lu\n", prefix,
+          afs_printable_uint32_lu(pinfo->backupDate));
+    printf("%scopyDate\t%-9lu\n", prefix,
+          afs_printable_uint32_lu(pinfo->copyDate));
            
     printf("%sflags\t\t%#lx\t(Optional)\n",prefix, pinfo->flags);
     printf("%sdiskused\t%u\n",prefix, pinfo->size);
     printf("%smaxquota\t%u\n",prefix, pinfo->maxquota);
-    printf("%sminquota\t%lu\t(Optional)\n",prefix, pinfo->spare0);
+    printf("%sminquota\t%lu\t(Optional)\n",prefix,
+          afs_printable_uint32_lu(pinfo->spare0));
     printf("%sfilecount\t%u\n",prefix, pinfo->filecount);
     printf("%sdayUse\t\t%u\n",prefix, pinfo->dayUse);
-    printf("%sweekUse\t%lu\t(Optional)\n",prefix, pinfo->spare1);
-    printf("%svolUpdateCounter\t\t%lu\t(Optional)\n",prefix, pinfo->spare2);
-    printf("%sspare3\t\t%lu\t(Optional)\n",prefix, pinfo->spare3);
+    printf("%sweekUse\t%lu\t(Optional)\n",prefix,
+          afs_printable_uint32_lu(pinfo->spare1));
+    printf("%svolUpdateCounter\t\t%lu\t(Optional)\n",prefix,
+           afs_printable_uint32_lu(pinfo->spare2));
+    printf("%sspare3\t\t%lu\t(Optional)\n",prefix,
+          afs_printable_uint32_lu(pinfo->spare3));
 }
 
 int
index 9d66070..4cf847a 100644 (file)
@@ -225,8 +225,11 @@ _rxevent_Post(struct clock *when, struct clock *now,
     if (rx_Log_event) {
        struct clock now1;
        clock_GetTime(&now1);
-       fprintf(rx_Log_event, "%d.%d: rxevent_Post(%d.%d, %lp, %lp, %lp, %d)\n",
-               (int)now1.sec, (int)now1.usec, (int)when->sec, (int)when->usec,
+       fprintf(rx_Log_event, "%ld.%ld: rxevent_Post(%ld.%ld, %lp, %lp, %lp, %d)\n",
+               afs_printable_int32_ld(now1.sec),
+               afs_printable_int32_ld(now1.usec),
+               afs_printable_int32_ld(when->sec),
+               afs_printable_int32_ld(when->usec),
                func, arg,
                arg1, arg2);
     }
index d73e6bd..c8c1f0b 100644 (file)
@@ -115,32 +115,36 @@ main(int argc, char **argv)
                temp = 0;
                code = ubik_SAMPLE_Get(cstruct, 0, &temp);
                if (code != 0) {
-                   printf("SAMPLE_Get #1 failed with code %ld\n", code);
+                   printf("SAMPLE_Get #1 failed with code %ld\n",
+                          afs_printable_int32_ld(code));
                } else {
-                   printf("SAMPLE_Get #1 succeeded, got value %d\n", temp);
+                   printf("SAMPLE_Get #1 succeeded, got value %ld\n",
+                          afs_printable_int32_ld(temp));
                }
 
                temp = 0;
                code = ubik_SAMPLE_Inc(cstruct, 0);
                if (code != 0) {
                    printf("SAMPLE_Inc #1 failed with code %ld\n", 
-                          afs_cast_int32(code));
+                          afs_printable_int32_ld(code));
                } else {
                    printf("SAMPLE_Inc #1 succeeded, incremented integer\n");
                }
                temp = 0;
                code = ubik_SAMPLE_Get(cstruct, 0, &temp);
                if (code != 0) {
-                   printf("SAMPLE_Get #2 failed with code %ld\n", code);
+                   printf("SAMPLE_Get #2 failed with code %ld\n",
+                          afs_printable_int32_ld(code));
                } else {
-                   printf("SAMPLE_Get #2 succeeded, got value %d\n", temp);
+                   printf("SAMPLE_Get #2 succeeded, got value %ld\n",
+                          afs_printable_int32_ld(temp));
                }
 
                temp = 0;
                code = ubik_SAMPLE_Inc(cstruct, 0);
                if (code != 0)
                    printf("SAMPLE_Inc #2 failed with code %ld\n", 
-                          afs_cast_int32(code));
+                          afs_printable_int32_ld(code));
                else
                    printf("SAMPLE_Inc #2 succeeded, incremented integer\n");
 
index 837499d..f93b905 100644 (file)
@@ -1085,7 +1085,7 @@ uss_vol_GetVolInfoFromMountPoint(char *a_mountpoint)
        return (-1);
     }
     if (vldbEntry.nServers != 1) {
-       printf("s: Volume '%s' (ID %d) exists on multiple servers!!\n",
+       printf("%s: Volume '%s' (ID %d) exists on multiple servers!!\n",
               uss_whoami, uss_Volume, volID);
        return (-1);
     }
index b9deffd..f4ec5e1 100644 (file)
@@ -2701,7 +2701,7 @@ h_DumpHost(register struct host *host, int held, void *rock)
        sprintf(tmpStr, "%04x", host->holds[i]);
        (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
     }
-    sprintf(tmpStr, " slot/bit: %d/%d\n", h_holdSlot(), h_holdbit());
+    sprintf(tmpStr, " slot/bit: %ld/%d\n", h_holdSlot(), h_holdbit());
     (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
 
     H_UNLOCK;
index 3a5595b..45bb1f3 100644 (file)
@@ -1293,7 +1293,7 @@ ParseArgs(int argc, char *argv[])
            rxMaxMTU = atoi(argv[++i]);
            if ((rxMaxMTU < RX_MIN_PACKET_SIZE) || 
                (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
-               printf("rxMaxMTU %d%% invalid; must be between %d-%d\n",
+               printf("rxMaxMTU %d%% invalid; must be between %d-%lu\n",
                       rxMaxMTU, RX_MIN_PACKET_SIZE, 
                       RX_MAX_PACKET_DATA_SIZE);
                return -1;
index 19f80f7..1151759 100644 (file)
@@ -195,7 +195,7 @@ main(int argc, char **argv)
            rxMaxMTU = atoi(argv[++index]);
            if ((rxMaxMTU < RX_MIN_PACKET_SIZE) || 
                (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
-               printf("rxMaxMTU %lu invalid; must be between %d-%d\n",
+               printf("rxMaxMTU %d invalid; must be between %d-%lu\n",
                       rxMaxMTU, RX_MIN_PACKET_SIZE, 
                       RX_MAX_PACKET_DATA_SIZE);
                return -1;
index 2c0c5e7..f8436e8 100644 (file)
@@ -896,7 +896,7 @@ VolOpQuery(struct cmd_syndesc * as, void * rock)
        printf("\t\treason         = %d (%s)\n", 
               vop.com.reason, reason_code_to_string(vop.com.reason));
        printf("\t\tcommand_len    = %u\n", vop.com.command_len);
-       printf("\t\tflags          = 0x%lux\n", afs_cast_uint32(vop.com.flags));
+       printf("\t\tflags          = 0x%lux\n", afs_printable_uint32_lu(vop.com.flags));
        printf("\t}\n");
 
        printf("\tvop = {\n");
index 6fd304e..ef60420 100644 (file)
@@ -575,7 +575,7 @@ FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res)
     }
 #else /* !AFS_DEMAND_ATTACH_FS */
     tvolName[0] = '/';
-    snprintf(&tvolName[1], sizeof(tvolName)-1, VFORMAT, afs_cast_uint32(vcom->vop->volume));
+    snprintf(&tvolName[1], sizeof(tvolName)-1, VFORMAT, afs_printable_uint32_lu(vcom->vop->volume));
     tvolName[sizeof(tvolName)-1] = '\0';
 
     vp = VAttachVolumeByName_r(&error, vcom->vop->partName, tvolName,
@@ -1484,7 +1484,7 @@ FSYNC_Drop(osi_socket fd)
            Volume *vp;
 
            tvolName[0] = '/';
-           sprintf(&tvolName[1], VFORMAT, afs_cast_uint32(p[i].volumeID));
+           sprintf(&tvolName[1], VFORMAT, afs_printable_uint32_lu(p[i].volumeID));
            vp = VAttachVolumeByName_r(&error, p[i].partName, tvolName,
                                       V_VOLUPD);
            if (vp)
index b5d0379..9cbaaa2 100644 (file)
@@ -1454,7 +1454,7 @@ inode_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId)
 
     memset(&specinos, 0, sizeof(specinos));
           
-    (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_cast_uint32(volumeId));
+    (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_printable_uint32_lu(volumeId));
     (void)afs_snprintf(oldpath, sizeof oldpath, "%s/%s", pname, headername);
     fd = open(oldpath, O_RDONLY);
     if (fd < 0) {
@@ -1557,7 +1557,7 @@ inode_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId)
     }
 #endif
 
-    (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_cast_uint32(h.id));
+    (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_printable_uint32_lu(h.id));
     (void)afs_snprintf(newpath, sizeof newpath, "%s/%s", pname, headername);
     fd = open(newpath, O_CREAT | O_EXCL | O_RDWR, 0644);
     if (fd < 0) {
index 9aeb53d..8548ffe 100644 (file)
@@ -1640,7 +1640,7 @@ namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId)
     char headername[16];
     afs_int32 error = 0;
 
-    (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_cast_uint32(volumeId));
+    (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_printable_uint32_lu(volumeId));
     (void)afs_snprintf(oldpath, sizeof oldpath, "%s/%s", pname, headername);
     fd = open(oldpath, O_RDONLY);
     if (fd < 0) {
@@ -1790,7 +1790,7 @@ namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId)
     h.smallVnodeIndex_hi = h.id;
     h.largeVnodeIndex_hi = h.id;
     h.linkTable_hi = h.id;
-    (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_cast_uint32(h.id));
+    (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_printable_uint32_lu(h.id));
     (void)afs_snprintf(newpath, sizeof newpath, "%s/%s", pname, headername);
     fd = open(newpath, O_CREAT | O_EXCL | O_RDWR, 0644);
     if (fd < 0) {
index 7227000..a416f0b 100644 (file)
@@ -321,7 +321,7 @@ handleit(struct cmd_syndesc *as, void *arock)
            }
        }
        (void)afs_snprintf(name1, sizeof name1, VFORMAT,
-                          afs_cast_uint32(volumeId));
+                          afs_printable_uint32_lu(volumeId));
        if (dsizeOnly && !saveinodes)
            printf
                ("Volume-Id\t  Volsize  Auxsize Inodesize  AVolsize SizeDiff                (VolName)\n");
index cdc56db..e98b440 100644 (file)
@@ -1291,7 +1291,7 @@ GetVolumeSummary(VolumeId singleVolumeNumber)
                    || (vsp->header.id == singleVolumeNumber
                        || vsp->header.parent == singleVolumeNumber)) {
                    (void)afs_snprintf(nameShouldBe, sizeof nameShouldBe,
-                                      VFORMAT, afs_cast_uint32(vsp->header.id));
+                                      VFORMAT, afs_printable_uint32_lu(vsp->header.id));
                    if (singleVolumeNumber 
                        && vsp->header.id != singleVolumeNumber)
                        AskOffline(vsp->header.id, fileSysPartition->name);
@@ -1742,7 +1742,7 @@ SalvageVolumeHeaderFile(register struct InodeSummary *isp,
     if (isp->volSummary == NULL) {
        char path[64];
        char headerName[64];
-       (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_cast_uint32(isp->volumeId));
+       (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_printable_uint32_lu(isp->volumeId));
        (void)afs_snprintf(path, sizeof path, "%s/%s", fileSysPath, headerName);
        if (check) {
            Log("No header file for volume %u\n", isp->volumeId);
@@ -1771,7 +1771,7 @@ SalvageVolumeHeaderFile(register struct InodeSummary *isp,
            if (isp->volSummary->fileName) {
                strcpy(headerName, isp->volSummary->fileName);
            } else {
-               (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_cast_uint32(isp->volumeId));
+               (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_printable_uint32_lu(isp->volumeId));
                isp->volSummary->fileName = ToString(headerName);
            }
            (void)afs_snprintf(path, sizeof path, "%s/%s", fileSysPath, headerName);
index 523e1d8..ef3aeef 100644 (file)
@@ -4879,7 +4879,7 @@ VGetVolumePath(Error * ec, VolId volumeId, char **partitionp, char **namep)
 
     *ec = 0;
     name[0] = '/';
-    (void)afs_snprintf(&name[1], (sizeof name) - 1, VFORMAT, afs_cast_uint32(volumeId));
+    (void)afs_snprintf(&name[1], (sizeof name) - 1, VFORMAT, afs_printable_uint32_lu(volumeId));
     for (dp = DiskPartitionList; dp; dp = dp->next) {
        struct afs_stat status;
        strcpy(path, VPartitionPath(dp));
@@ -4942,7 +4942,7 @@ char *
 VolumeExternalName(VolumeId volumeId)
 {
     static char name[VMAXPATHLEN];
-    (void)afs_snprintf(name, sizeof name, VFORMAT, afs_cast_uint32(volumeId));
+    (void)afs_snprintf(name, sizeof name, VFORMAT, afs_printable_uint32_lu(volumeId));
     return name;
 }
 
@@ -4966,7 +4966,7 @@ VolumeExternalName(VolumeId volumeId)
 static int
 VolumeExternalName_r(VolumeId volumeId, char * name, size_t len)
 {
-    return afs_snprintf(name, len, VFORMAT, afs_cast_uint32(volumeId));
+    return afs_snprintf(name, len, VFORMAT, afs_printable_uint32_lu(volumeId));
 }
 #endif
 
index 259aabf..f508e39 100644 (file)
@@ -165,7 +165,7 @@ VCreateVolume_r(Error * ec, char *partname, VolId volumeId, VolId parentId)
     vol.stamp.magic = VOLUMEINFOMAGIC;
     vol.stamp.version = VOLUMEINFOVERSION;
     vol.destroyMe = DESTROY_ME;
-    (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_cast_uint32(vol.id));
+    (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_printable_uint32_lu(vol.id));
     (void)afs_snprintf(volumePath, sizeof volumePath, "%s/%s",
                       VPartitionPath(partition), headerName);
     fd = afs_open(volumePath, O_CREAT | O_EXCL | O_WRONLY, 0600);
index 4c15cc8..1be394e 100644 (file)
@@ -879,7 +879,7 @@ XDisplayFormat2(volintXInfo *a_xInfoP, afs_int32 a_servID, afs_int32 a_partID,
                }
 
                fprintf(STDOUT, "name\t\t%s\n", a_xInfoP->name);
-               fprintf(STDOUT, "id\t\t%lu\n", afs_cast_uint32(a_xInfoP->volid));
+               fprintf(STDOUT, "id\t\t%lu\n", afs_printable_uint32_lu(a_xInfoP->volid));
                fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname);
                fprintf(STDOUT, "part\t\t%s\n", pname);
                switch (a_xInfoP->status) {
@@ -894,11 +894,11 @@ XDisplayFormat2(volintXInfo *a_xInfoP, afs_int32 a_servID, afs_int32 a_partID,
                        return;
                }
                fprintf(STDOUT, "backupID\t%lu\n", 
-                       afs_cast_uint32(a_xInfoP->backupID));
+                       afs_printable_uint32_lu(a_xInfoP->backupID));
                fprintf(STDOUT, "parentID\t%lu\n", 
-                       afs_cast_uint32(a_xInfoP->parentID));
+                       afs_printable_uint32_lu(a_xInfoP->parentID));
                fprintf(STDOUT, "cloneID\t\t%lu\n", 
-                       afs_cast_uint32(a_xInfoP->cloneID));
+                       afs_printable_uint32_lu(a_xInfoP->cloneID));
                fprintf(STDOUT, "inUse\t\t%s\n", a_xInfoP->inUse ? "Y" : "N");
                switch (a_xInfoP->type) {
                case 0:
@@ -915,19 +915,19 @@ XDisplayFormat2(volintXInfo *a_xInfoP, afs_int32 a_servID, afs_int32 a_partID,
                        break;
                }
                fprintf(STDOUT, "creationDate\t%-9lu\t%s", 
-                       afs_cast_uint32(a_xInfoP->creationDate),
+                       afs_printable_uint32_lu(a_xInfoP->creationDate),
                        vos_ctime(&a_xInfoP->creationDate));
                fprintf(STDOUT, "accessDate\t%-9lu\t%s", 
-                       afs_cast_uint32(a_xInfoP->accessDate),
+                       afs_printable_uint32_lu(a_xInfoP->accessDate),
                        vos_ctime(&a_xInfoP->accessDate));
                fprintf(STDOUT, "updateDate\t%-9lu\t%s", 
-                       afs_cast_uint32(a_xInfoP->updateDate),
+                       afs_printable_uint32_lu(a_xInfoP->updateDate),
                        vos_ctime(&a_xInfoP->updateDate));
                fprintf(STDOUT, "backupDate\t%-9lu\t%s", 
-                       afs_cast_uint32(a_xInfoP->backupDate),
+                       afs_printable_uint32_lu(a_xInfoP->backupDate),
                        vos_ctime(&a_xInfoP->backupDate));
                fprintf(STDOUT, "copyDate\t%-9lu\t%s", 
-                       afs_cast_uint32(a_xInfoP->copyDate),
+                       afs_printable_uint32_lu(a_xInfoP->copyDate),
                        vos_ctime(&a_xInfoP->copyDate));
                
                fprintf(STDOUT, "diskused\t%u\n", a_xInfoP->size);
@@ -1033,7 +1033,7 @@ DisplayFormat2(long server, long partition, volintInfo *pntr)
     }
     fprintf(STDOUT, "name\t\t%s\n", pntr->name);
     fprintf(STDOUT, "id\t\t%lu\n", 
-           afs_cast_uint32(pntr->volid));
+           afs_printable_uint32_lu(pntr->volid));
     fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname);
     fprintf(STDOUT, "part\t\t%s\n", pname);
     switch (pntr->status) {
@@ -1048,11 +1048,11 @@ DisplayFormat2(long server, long partition, volintInfo *pntr)
        return;
     }
     fprintf(STDOUT, "backupID\t%lu\n", 
-           afs_cast_uint32(pntr->backupID));
+           afs_printable_uint32_lu(pntr->backupID));
     fprintf(STDOUT, "parentID\t%lu\n", 
-           afs_cast_uint32(pntr->parentID));
+           afs_printable_uint32_lu(pntr->parentID));
     fprintf(STDOUT, "cloneID\t\t%lu\n", 
-           afs_cast_uint32(pntr->cloneID));
+           afs_printable_uint32_lu(pntr->cloneID));
     fprintf(STDOUT, "inUse\t\t%s\n", pntr->inUse ? "Y" : "N");
     fprintf(STDOUT, "needsSalvaged\t%s\n", pntr->needsSalvaged ? "Y" : "N");
     /* 0xD3 is from afs/volume.h since I had trouble including the file */
@@ -1072,34 +1072,34 @@ DisplayFormat2(long server, long partition, volintInfo *pntr)
        break;
     }
     fprintf(STDOUT, "creationDate\t%-9lu\t%s", 
-           afs_cast_uint32(pntr->creationDate),
+           afs_printable_uint32_lu(pntr->creationDate),
            vos_ctime(&pntr->creationDate));
     fprintf(STDOUT, "accessDate\t%-9lu\t%s", 
-           afs_cast_uint32(pntr->accessDate),
+           afs_printable_uint32_lu(pntr->accessDate),
            vos_ctime(&pntr->accessDate));
     fprintf(STDOUT, "updateDate\t%-9lu\t%s", 
-           afs_cast_uint32(pntr->updateDate),
+           afs_printable_uint32_lu(pntr->updateDate),
            vos_ctime(&pntr->updateDate));
     fprintf(STDOUT, "backupDate\t%-9lu\t%s", 
-           afs_cast_uint32(pntr->backupDate),
+           afs_printable_uint32_lu(pntr->backupDate),
            vos_ctime(&pntr->backupDate));
     fprintf(STDOUT, "copyDate\t%-9lu\t%s", 
-           afs_cast_uint32(pntr->copyDate),
+           afs_printable_uint32_lu(pntr->copyDate),
            vos_ctime(&pntr->copyDate));
     fprintf(STDOUT, "flags\t\t%#lx\t(Optional)\n", 
-           afs_cast_uint32(pntr->flags));
+           afs_printable_uint32_lu(pntr->flags));
     fprintf(STDOUT, "diskused\t%u\n", pntr->size);
     fprintf(STDOUT, "maxquota\t%u\n", pntr->maxquota);
     fprintf(STDOUT, "minquota\t%lu\t(Optional)\n", 
-           afs_cast_uint32(pntr->spare0));
+           afs_printable_uint32_lu(pntr->spare0));
     fprintf(STDOUT, "filecount\t%u\n", pntr->filecount);
     fprintf(STDOUT, "dayUse\t\t%u\n", pntr->dayUse);
     fprintf(STDOUT, "weekUse\t\t%lu\t(Optional)\n",
-           afs_cast_uint32(pntr->spare1));
+           afs_printable_uint32_lu(pntr->spare1));
     fprintf(STDOUT, "spare2\t\t%lu\t(Optional)\n", 
-           afs_cast_uint32(pntr->spare2));
+           afs_printable_uint32_lu(pntr->spare2));
     fprintf(STDOUT, "spare3\t\t%lu\t(Optional)\n", 
-           afs_cast_uint32(pntr->spare3));
+           afs_printable_uint32_lu(pntr->spare3));
     return;
 }