Don't cast the return from realloc()
[openafs.git] / src / venus / kdump.c
index c44ad92..185e399 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID
-    ("$Header$");
+#include <roken.h>
 
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>            /* for malloc() */
+#include <afs/cmd.h>
 
+#if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
 /* Here be hacks. */
 #ifdef AFS_LINUX24_ENV
 #define __KERNEL__
@@ -108,10 +106,6 @@ struct ncp_sb_info {
 #define _KERNEL 1
 #endif
 
-#ifndef        AFS_OSF_ENV
-#include <sys/param.h>
-#endif
-
 #ifndef AFS_LINUX20_ENV
 #include <nlist.h>
 #endif
@@ -121,7 +115,6 @@ struct ncp_sb_info {
 #endif
 
 #include <afs/stds.h>
-#include <sys/types.h>
 
 #if defined(AFS_OSF_ENV)
 #define        KERNEL
@@ -130,7 +123,6 @@ struct ncp_sb_info {
 #ifdef _KERN_LOCK_H_
 #include FFFFF
 #endif
-#include <sys/time.h>
 #include <kern/lock.h>
 #include <sys/vnode.h>
 #include <arch/alpha/pmap.h>
@@ -147,7 +139,7 @@ struct ncp_sb_info {
  * kseg_to_phys()
  * is_kseg_va()
  * is_seg1_va()
- * 
+ *
  * when _KERNEL is defined, and expressions otherwise.  Since need
  * to define _KERNEL, we redefine these kernel functions as macros
  * for the expressions that we would have gotten if _KERNEL had not
@@ -166,16 +158,6 @@ struct ncp_sb_info {
 #ifdef AFS_SUN5_ENV /*XXXXX*/
 #include <sys/t_lock.h>
 struct vnode foo;
-#ifdef AFS_SUN54_ENV
-#else
-#ifdef AFS_SUN52_ENV
-typedef struct stat_mutex stat_mutex_t;
-#define        kmutex_t                stat_mutex_t
-#else
-typedef struct adaptive_mutex2 adaptive_mutex2_t;
-#define        kmutex_t        adaptive_mutex2_t
-#endif
-#endif
 #endif
 
 #ifdef AFS_SGI53_ENV
@@ -186,8 +168,6 @@ typedef struct adaptive_mutex2 adaptive_mutex2_t;
 #endif
 #endif
 
-#include <sys/file.h>
-
 #ifdef AFS_SGI62_ENV
 #include <sys/fcntl.h>
 #ifndef L_SET
@@ -201,8 +181,8 @@ typedef struct adaptive_mutex2 adaptive_mutex2_t;
 #include <sys/user.h>
 #endif
 
-#ifndef AFS_LINUX20_ENV
-#include <sys/socket.h>
+#ifndef AFS_LINUX26_ENV
+#include <sys/file.h>
 #endif
 
 /*
@@ -223,8 +203,6 @@ typedef struct adaptive_mutex2 adaptive_mutex2_t;
 # include <netinet/in.h>       /* struct in_addr */
 #endif
 
-#include <arpa/inet.h>         /* inet_ntoa() */
-
 #if defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV)
 #ifdef       AFS_SGI_ENV
 #include <sys/vnode.h>
@@ -253,7 +231,9 @@ typedef struct adaptive_mutex2 adaptive_mutex2_t;
 #undef LONG_MAX
 #undef ULONG_MAX
 #define _LINUX_TIME_H
+#ifndef AFS_LINUX26_ENV
 #define _LINUX_FCNTL_H
+#endif
 #ifdef AFS_IA64_LINUX24_ENV
 #define flock64  flock
 #endif /* AFS_IA64_LINUX24_ENV */
@@ -284,7 +264,7 @@ typedef struct timeval {
     int tv_usec;
 } timeval_t;                   /* Needed here since KERNEL defined. */
 #endif /*AFS_ALPHA_LINUX20_ENV */
-#if defined(AFSBIG_ENDIAN)
+#if defined(WORDS_BIGENDIAN)
 #define _LINUX_BYTEORDER_BIG_ENDIAN_H
 #else
 #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
@@ -347,7 +327,6 @@ typedef enum _spustate {    /* FROM /etc/conf/h/_types.h */
 #endif
 #endif
 #endif
-#include <signal.h>
 #endif
 
 /* AFS includes */
@@ -552,9 +531,6 @@ void print_cmstats();
 
 
 
-#ifndef AFS_KDUMP_LIB
-extern struct cmd_syndesc *cmd_CreateSyntax();
-#endif
 int opencore();
 
 #if    defined(AFS_HPUX_ENV) && defined(__LP64__)
@@ -604,9 +580,6 @@ int Dgcpags = 0;
 #include <sys/elf.h>
 #include <libelf.h>
 #include <sys/elf_M32.h>
-#ifndef        AFS_SUN54_ENV
-typedef ulong_t k_fltset_t;    /* XXXXXXXXXXX */
-#endif /* !AFS_SUN54_ENV */
 #include <sys/proc.h>
 #include <sys/file.h>
 #define        _NLIST_H                /* XXXXXXXXXXXXX */
@@ -640,9 +613,6 @@ PrintIPAddr(int addr)
 
 #ifdef AFS_LINUX20_ENV
 /* Find symbols in a live kernel. */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 #ifdef AFS_LINUX26_ENV
 #define KSYMS "/proc/kallsyms"
@@ -707,8 +677,7 @@ read_ksyms(void)
     while (fgets(line, MAXLINE, fp)) {
        if (nksyms >= availksyms) {
            availksyms += KSYM_ALLOC_STEP;
-           ksyms =
-               (symlist_t *) realloc(ksyms, availksyms * sizeof(symlist_t));
+           ksyms = realloc(ksyms, availksyms * sizeof(symlist_t));
            if (!ksyms) {
                printf("Failed to realloc %d symbols.\n", availksyms);
                exit(1);
@@ -822,15 +791,15 @@ symsrch(s)
 
 #endif /*defined(AFS_SUN5_ENV) */
 
+#endif /*!defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV) */
 
 #ifndef AFS_KDUMP_LIB
-static
-cmdproc(as, arock)
-     register struct cmd_syndesc *as;
-     afs_int32 arock;
+static int
+cmdproc(struct cmd_syndesc *as, void *arock)
 {
-    register afs_int32 code = 0;
+    afs_int32 code = 0;
 
+#if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
     if (as->parms[0].items) {  /* -kobj */
        obj = as->parms[0].items->data;
     }
@@ -930,6 +899,7 @@ cmdproc(as, arock)
     if (as->parms[31].items) { /* -dhash */
        DdvnextTbl = 1, DdcnextTbl = 1, Dall = 0;
     }
+#endif
 
     code = kdump();
     return code;
@@ -937,12 +907,11 @@ cmdproc(as, arock)
 
 #include "AFS_component_version_number.c"
 
-main(argc, argv)
-     int argc;
-     char **argv;
+int
+main(int argc, char **argv)
 {
-    register struct cmd_syndesc *ts;
-    register afs_int32 code;
+    struct cmd_syndesc *ts;
+    afs_int32 code;
 
 #ifdef AFS_AIX32_ENV
     struct sigaction nsa;
@@ -953,7 +922,7 @@ main(argc, argv)
     sigaction(SIGSEGV, &nsa, NULL);
 #endif
 
-    ts = cmd_CreateSyntax(NULL, cmdproc, 0,
+    ts = cmd_CreateSyntax(NULL, cmdproc, NULL,
                          "Read internal cache manager structs");
     cmd_AddParm(ts, "-kobj", CMD_SINGLE, CMD_OPTIONAL,
                "kernel object (default /vmunix)");
@@ -1016,11 +985,10 @@ main(argc, argv)
 
 #ifdef AFS_AIX_ENV
 #ifndef AFS_KDUMP_LIB
-Knlist(sp, cnt, size)
-     struct afs_nlist *sp;
-     int cnt, size;
+int
+Knlist(struct afs_nlist *sp, int cnt, int size)
 {
-    register int code;
+    int code;
 
     if (UserLevel)
        code = nlist(obj, sp);
@@ -1098,12 +1066,13 @@ findsym(char *sname, off_t * offset)
 
 #define CBHTSIZE 128
 
-kdump()
+int
+kdump(void)
 {
-    int cell, cnt, cnt1;
 #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
     printf("Kdump not supported\n");
 #else
+    int cell, cnt, cnt1;
 #ifndef AFS_KDUMP_LIB
 
     kmem = opencore(core);
@@ -1248,8 +1217,7 @@ int Sum_vcachemvids = 0, Sum_vcachelinkData = 0, Sum_vcacheacc =
 int Sum_cellaliases = 0, Sum_cellname_names = 0;
 
 int
-print_cells(pnt)
-     int pnt;
+print_cells(int pnt)
 {
     off_t symoff;
     struct cell *cells, cle, *clentry = &cle, *clep;
@@ -1340,8 +1308,7 @@ print_cellnames(int pnt)
 }
 
 int
-print_users(pnt)
-     int pnt;
+print_users(int pnt)
 {
     off_t symoff;
     struct unixuser *afs_users[NUSERS], ue, *uentry = &ue, *uep;
@@ -1367,8 +1334,7 @@ afs_int32 NserversFound = 0;
 #define SF_ALLOCATION_STEP 500
 
 int
-add_found_server(sep)
-     struct server *sep;
+add_found_server(struct server *sep)
 {
     static afs_int32 NserversAllocated = 0;
     static afs_int32 failed = 0;
@@ -1383,10 +1349,9 @@ add_found_server(sep)
                (struct server **)malloc(NserversAllocated *
                                         sizeof(struct server *));
        } else {
-           serversFound =
-               (struct server **)realloc((char *)serversFound,
-                                         NserversAllocated *
-                                         sizeof(struct server *));
+           serversFound = realloc(serversFound,
+                                  NserversAllocated *
+                                  sizeof(struct server *));
        }
        if (!serversFound) {
            printf("Can't allocate %lu bytes for list of found servers.\n",
@@ -1401,8 +1366,7 @@ add_found_server(sep)
 }
 
 int
-find_server(sep)
-     struct server *sep;
+find_server(struct server *sep)
 {
     int i;
 
@@ -1414,8 +1378,7 @@ find_server(sep)
 }
 
 int
-print_servers(pnt)
-     int pnt;
+print_servers(int pnt)
 {
     off_t symoff;
     struct server *afs_servers[NSERVERS], se, *sentry = &se, *sep;
@@ -1426,7 +1389,7 @@ print_servers(pnt)
     int chainCount[NSERVERS];
 
     if (pnt) {
-       memset((char *)chainCount, 0, sizeof(chainCount));
+       memset(chainCount, 0, sizeof(chainCount));
        printf("\n\nPrinting 'afs_servers' structures...\n");
     }
     findsym("afs_servers", &symoff);
@@ -1464,7 +1427,7 @@ print_servers(pnt)
 
     /* Verify against afs_totalServers. */
     if (pnt) {
-       memset((char *)chainCount, 0, sizeof(chainCount));
+       memset(chainCount, 0, sizeof(chainCount));
        if (findsym("afs_totalServers", &symoff)) {
            kread(kmem, symoff, (char *)&afs_totalServers, sizeof(afs_int32));
            if (afs_totalServers != nServers) {
@@ -1539,8 +1502,7 @@ print_servers(pnt)
 
 
 void
-print_Conns(pnt)
-     int pnt;
+print_Conns(int pnt)
 {
     off_t symoff;
     struct server *afs_servers[NSERVERS], se, *sentry = &se, *sep;
@@ -1562,8 +1524,7 @@ print_Conns(pnt)
 
 
 int
-print_volumes(pnt)
-     int pnt;
+print_volumes(int pnt)
 {
     off_t symoff;
     struct volume *afs_volumes[NVOLS], ve, *ventry = &ve, *vep;
@@ -1585,8 +1546,7 @@ print_volumes(pnt)
 }
 
 void
-print_cbHash(pnt)
-     int pnt;
+print_cbHash(int pnt)
 {
     off_t symoff;
     struct afs_q cbHashT[CBHTSIZE];
@@ -1606,8 +1566,7 @@ print_cbHash(pnt)
 }
 
 int
-print_vcaches(pnt)
-     int pnt;
+print_vcaches(int pnt)
 {
     off_t symoff;
     struct vcache *afs_vhashTable[VCSIZE], Ve, *Ventry = &Ve, *Vep;
@@ -1637,8 +1596,7 @@ print_vcaches(pnt)
 }
 
 int
-print_dcaches(pnt)
-     int pnt;
+print_dcaches(int pnt)
 {
     off_t symoff;
     long table, *ptr;
@@ -1677,8 +1635,7 @@ print_dcaches(pnt)
 
 
 void
-print_DindexTimes(pnt)
-     int pnt;
+print_DindexTimes(int pnt)
 {
     off_t symoff;
     long table;
@@ -1714,8 +1671,7 @@ print_DindexTimes(pnt)
 
 
 void
-print_DdvnextTbl(pnt)
-     int pnt;
+print_DdvnextTbl(int pnt)
 {
     off_t symoff;
     long table;
@@ -1744,8 +1700,7 @@ print_DdvnextTbl(pnt)
 
 
 void
-print_DdcnextTbl(pnt)
-     int pnt;
+print_DdcnextTbl(int pnt)
 {
     off_t symoff;
     long table;
@@ -1774,8 +1729,7 @@ print_DdcnextTbl(pnt)
 
 
 void
-print_DindexFlags(pnt)
-     int pnt;
+print_DindexFlags(int pnt)
 {
     off_t symoff;
     afs_int32 count;
@@ -1805,8 +1759,7 @@ print_DindexFlags(pnt)
 
 
 void
-print_buffers(pnt)
-     int pnt;
+print_buffers(int pnt)
 {
     off_t symoff;
     long table;
@@ -1835,7 +1788,7 @@ print_buffers(pnt)
        if (pnt)
            printf
                ("Buffer #%d:\tfid=%lu page=%d, accTime=%d,\n\tHash=%x, data=%x, lockers=%x, dirty=%d, hashI=%d\n",
-                i, bp->fid[0], bp->page, bp->accesstime, bp->hashNext,
+                i, bp->fid, bp->page, bp->accesstime, bp->hashNext,
                 bp->data, bp->lockers, bp->dirty, bp->hashIndex);
 #endif
        j++;
@@ -1846,8 +1799,7 @@ print_buffers(pnt)
 
 
 int
-print_nfss(pnt)
-     int pnt;
+print_nfss(int pnt)
 {
     off_t symoff;
     struct afs_exporter *exp_entry, ex, *exp = &ex, *exp1;
@@ -1953,8 +1905,7 @@ print_alloced_memlist(void)
 #endif
 
 void
-print_allocs(pnt)
-     int pnt;
+print_allocs(int pnt)
 {
     off_t symoff;
     long count, i, j, k, l, m, n, T = 0, tvs;
@@ -2006,10 +1957,10 @@ print_allocs(pnt)
     T += j;
     printf("%20s:\t%8d bytes\t[%d servers/%d bytes each]\n", "Server package",
           j, i, sizeof(struct server));
-    j = (Nconns * sizeof(struct conn));
+    j = (Nconns * sizeof(struct afs_conn));
     T += j;
     printf("%20s:\t%8d bytes\t[%d conns/%d bytes each]\n",
-          "Connection package", j, Nconns, sizeof(struct conn));
+          "Connection package", j, Nconns, sizeof(struct afs_conn));
 
     i = (AFS_NCBRS * sizeof(struct afs_cbr)) * (j =
                                                afs_cmperfstats.
@@ -2118,13 +2069,11 @@ print_allocs(pnt)
     T += i;
     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n", "Buffer package",
           i, j, sizeof(struct buffer));
-#if    !AFS_USEBUFFERS
 #define        AFS_BUFFER_PAGESIZE 2048
     i = j * AFS_BUFFER_PAGESIZE;
     T += i;
     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
           "Xtra Buffer pkg area", i, j, AFS_BUFFER_PAGESIZE);
-#endif
 
     Sum_exps = 0;
     Sum_nfssysnames = 0;
@@ -2234,11 +2183,11 @@ print_allocs(pnt)
 int
 readmem(kmem, buf, vad, len)
      int kmem, len;
-#ifdef AFS_SUN57_ENV
+#ifdef AFS_SUN5_ENV
      uintptr_t vad;
 #else
      int vad;
-#endif         /** AFS_SUN57_ENV **/
+#endif         /** AFS_SUN5_ENV **/
      char *buf;
 {
     int newlen;
@@ -2364,8 +2313,8 @@ kread(int kmem, off_t loc, void *buf, KDUMP_SIZE_T len)
        perror("lseek");
        exit(1);
     }
-    if (loc == 0) 
-       printf("WARNING: Read failed: loc=0\n"); 
+    if (loc == 0)
+       printf("WARNING: Read failed: loc=0\n");
     else
        if ((i = read(kmem, buf, len)) != len) {
            printf("WARNING: Read failed: ");
@@ -2390,7 +2339,8 @@ kread(int kmem, off_t loc, void *buf, KDUMP_SIZE_T len)
   * the macro RDSYMBOLS
   */
 
-rdsymbols()
+void
+rdsymbols(void)
 {
 
     FILE *fp;
@@ -2453,8 +2403,7 @@ rdsymbols()
 
 
 int
-opencore(core)
-     char *core;
+opencore(char *core)
 {
 #ifdef AFS_KDUMP_LIB
     return 0;
@@ -2490,9 +2439,8 @@ opencore(core)
 
 
 void
-print_exporter(kmem, exporter, ptr, pnt)
-     int kmem, pnt;
-     struct afs_exporter *exporter, *ptr;
+print_exporter(int kmem, struct afs_exporter *exporter,
+              struct afs_exporter *ptr, int pnt)
 {
     if (pnt) {
        printf("\tstates=%x, type=%x, *data=%lx\n", exporter->exp_states,
@@ -2506,43 +2454,37 @@ print_exporter(kmem, exporter, ptr, pnt)
 
 
 void
-print_nfsclient(kmem, ep, ptr, pnt)
-     int kmem, pnt;
-     struct nfsclientpag *ep, *ptr;
+print_nfsclient(int kmem, struct nfsclientpag *ep,
+               struct nfsclientpag *ptr, int pnt)
 {
     char sysname[100];
+       int count;
 
-    if (ep->sysname) {
-       kread(kmem, (off_t) ep->sysname, sysname, (KDUMP_SIZE_T) 30);
-       Sum_nfssysnames += MAXSYSNAME;
-    }
     if (pnt)
-       printf("%lx: uid=%d, host=%x, pag=%x, @sys=%s, lastt=%d, ref=%d\n",
+       printf("%lx: uid=%d, host=%x, pag=%x, lastt=%d, ref=%d count=%d\n",
               ptr, ep->uid, ep->host, ep->pag,
-              (ep->sysname ? sysname : "nil"), ep->lastcall, ep->refCount);
+              ep->lastcall, ep->refCount, ep->sysnamecount);
+
+       for(count = 0; count < ep->sysnamecount; count++){
+               kread(kmem, (off_t) ep->sysname[count], sysname, (KDUMP_SIZE_T) 30);
+               printf("   %lx: @sys[%d]=%s\n",
+                       ep->sysname[count], count, sysname);
+               Sum_nfssysnames += MAXSYSNAME;
+       }
 }
 
 
 #if    defined(AFS_SUN5_ENV)
-pmutex(sp, mp)
-     char *sp;
-     kmutex_t *mp;
+void
+pmutex(char *sp, kmutex_t *mp)
 {
-#ifdef AFS_SUN54_ENV
-
-#else
-    struct stat_mutex *smp = (struct stat_mutex *)mp;
-
-    printf("%s mutex: %x %x\n", sp, smp->m_stats_lock, smp->m_type);
-#endif
 }
 
 #endif
 
 void
-print_unixuser(kmem, uep, ptr, pnt)
-     int kmem, pnt;
-     struct unixuser *uep, *ptr;
+print_unixuser(int kmem, struct unixuser *uep,
+              struct unixuser *ptr, int pnt)
 {
     Sum_userstp += uep->stLen;
     if (pnt) {
@@ -2562,9 +2504,7 @@ print_unixuser(kmem, uep, ptr, pnt)
 }
 
 void
-print_cell(kmem, clep, ptr, pnt)
-     int kmem, pnt;
-     struct cell *clep, *ptr;
+print_cell(int kmem, struct cell *clep, struct cell *ptr, int pnt)
 {
     int i;
     char cellName[100];
@@ -2584,7 +2524,7 @@ print_cell(kmem, clep, ptr, pnt)
            printf("\tlinked cellp %lx\n", clep->lcellp);
 #endif
        printf("\tCell's servers: ");
-       for (i = 0; i < MAXCELLHOSTS; i++) {
+       for (i = 0; i < AFS_MAXCELLHOSTS; i++) {
            if (pretty && (clep->cellHosts[i] == 0))
                break;
            printf("[%lx] ", clep->cellHosts[i]);
@@ -2595,9 +2535,8 @@ print_cell(kmem, clep, ptr, pnt)
 
 
 void
-print_server(kmem, sep, ptr, conns, pnt)
-     int kmem, conns, pnt;
-     struct server *sep, *ptr;
+print_server(int kmem, struct server *sep, struct server *ptr, int conns,
+            int pnt)
 {
     struct srvAddr sa, *sap = &sa, *sap1;
     int j, mh = 0, cnt;
@@ -2663,15 +2602,13 @@ print_server(kmem, sep, ptr, conns, pnt)
 
 
 void
-print_conns(kmem, srv, conns, Con, pnt)
-     int kmem, Con, pnt;
-     struct srvAddr *srv;
-     struct conn *conns;
+print_conns(int kmem, struct srvAddr *srv, struct afs_conn *conns, int Con,
+           int pnt)
 {
-    struct conn *cep, ce, *centry = &ce;
+    struct afs_conn *cep, ce, *centry = &ce;
     int i = 1;
 
-    cep = (struct conn *)conns;
+    cep = (struct afs_conn *)conns;
     if (pnt && Con != 2) {
        if (cep)
            printf("\tRPC connections for server %lx:\n", srv);
@@ -2688,9 +2625,7 @@ print_conns(kmem, srv, conns, Con, pnt)
 
 
 void
-print_conn(kmem, conns, ptr, pnt)
-     int kmem, pnt;
-     struct conn *conns, *ptr;
+print_conn(int kmem, struct afs_conn *conns, struct afs_conn *ptr, int pnt)
 {
     if (!pnt)
        return;
@@ -2702,9 +2637,7 @@ print_conn(kmem, conns, ptr, pnt)
 
 
 void
-print_volume(kmem, vep, ptr, pnt)
-     int kmem, pnt;
-     struct volume *vep, *ptr;
+print_volume(int kmem, struct volume *vep, struct volume *ptr, int pnt)
 {
     int i;
     afs_int32 *loc;
@@ -2734,12 +2667,12 @@ print_volume(kmem, vep, ptr, pnt)
         vep->states);
 #endif
     printf("\tVolume's statuses: ");
-    for (i = 0; i < MAXHOSTS && vep->serverHost[i]; i++)
+    for (i = 0; i < AFS_MAXHOSTS && vep->serverHost[i]; i++)
        printf("[%d] ", vep->status[i]);
     printf("\n");
 
     printf("\tVolume's servers: ");
-    for (i = 0; i < MAXHOSTS && vep->serverHost[i]; i++)
+    for (i = 0; i < AFS_MAXHOSTS && vep->serverHost[i]; i++)
        printf("[%lx] ", vep->serverHost[i]);
     printf("\n");
 
@@ -2759,9 +2692,7 @@ print_volume(kmem, vep, ptr, pnt)
 
 
 void
-print_venusfid(string, vid)
-     char *string;
-     struct VenusFid *vid;
+print_venusfid(char *string, struct VenusFid *vid)
 {
     printf("%s(c=%x, v=%d, n=%d, u=%d)", string, vid->Cell, vid->Fid.Volume,
           vid->Fid.Vnode, vid->Fid.Unique);
@@ -2769,9 +2700,7 @@ print_venusfid(string, vid)
 
 
 void
-print_vnode(kmem, vep, ptr, pnt)
-     int kmem, pnt;
-     struct vnode *vep, *ptr;
+print_vnode(int kmem, struct vnode *vep, struct vnode *ptr, int pnt)
 {
 #ifdef AFS_AIX_ENV
     struct gnode gnode;
@@ -2857,9 +2786,7 @@ print_vnode(kmem, vep, ptr, pnt)
 }
 
 void
-print_vcache(kmem, vep, ptr, pnt)
-     int kmem, pnt;
-     struct vcache *vep, *ptr;
+print_vcache(int kmem, struct vcache *vep, struct vcache *ptr, int pnt)
 {
     long *loc, j = 0;
     char *cloc;
@@ -2881,7 +2808,7 @@ print_vcache(kmem, vep, ptr, pnt)
            printf("\n");
 #ifdef AFS33
        printf("%lx: refC=%d, pv=%d, pu=%d, flushDv=%d.%d, mapDV=%d.%d, ",
-              ptr, vep->vrefCount, vep->parentVnode, vep->parentUnique,
+              ptr, VREFCOUNT(vep), vep->parentVnode, vep->parentUnique,
               vep->flushDV.high, vep->flushDV.low, vep->mapDV.high,
               vep->mapDV.low);
 #ifdef AFS_64BIT_CLIENT
@@ -2899,12 +2826,8 @@ print_vcache(kmem, vep, ptr, pnt)
 #ifdef AFS_SUN5_ENV
        printf("vstates=x%x, ", vep->vstates);
 #endif /* AFS_SUN5_ENV */
-       printf("dchint=%x, anyA=0x%x\n", vep->h1.dchint, vep->anyAccess);
+       printf("dchint=%x, anyA=0x%x\n", vep->dchint, vep->anyAccess);
 #ifdef AFS_64BIT_CLIENT
-       printf("\tquick[dc=%x, stamp=%x, f=%x, min=%d, len=(0x%x, 0x%x)]\n",
-              vep->quick.dc, vep->quick.stamp, vep->quick.f,
-              vep->quick.minLoc, (int)(vep->quick.len >> 32),
-              (int)(vep->quick.len & 0xffffffff));
        printf
            ("\tmstat[len=(0x%x, 0x%x), DV=%d.%d, Date=%d, Owner=%d, Group=%d, Mode=0%o, linkc=%d]\n",
             (int)(vep->m.Length >> 32), (int)(vep->m.Length & 0xffffffff),
@@ -2994,15 +2917,13 @@ print_vcache(kmem, vep, ptr, pnt)
        }
     }
 #ifdef AFS_LINUX22_ENV
-    printf("\tflushcnt=%d, mapcnt=%d\n", vep->flushcnt, vep->mapcnt);
+    printf("\tmapcnt=%d\n", vep->mapcnt);
 #endif
 }
 
 
 void
-print_dcache(kmem, dcp, dp, pnt)
-     int kmem, pnt;
-     struct dcache *dcp, *dp;
+print_dcache(int kmem, struct dcache *dcp, struct dcache *dp, int pnt)
 {
     if (!pnt)
        return;
@@ -3020,22 +2941,19 @@ print_dcache(kmem, dcp, dp, pnt)
 #endif
 #ifdef AFS_SGI62_ENV
     printf
-       ("\tf.chunk=%d, f.inode=%lld, f.chunkBytes=%d, f.states=%x, stamp=%x\n",
-        dcp->f.chunk, dcp->f.inode, dcp->f.chunkBytes, dcp->f.states,
-        dcp->stamp);
+       ("\tf.chunk=%d, f.inode=%" AFS_INT64_FMT ", f.chunkBytes=%d, f.states=%x",
+        dcp->f.chunk, dcp->f.inode, dcp->f.chunkBytes, dcp->f.states);
 #else
     printf
-       ("\tf.chunk=%d, f.inode=%d, f.chunkBytes=%d, f.states=%x, stamp=%x\n",
-        dcp->f.chunk, dcp->f.inode, dcp->f.chunkBytes, dcp->f.states,
-        dcp->stamp);
+       ("\tf.chunk=%d, f.inode=%d, f.chunkBytes=%d, f.states=%x\n",
+        dcp->f.chunk, dcp->f.inode, dcp->f.chunkBytes, dcp->f.states);
 #endif
-    printf("\tlruq.prev=%lx, lruq.next=%lx, index=%d, ihint=%x\n",
-          dcp->lruq.prev, dcp->lruq.next, dcp->index, dcp->ihint);
+    printf("\tlruq.prev=%lx, lruq.next=%lx, index=%d\n",
+          dcp->lruq.prev, dcp->lruq.next, dcp->index);
 }
 
 void
-print_bkg(kmem)
-     int kmem;
+print_bkg(int kmem)
 {
     off_t symoff;
     struct brequest afs_brs[NBRS], ue, *uentry = &ue, *uep;
@@ -3068,8 +2986,7 @@ print_bkg(kmem)
 }
 
 void
-print_vlru(kmem)
-     int kmem;
+print_vlru(int kmem)
 {
     off_t symoff;
     struct vcache Ve, *Ventry = &Ve, *Vep, *tvc;
@@ -3107,8 +3024,7 @@ print_vlru(kmem)
 }
 
 void
-print_dlru(kmem)
-     int kmem;
+print_dlru(int kmem)
 {
     off_t symoff;
     struct dcache Ve, *Ventry = &Ve, *Vep, *tdc;
@@ -3146,8 +3062,7 @@ print_dlru(kmem)
 }
 
 int
-print_gcpags(pnt)
-     int pnt;
+print_gcpags(int pnt)
 {
     off_t symoff;
     afs_int32 afs_gcpags;
@@ -3191,8 +3106,7 @@ struct callo {
 #endif
 
 void
-print_callout(kmem)
-     int kmem;
+print_callout(int kmem)
 {
     off_t symoff;
 #ifndef        AFS_AIX_ENV
@@ -3201,7 +3115,7 @@ print_callout(kmem)
     struct callo Co, *Coe = &Co, *Cop;
     struct tos To, *Toe = &To, *tos;
     struct trb Trb, *Trbe = &Trb, *trb;
-    register int i = 0;
+    int i = 0;
 
 
     printf("\n\nPrinting callout table info...\n\n");
@@ -3222,8 +3136,7 @@ print_callout(kmem)
 }
 
 void
-print_dnlc(kmem)
-     int kmem;
+print_dnlc(int kmem)
 {
     struct nc *nameHash[256];
 
@@ -3231,8 +3144,7 @@ print_dnlc(kmem)
 
 
 void
-print_global_locks(kmem)
-     int kmem;
+print_global_locks(int kmem)
 {
     off_t symoff;
     afs_int32 count;
@@ -3270,8 +3182,7 @@ print_global_locks(kmem)
 
 
 void
-print_global_afs_resource(kmem)
-     int kmem;
+print_global_afs_resource(int kmem)
 {
     off_t symoff;
     char sysname[100];
@@ -3308,8 +3219,7 @@ print_global_afs_resource(kmem)
 
 
 void
-print_global_afs_cache(kmem)
-     int kmem;
+print_global_afs_cache(int kmem)
 {
     off_t symoff;
     char sysname[100];
@@ -3348,10 +3258,10 @@ print_global_afs_cache(kmem)
 #ifdef AFS_SGI62_ENV
     findsym("cacheInode", &symoff);
     kread(kmem, symoff, (char *)&inode, sizeof inode);
-    printf("\tcacheInode = 0x%llx (%lld)\n", inode, inode);
+    printf("\tcacheInode = 0x%llx (%" AFS_INT64_FMT ")\n", inode, inode);
     findsym("volumeInode", &symoff);
     kread(kmem, symoff, (char *)&inode, sizeof inode);
-    printf("\tvolumeInode = 0x%llx (%lld)\n", inode, inode);
+    printf("\tvolumeInode = 0x%llx (%" AFS_INT64_FMT ")\n", inode, inode);
 #else
     findsym("cacheInode", &symoff);
     kread(kmem, symoff, (char *)&count, sizeof count);
@@ -3405,13 +3315,12 @@ print_global_afs_cache(kmem)
 
 
 void
-print_rxstats(kmem)
-     int kmem;
+print_rxstats(int kmem)
 {
     off_t symoff;
     char sysname[100];
     afs_int32 count, i;
-    struct rx_stats rx_stats;
+    struct rx_statistics rx_stats;
 
     printf("\n\nPrinting some general RX stats...\n\n");
     findsym("rx_stats", &symoff);
@@ -3469,14 +3378,13 @@ print_rxstats(kmem)
 
 
 void
-print_rx(kmem)
-     int kmem;
+print_rx(int kmem)
 {
     off_t symoff;
     char sysname[100], c;
     afs_int32 count, i, ar[100];
     short sm;
-    struct rx_stats rx_stats;
+    struct rx_statistics rx_stats;
 
     printf("\n\nPrinting some RX globals...\n\n");
     findsym("rx_extraQuota", &symoff);
@@ -3595,8 +3503,7 @@ print_rx(kmem)
 
 
 void
-print_services(kmem)
-     afs_int32 kmem;
+print_services(afs_int32 kmem)
 {
     off_t symoff;
     struct rx_service *rx_services[RX_MAX_SERVICES], se, *sentry = &se, *sep;
@@ -3631,8 +3538,7 @@ print_services(kmem)
 
 #ifdef KDUMP_RX_LOCK
 void
-print_peertable_lock(kmem)
-     afs_int32 kmem;
+print_peertable_lock(afs_int32 kmem)
 {
     off_t symoff;
     struct rx_peer_rx_lock *rx_peerTable[256], se, *sentry = &se, *sep;
@@ -3671,8 +3577,7 @@ print_peertable_lock(kmem)
 
 #endif /* KDUMP_RX_LOCK */
 void
-print_peertable(kmem)
-     afs_int32 kmem;
+print_peertable(afs_int32 kmem)
 {
     off_t symoff;
     struct rx_peer *rx_peerTable[256], se, *sentry = &se, *sep;
@@ -3710,8 +3615,7 @@ print_peertable(kmem)
 
 #ifdef KDUMP_RX_LOCK
 void
-print_conntable_lock(kmem)
-     afs_int32 kmem;
+print_conntable_lock(afs_int32 kmem)
 {
     off_t symoff;
     struct rx_connection_rx_lock *rx_connTable[256], se, *sentry = &se;
@@ -3766,8 +3670,7 @@ print_conntable_lock(kmem)
 #endif /* KDUMP_RX_LOCK */
 
 void
-print_conntable(kmem)
-     afs_int32 kmem;
+print_conntable(afs_int32 kmem)
 {
     off_t symoff;
     struct rx_connection *rx_connTable[256], se, *sentry = &se, *sep;
@@ -3820,8 +3723,7 @@ print_conntable(kmem)
 
 #ifdef KDUMP_RX_LOCK
 void
-print_calltable_lock(kmem)
-     afs_int32 kmem;
+print_calltable_lock(afs_int32 kmem)
 {
     off_t symoff;
     struct rx_connection_rx_lock *rx_connTable[256], se;
@@ -3903,8 +3805,7 @@ print_calltable_lock(kmem)
 #endif /* KDUMP_RX_LOCK */
 
 void
-print_calltable(kmem)
-     afs_int32 kmem;
+print_calltable(afs_int32 kmem)
 {
     off_t symoff;
     struct rx_connection *rx_connTable[256], se, *sentry = &se, *sep;
@@ -3980,8 +3881,7 @@ print_calltable(kmem)
 }
 
 void
-print_eventtable(kmem)
-     afs_int32 kmem;
+print_eventtable(afs_int32 kmem)
 {
     off_t symoff;
     struct rx_queue epq;
@@ -4007,9 +3907,7 @@ print_eventtable(kmem)
  * provided.
  */
 void
-print_upDownStats(a_upDownP)
-     struct afs_stats_SrvUpDownInfo *a_upDownP;        /*Ptr to server up/down info */
-
+print_upDownStats(struct afs_stats_SrvUpDownInfo *a_upDownP)
 {                              /*print_upDownStats */
 
     /*
@@ -4053,8 +3951,7 @@ print_upDownStats(a_upDownP)
 
 
 void
-print_cmperfstats(perfP)
-     struct afs_stats_CMPerf *perfP;
+print_cmperfstats(struct afs_stats_CMPerf *perfP)
 {
     struct afs_stats_SrvUpDownInfo *upDownP;   /*Ptr to server up/down info */
 
@@ -4122,8 +4019,7 @@ print_cmperfstats(perfP)
 
 
 void
-print_cmstats(cmp)
-     struct afs_CMStats *cmp;
+print_cmstats(struct afs_CMStats *cmp)
 {
     printf("\t%10d afs_init\n", cmp->callInfo.C_afs_init);
     printf("\t%10d gop_rdwr\n", cmp->callInfo.C_gop_rdwr);