Remove AFS_PARISC_LINUX24_ENV references
[openafs.git] / src / venus / kdump.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #include <afsconfig.h>
11 #include <afs/param.h>
12
13 #include <roken.h>
14
15 #include <afs/cmd.h>
16
17 #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
18 /* Here be hacks. */
19 #ifdef AFS_LINUX24_ENV
20 #define __KERNEL__
21 #include <linux/string.h>
22 #define _STRING_H 1
23 #define _SYS_STATFS_H 1
24 #define _BITS_SIGCONTEXT_H 1
25 #undef USE_UCONTEXT
26 #endif
27
28 #ifdef AFS_LINUX26_ENV
29 /* For some reason, this doesn't get defined in linux/types.h
30    if __KERNEL_STRICT_NAMES is defined. But the definition of
31    struct inode uses it.
32 */
33 #ifndef pgoff_t
34 #define pgoff_t unsigned long
35 #endif
36 #endif
37
38 #include <string.h>
39
40 #ifdef __linux__
41 #define _CFS_HEADER_
42 #define _AFFS_FS_I
43 #define _NFS_FS_I
44 #define _SYSV_FS_SB
45 #define _AFFS_FS_SB
46 #define _NFS_FS_SB
47 #define __LINUX_UFS_FS_SB_H
48 #define _SYSV_FS_I
49 #define _LINUX_CODA_FS_I
50 #define _LINUX_NTFS_FS_SB_H
51 #define _LINUX_NTFS_FS_I_H
52 #define _NCP_FS_SB
53 struct sysv_sb_info {
54 };
55 struct affs_sb_info {
56 };
57 struct ufs_sb_info {
58 };
59 struct nfs_sb_info {
60 };
61 struct nfs_inode_info {
62 };
63 struct sysv_inode_info {
64 };
65 struct coda_inode_info {
66 };
67 struct affs_inode_info {
68 };
69 struct nfs_lock_info {
70 };
71 struct ntfs_sb_info {
72 };
73 struct ntfs_inode_info {
74 };
75 struct ncp_sb_info {
76 };
77 #include <linux/types.h>
78 #define u32 unsigned int
79 #define s32 int
80 #define u16 unsigned short
81 #include <features.h>
82 #if __GLIBC_MINOR__ >= 2
83 #define _SYS_TYPES_H 1
84 #endif
85 #define __KERNEL__
86 #endif
87
88 /* This tells afs.h to pick up afs_args from the dest tree. */
89 #define KDUMP_KERNEL
90
91 /*
92  * Need to include <netdb.h> before _KERNEL is defined since on IRIX 6.5
93  * <netdb.h> includes <netinet/in.h>, which in turn declares inet_addr()
94  * if _KERNEL is defined.  This declaration conflicts with that in
95  * <arpa/inet.h>.
96  */
97 #if     ! defined(AFS_AIX_ENV)
98 #include <netdb.h>
99 #endif
100
101 /* For AFS_SGI61_ENV and a 64 bit OS, _KMEMUSER should be defined on the
102  * compile line for kdump.o in the Makefile. This lets us pick up
103  * app32_ptr_t from types.h when included from afs/param.h.
104  */
105 #ifdef AFS_SGI62_ENV
106 #define _KERNEL 1
107 #endif
108
109 #ifndef AFS_LINUX20_ENV
110 #include <nlist.h>
111 #endif
112
113 #ifdef AFS_HPUX_ENV
114 #include <a.out.h>
115 #endif
116
117 #include <afs/stds.h>
118
119 #ifdef  AFS_SUN5_ENV /*XXXXX*/
120 #include <sys/t_lock.h>
121 struct vnode foo;
122 #endif
123
124 #ifdef AFS_SGI53_ENV
125 #define _KERNEL 1
126 #include <sys/sema.h>
127 #ifndef AFS_SGI62_ENV
128 #undef _KERNEL 1
129 #endif
130 #endif
131
132 #ifdef AFS_SGI62_ENV
133 #include <sys/fcntl.h>
134 #ifndef L_SET
135 #define L_SET 0
136 #endif
137 #endif
138
139 #include <sys/param.h>
140
141 #ifndef AFS_SGI64_ENV
142 #include <sys/user.h>
143 #endif
144
145 #ifndef AFS_LINUX26_ENV
146 #include <sys/file.h>
147 #endif
148
149 /*
150  * On SGIs, when _KERNEL is defined, <netinet/in.h> declares inet_addr()
151  * in a way that conflicts with the declaration in <arpa/inet.h>.
152  *
153  * Here we bring in <netinet/in.h> without _KERNEL defined and restore
154  * _KERNEL afterwards if needed.
155  *
156  * A better solution might be to straighten out which #includes are
157  * sensitive to _KERNEL on SGIs....
158  */
159 #if defined(AFS_SGI_ENV) && defined(_KERNEL)
160 # undef _KERNEL
161 # include <netinet/in.h>        /* struct in_addr */
162 # define _KERNEL 1
163 #else
164 # include <netinet/in.h>        /* struct in_addr */
165 #endif
166
167 #if defined(AFS_SGI_ENV)
168 #ifdef       AFS_SGI_ENV
169 #include <sys/vnode.h>
170 #endif /* AFS_SGI_ENV */
171 #else
172 #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
173 #include <sys/vnode.h>
174 #include <sys/mount.h>
175 #include <ufs/ufs/quota.h>
176 #include <ufs/ufs/inode.h>
177 #include <ufs/ffs/fs.h>
178 #else
179 #include "sys/vfs.h"
180 #ifdef AFS_LINUX20_ENV
181 #ifndef UIO_MAXIOV
182 #define UIO_MAXIOV 1            /* don't care */
183 #endif
184 #if __GLIBC_MINOR__ == 0
185 #include <iovec.h>
186 #endif
187 /*#define _TIME_H*/
188 /*#define _SYS_UIO_H */
189 #define _LINUX_SOCKET_H
190 #undef INT_MAX
191 #undef UINT_MAX
192 #undef LONG_MAX
193 #undef ULONG_MAX
194 #define _LINUX_TIME_H
195 #ifndef AFS_LINUX26_ENV
196 #define _LINUX_FCNTL_H
197 #endif
198 #ifdef AFS_IA64_LINUX24_ENV
199 #define flock64  flock
200 #endif /* AFS_IA64_LINUX24_ENV */
201 #ifdef AFS_S390_LINUX20_ENV
202 #define _S390_STATFS_H
203 #else
204 #ifdef AFS_SPARC64_LINUX20_ENV
205 #define _SPARC64_STATFS_H
206 #define _SPARC_STATFS_H
207 #else
208 #ifdef AFS_SPARC_LINUX20_ENV
209 #define _SPARC_STATFS_H
210 #else
211 #ifdef AFS_ALPHA_LINUX20_ENV
212 #define _ALPHA_STATFS_H
213 #else
214 #define _I386_STATFS_H
215 #endif /* AFS_ALPHA_LINUX20_ENV */
216 #endif /* AFS_SPARC_LINUX20_ENV */
217 #endif /* AFS_SPARC64_LINUX20_ENV */
218 #endif /* AFS_S390_LINUX20_ENV */
219 struct timezone {
220     int a, b;
221 };
222 #if defined(WORDS_BIGENDIAN)
223 #define _LINUX_BYTEORDER_BIG_ENDIAN_H
224 #else
225 #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
226 #endif
227 /* Avoid problems with timer_t redefinition */
228 #ifndef timer_t
229 #define timer_t ktimer_t
230 #define timer_t_redefined
231 #endif
232 #ifdef AFS_LINUX26_ENV
233 /* For some reason, this doesn't get defined in linux/types.h
234    if __KERNEL_STRICT_NAMES is defined. But the definition of
235    struct inode uses it.
236 */
237 #ifndef HAVE_SECTOR_T
238 /* got it from linux/types.h */
239 typedef unsigned long sector_t;
240 #endif /* HAVE_SECTOR_T */
241 #endif /* AFS_LINUX26_ENV */
242 #include <linux/version.h>
243 #include <linux/fs.h>
244 #include <osi_vfs.h>
245 #ifdef timer_t_redefined
246 #undef timer_t
247 #undef timer_t_redefined
248 #endif
249 #else /* AFS_LINUX20_ENV */
250 #ifdef AFS_HPUX110_ENV
251 #define  KERNEL
252 #define  _KERNEL 1
253 /* Declare following so sys/vnode.h will compile with KERNEL defined */
254 #define FILE FILe
255 typedef enum _spustate {        /* FROM /etc/conf/h/_types.h */
256     SPUSTATE_NONE = 0,          /* must be 0 for proper initialization */
257     SPUSTATE_IDLE,              /* spu is idle */
258     SPUSTATE_USER,              /* spu is in user mode */
259     SPUSTATE_SYSTEM,            /* spu is in system mode */
260     SPUSTATE_UNKNOWN,           /* utility code for NEW_INTERVAL() */
261     SPUSTATE_NOCHANGE           /* utility code for NEW_INTERVAL() */
262 } spustate_t;
263 #define k_off_t off_t
264 #include "sys/vnode.h"
265 #undef KERNEL
266 #undef _KERNEL
267 #else /* AFS_HPUX110_ENV */
268 #include "sys/vnode.h"
269 #endif /* else AFS_HPUX110_ENV */
270 #endif /* else AFS_LINUX20_ENV */
271 #ifdef  AFS_HPUX_ENV
272 #include "sys/inode.h"
273 #else
274 #ifndef AFS_AIX_ENV
275 #ifdef  AFS_SUN5_ENV
276 #include "sys/fs/ufs_inode.h"
277 #else
278 #ifndef AFS_LINUX20_ENV
279 #include "ufs/inode.h"
280 #endif
281 #endif
282 #endif
283 #endif
284 #endif
285 #endif
286
287 /* AFS includes */
288 #ifdef AFS_AIX41_ENV
289 /* This definition is in rx_machdep.h, currently only for AIX 41 */
290 #define RX_ENABLE_LOCKS
291 /* The following two defines are from rx_machdep.h and are used in rx_
292  * structures.
293  */
294 #define afs_kmutex_t int
295 #define afs_kcondvar_t int
296 #endif /* AFS_AIX41_ENV */
297
298
299 #ifdef AFS_SUN5_ENV
300
301 #define RX_ENABLE_LOCKS
302
303 /**
304   * Removed redefinitions of afs_kmutex_t and afs_kcondvar_t and included
305   * the system header files in which they are defined
306   */
307 #include <sys/mutex.h>
308 #include <sys/condvar.h>
309 typedef kmutex_t afs_kmutex_t;
310 typedef kcondvar_t afs_kcondvar_t;
311 #endif /* AFS_SUN5_ENV */
312
313 #ifdef AFS_HPUX110_ENV
314 #define RX_ENABLE_LOCKS
315 typedef struct {
316     void *s_lock;
317     int count;
318     long sa_fill1;
319     void *wait_list;
320     void *sa_fill2[2];
321     int sa_fill2b[2];
322     long sa_fill2c[3];
323     int sa_fill2d[16];
324     int order;
325     int sa_fill3;
326 } afs_kmutex_t;
327 typedef char *afs_kcondvar_t;
328 #endif /* AFS_HPUX110_ENV */
329
330 #ifdef AFS_SGI65_ENV
331 #define RX_ENABLE_LOCKS 1
332 typedef struct {
333     __psunsigned_t opaque1;
334     void *opaque2;
335 } afs_kmutex_t;
336 typedef struct {
337     __psunsigned_t opaque;
338 } afs_kcondvar_t;
339 #endif /* AFS_SGI65_ENV */
340
341 #ifdef AFS_LINUX20_ENV
342 #include <asm/atomic.h>
343 #include <asm/semaphore.h>
344 #define RX_ENABLE_LOCKS 1
345 typedef struct {
346     struct semaphore opaque1;
347     int opaque2;
348 } afs_kmutex_t;
349 typedef void *afs_kcondvar_t;
350 #endif /* AFS_LINUX20_ENV */
351
352 #include <afs/exporter.h>
353 /*#include "afs/osi.h"*/
354
355 typedef struct {
356     int tv_sec;
357     int tv_usec;
358 } osi_timeval32_t;              /* Needed here since KERNEL defined. */
359
360 /*#include "afs/volerrors.h"*/
361 #ifdef AFS_LINUX20_ENV
362 #define _SYS_TIME_H
363 #endif
364
365 #include <afs/afsint.h>
366 #include "vlserver/vldbint.h"
367 #include "afs/lock.h"
368
369 #define KERNEL
370
371 #ifndef notdef
372 #define AFS34
373 #define AFS33
374 #define AFS32a
375 #else
376 #define AFS32
377 #endif
378
379
380 #ifdef AFS_SGI61_ENV
381 extern off64_t lseek64();
382 #define KDUMP_SIZE_T size_t
383 #else /* AFS_SGI61_ENV */
384 #define KDUMP_SIZE_T int
385 #endif /* AFS_SGI61_ENV */
386
387 #include "afs/afs.h"            /* XXXX Getting it from the obj tree XXX */
388 #include "afs/afs_axscache.h"   /* XXXX Getting it from the obj tree XXX */
389 #include <afs/afs_stats.h>
390 #include <afs/nfsclient.h>
391
392 #include <afs/cmd.h>
393 #include <rx/rx.h>
394
395
396 #undef  KERNEL
397
398 #if defined(AFS_SGI_ENV)
399 #define UNIX "/unix"
400 #else
401 #if     defined(AFS_HPUX100_ENV)
402 #define UNIX "/stand/vmunix"
403 #else
404 #ifdef  AFS_HPUX_ENV
405 #define UNIX  "/hp-ux"
406 #else
407 #ifdef  AFS_SUN5_ENV
408 #define UNIX  "/dev/ksyms"
409 #else
410 #define UNIX  "/vmunix"
411 #endif
412 #endif /* AFS_HPUX_ENV */
413 #endif /* AFS_HPUX100_ENV */
414 #endif /* AFS_SGI_ENV */
415
416 #if     defined(AFS_SUN5_ENV)
417 #define CORE "/dev/mem"
418 #else
419 #define CORE "/dev/kmem"
420 #endif
421
422 /* Forward declarations */
423 void print_Conns();
424 void print_cbHash();
425 void print_DindexTimes();
426 void print_DdvnextTbl();
427 void print_DdcnextTbl();
428 void print_DindexFlags();
429 void print_buffers();
430 void print_allocs();
431 void kread(int kmem, off_t loc, void *buf, KDUMP_SIZE_T len);
432 void print_exporter();
433 void print_nfsclient();
434 void print_unixuser();
435 void print_cell();
436 void print_server();
437 void print_conns();
438 void print_conn();
439 void print_volume();
440 void print_venusfid();
441 void print_vnode();
442 void print_vcache();
443 void print_dcache();
444 void print_bkg();
445 void print_vlru();
446 void print_dlru();
447 void print_callout();
448 void print_dnlc();
449 void print_global_locks();
450 void print_global_afs_resource();
451 void print_global_afs_cache();
452 void print_rxstats();
453 void print_rx();
454 void print_services();
455 #ifdef KDUMP_RX_LOCK
456 void print_peertable_lock();
457 void print_conntable_lock();
458 void print_calltable_lock();
459 #endif
460 void print_peertable();
461 void print_conntable();
462 void print_calltable();
463 void print_eventtable();
464 void print_upDownStats();
465 void print_cmperfstats();
466 void print_cmstats();
467
468
469
470
471 int opencore();
472
473 #if     defined(AFS_HPUX_ENV) && defined(__LP64__)
474 #define afs_nlist nlist64
475 #define AFSNLIST(N, C) nlist64((N), (C))
476 #else /* defined(AFS_HPUX_ENV) && defined(__LP64__) */
477 #ifdef AFS_SGI61_ENV
478 #ifdef AFS_32BIT_KERNEL_ENV
479 #define afs_nlist nlist
480 #define AFSNLIST(N, C) nlist((N), (C))
481 #else
482 #define afs_nlist nlist64
483 #define AFSNLIST(N, C) nlist64((N), (C))
484 #endif /* AFS_32BIT_KERNEL_ENV */
485 #else /* AFS_SGI61_ENV */
486 #ifdef AFS_LINUX20_ENV
487 struct afs_nlist {
488     char *n_name;
489     unsigned long n_value;
490 };
491 #else /* AFS_LINUX20_ENV */
492 #define afs_nlist nlist
493 #endif /* AFS_LINUX20_ENV */
494 #define AFSNLIST(N, C) nlist((N), (C))
495 #endif /* AFS_SGI61_ENV */
496 #endif /* defined(AFS_HPUX_ENV) && defined(__LP64__) */
497
498 char *obj = UNIX, *core = CORE;
499 int kmem;
500
501 int Dcells = 0, Dusers = 0, Dservers = 0, Dconns = 0, Dvols = 0, Ddvols =
502     0, mem = 0;
503 int Dvstats = 0, Ddstats = 0, Dnfs = 0, Dglobals = 0, Dstats = 0, Dlocks =
504     0, Dall = 1;
505 int Dindextimes = 0, Dindexflags = 0, Dvnodes = 0, Dbuffers = 0, DCallbacks =
506     0, Dallocs = 0, UserLevel = 0;
507 int DdvnextTbl = 0, DdcnextTbl = 0;
508 int Nconns = 0, Drxstats = 0, Drx = 0, Dbkg = 0, Dvlru = 0, Ddlru =
509     0, Dcallout = 0;
510 int Ddnlc = 0;
511 int Dgcpags = 0;
512
513 #if     defined(AFS_SUN5_ENV)
514 #include <string.h>
515 #include <sys/types.h>
516 #include <sys/signal.h>
517 #include <sys/elf.h>
518 #include <libelf.h>
519 #include <sys/elf_M32.h>
520 #include <sys/proc.h>
521 #include <sys/file.h>
522 #define _NLIST_H                /* XXXXXXXXXXXXX */
523 #include <kvm.h>
524 kvm_t *kd;
525 #endif /* defined(AFS_SUN5_ENV) */
526
527 /* Pretty Printers - print real IP addresses and the like if running
528  * in interpret_mode.
529  */
530 int pretty = 1;
531
532 char *
533 PrintIPAddr(int addr)
534 {
535     static char str[32];
536     struct in_addr in_addr;
537
538     if (pretty) {
539         if (addr == 1) {
540             strcpy(str, "local");
541         } else {
542             in_addr.s_addr = addr;
543             (void)strcpy(str, inet_ntoa(in_addr));
544         }
545     } else {
546         (void)sprintf(str, "%x", addr);
547     }
548     return (char *)str;
549 }
550
551 #ifdef AFS_LINUX20_ENV
552 /* Find symbols in a live kernel. */
553
554 #ifdef AFS_LINUX26_ENV
555 #define KSYMS "/proc/kallsyms"
556 #else
557 #define KSYMS "/proc/ksyms"
558 #endif
559
560 /* symlist_t contains all the kernel symbols. Forcing a 64 byte array is
561  * a bit wasteful, but simple.
562  */
563 #define MAXNAMELEN 64
564 typedef struct symlist {
565     char s_name[MAXNAMELEN];
566 #ifdef AFS_LINUX_64BIT_KERNEL
567     unsigned long s_value;
568 #else
569     int s_value;
570 #endif /* AFS_LINUX_64BIT_KERNEL */
571 } symlist_t;
572
573 #define KSYM_ALLOC_STEP 128
574 #define KSYM_ALLOC_BASE 1024
575 symlist_t *ksyms = NULL;
576 int nksyms = 0;
577 int availksyms = 0;
578
579 #define MAXLINE 1024
580
581 int
582 compare_strings(const void *a, const void *b)
583 {
584     symlist_t *syma = (symlist_t *) a;
585     symlist_t *symb = (symlist_t *) b;
586     return strcmp(syma->s_name, symb->s_name);
587 }
588
589 /* Read in all the kernel symbols */
590 void
591 read_ksyms(void)
592 {
593     FILE *fp;
594     char line[MAXLINE];
595     char *p, *q;
596
597     if (ksyms)
598         return;
599
600     fp = fopen(KSYMS, "r");
601     if (fp == NULL) {
602         printf("Can't open %s, exiting.\n", KSYMS);
603         exit(1);
604     }
605
606     availksyms = KSYM_ALLOC_BASE;
607     ksyms = malloc(availksyms * sizeof(symlist_t));
608     if (!ksyms) {
609         printf("Can't malloc %d elements for symbol list.\n", availksyms);
610         exit(1);
611     }
612
613     /* proc is organized as <addr> <name> <module> */
614     while (fgets(line, MAXLINE, fp)) {
615         if (nksyms >= availksyms) {
616             availksyms += KSYM_ALLOC_STEP;
617             ksyms = realloc(ksyms, availksyms * sizeof(symlist_t));
618             if (!ksyms) {
619                 printf("Failed to realloc %d symbols.\n", availksyms);
620                 exit(1);
621             }
622         }
623 #ifdef AFS_LINUX_64BIT_KERNEL
624         ksyms[nksyms].s_value = (unsigned long)strtoul(line, &p, 16);
625 #else
626         ksyms[nksyms].s_value = (int)strtoul(line, &p, 16);
627 #endif /* AFS_LINUX_64BIT_KERNEL */
628         p++;
629 #ifdef AFS_LINUX26_ENV
630         /* Linux 2.6 /proc/kallsyms has a one-char symbol type
631            between address and name, so step over it and the following
632            blank.
633         */
634         p += 2;
635 #endif
636         q = strchr(p, '\t');
637         if (q)
638             *q = '\0';
639         if (strlen(p) >= MAXLINE) {
640             printf("Symbol '%s' too long, ignoring it.\n", p);
641             continue;
642         }
643         (void)strcpy(ksyms[nksyms].s_name, p);
644         nksyms++;
645     }
646
647     /* Sort them in lexical order */
648     qsort(ksyms, nksyms, sizeof(symlist_t), compare_strings);
649 }
650
651
652
653 /* find_symbol returns 0 if not found, otherwise value for symbol */
654 #ifdef AFS_LINUX_64BIT_KERNEL
655 unsigned long
656 #else
657 int
658 #endif /* AFS_LINUX_64BIT_KERNEL */
659 find_symbol(char *name)
660 {
661     symlist_t *tmp;
662     symlist_t entry;
663
664     if (!ksyms)
665         read_ksyms();
666
667     (void)strcpy(entry.s_name, name);
668     tmp =
669         (symlist_t *) bsearch(&entry, ksyms, nksyms, sizeof(symlist_t),
670                               compare_strings);
671
672     return tmp ? tmp->s_value : 0;
673 }
674
675 /* nlist fills in values in list until a null name is found. */
676 int
677 nlist(void *notused, struct afs_nlist *nlp)
678 {
679     for (; nlp->n_name && *nlp->n_name; nlp++)
680         nlp->n_value = find_symbol(nlp->n_name);
681
682     return 0;
683 }
684
685 #endif
686
687 #if     defined(AFS_SUN5_ENV)
688 #ifdef  _LP64
689 Elf64_Sym *tbl;
690 #else
691 Elf32_Sym *tbl;                 /* symbol tbl */
692 #endif
693 char *tblp;                     /* ptr to symbol tbl */
694 int scnt = 0;
695
696 #ifdef  _LP64
697 Elf64_Sym *
698 symsrch(s)
699      char *s;
700 {
701     Elf64_Sym *sp;
702 #else
703 Elf32_Sym *
704 symsrch(s)
705      char *s;
706 {
707     Elf32_Sym *sp;
708 #endif  /** _LP64 **/
709     char *name;
710     unsigned char type;
711
712     for (sp = tbl; sp < &tbl[scnt]; sp++) {
713 #ifdef _LP64
714         type = ELF64_ST_TYPE(sp->st_info);
715 #else
716         type = ELF32_ST_TYPE(sp->st_info);
717 #endif  /** _LP64 **/
718         if (((type == STB_LOCAL) || (type == STB_GLOBAL)
719              || (type == STB_WEAK))
720             && ((afs_uint32) sp->st_value >= 0x10000)) {
721             name = tblp + sp->st_name;
722             if (!strcmp(name, s))
723                 return (sp);
724         }
725     }
726     return (0);
727 }
728
729 #endif /*defined(AFS_SUN5_ENV) */
730
731 #endif /*!defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV) */
732
733 #ifndef AFS_KDUMP_LIB
734 static int
735 cmdproc(struct cmd_syndesc *as, void *arock)
736 {
737     afs_int32 code = 0;
738
739 #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
740     if (as->parms[0].items) {   /* -kobj */
741         obj = as->parms[0].items->data;
742     }
743     if (as->parms[1].items) {   /* -kcore */
744         core = as->parms[1].items->data;
745     }
746     if (as->parms[2].items) {   /* -cells */
747         Dcells = 1, Dall = 0;
748     }
749     if (as->parms[3].items) {   /* -users */
750         Dusers = 1, Dall = 0;
751     }
752     if (as->parms[4].items) {   /* -servers */
753         Dservers = 1, Dall = 0;
754     }
755     if (as->parms[5].items) {   /* -conns */
756         Dconns = 1, Dall = 0;
757     }
758     if (as->parms[6].items) {   /* -volumes */
759         Dvols = 1, Dall = 0;
760     }
761     if (as->parms[7].items) {   /* -dvolumes */
762         Ddvols = 1, Dall = 0;
763     }
764     if (as->parms[8].items) {   /* -vstats */
765         Dvstats = 1, Dall = 0;
766     }
767     if (as->parms[9].items) {   /* -dstats */
768         Ddstats = 1, Dall = 0;
769     }
770     if (as->parms[10].items) {  /* -nfstats */
771         Dnfs = 1, Dall = 0;
772     }
773     if (as->parms[11].items) {  /* -globals */
774         Dglobals = 1, Dall = 0;
775     }
776     if (as->parms[12].items) {  /* -stats */
777         Dstats = 1, Dall = 0;
778     }
779     if (as->parms[13].items) {  /* -locks */
780         Dlocks = 1, Dall = 0;
781     }
782     if (as->parms[14].items) {  /* -mem */
783         mem = 1;
784     }
785     if (as->parms[15].items) {  /* -rxstats */
786         Drxstats = 1, Dall = 0;
787     }
788     if (as->parms[16].items) {  /* -rx */
789         Drx = 1, Dall = 0;
790     }
791     if (as->parms[17].items) {  /* -timestable */
792         Dindextimes = 1, Dall = 0;
793     }
794     if (as->parms[18].items) {  /* -flagstable */
795         Dindexflags = 1, Dall = 0;
796     }
797     if (as->parms[19].items) {  /* -cbhash */
798         DCallbacks = 1, Dall = 0;
799     }
800     if (as->parms[20].items) {  /* -vnodes */
801         Dvnodes = 1, Dall = 0;
802     }
803     if (as->parms[21].items) {  /* -buffers */
804         Dbuffers = 1, Dall = 0;
805     }
806     if (as->parms[22].items) {  /* -allocedmem */
807         Dallocs = 1, Dall = 0;
808     }
809     if (as->parms[23].items) {  /* -user */
810         UserLevel = 1;
811     }
812     if (as->parms[24].items) {  /* -bkg */
813         Dbkg = 1, Dall = 0;
814     }
815     if (as->parms[25].items) {  /* -vlru */
816         Dvlru = 1, Dall = 0;
817     }
818     if (as->parms[26].items) {  /* -callout */
819         Dcallout = 1, Dall = 0;
820     }
821     if (as->parms[27].items) {  /* -dnlc */
822         Ddnlc = 1, Dall = 0;
823     }
824     if (as->parms[28].items) {  /* -dlru */
825         Ddlru = 1, Dall = 0;
826     }
827
828     if (as->parms[29].items) {  /* -raw */
829         pretty = 0;
830     }
831
832     if (as->parms[30].items) {  /* -gcpags */
833         Dgcpags = 1, Dall = 0;
834     }
835
836     if (as->parms[31].items) {  /* -dhash */
837         DdvnextTbl = 1, DdcnextTbl = 1, Dall = 0;
838     }
839 #endif
840
841     code = kdump();
842     return code;
843 }
844
845 #include "AFS_component_version_number.c"
846
847 int
848 main(int argc, char **argv)
849 {
850     struct cmd_syndesc *ts;
851     afs_int32 code;
852
853 #ifdef  AFS_AIX32_ENV
854     struct sigaction nsa;
855
856     sigemptyset(&nsa.sa_mask);
857     nsa.sa_handler = SIG_DFL;
858     nsa.sa_flags = SA_FULLDUMP;
859     sigaction(SIGSEGV, &nsa, NULL);
860 #endif
861
862     ts = cmd_CreateSyntax(NULL, cmdproc, NULL, 0,
863                           "Read internal cache manager structs");
864     cmd_AddParm(ts, "-kobj", CMD_SINGLE, CMD_OPTIONAL,
865                 "kernel object (default /vmunix)");
866     cmd_AddParm(ts, "-kcore", CMD_SINGLE, CMD_OPTIONAL,
867                 "kernel core image (default /dev/kmem)");
868     cmd_AddParm(ts, "-cells", CMD_FLAG, CMD_OPTIONAL, "cell state");
869     cmd_AddParm(ts, "-users", CMD_FLAG, CMD_OPTIONAL, "users state");
870     cmd_AddParm(ts, "-servers", CMD_FLAG, CMD_OPTIONAL, "servers state");
871     cmd_AddParm(ts, "-conns", CMD_FLAG, CMD_OPTIONAL, "conns state");
872     cmd_AddParm(ts, "-volumes", CMD_FLAG, CMD_OPTIONAL,
873                 "incore volume state");
874     cmd_AddParm(ts, "-dvolumes", CMD_FLAG, CMD_OPTIONAL, "disk volume state");
875     cmd_AddParm(ts, "-vstats", CMD_FLAG, CMD_OPTIONAL, "stat file state");
876     cmd_AddParm(ts, "-dstats", CMD_FLAG, CMD_OPTIONAL, "file data state");
877     cmd_AddParm(ts, "-nfstats", CMD_FLAG, CMD_OPTIONAL,
878                 "nfs translator state");
879     cmd_AddParm(ts, "-globals", CMD_FLAG, CMD_OPTIONAL,
880                 "general global state");
881     cmd_AddParm(ts, "-stats", CMD_FLAG, CMD_OPTIONAL,
882                 "general cm performance state");
883     cmd_AddParm(ts, "-locks", CMD_FLAG, CMD_OPTIONAL,
884                 "global cm related locks state");
885     cmd_AddParm(ts, "-mem", CMD_FLAG, CMD_OPTIONAL,
886                 "core represents the physical mem (i.e. /dev/mem) and not virtual");
887     cmd_AddParm(ts, "-rxstats", CMD_FLAG, CMD_OPTIONAL,
888                 "general rx statistics");
889     cmd_AddParm(ts, "-rx", CMD_FLAG, CMD_OPTIONAL, "all info about rx");
890     cmd_AddParm(ts, "-timestable", CMD_FLAG, CMD_OPTIONAL,
891                 "dcache LRU info table");
892     cmd_AddParm(ts, "-flagstable", CMD_FLAG, CMD_OPTIONAL,
893                 "dcache flags info table");
894     cmd_AddParm(ts, "-cbhash", CMD_FLAG, CMD_OPTIONAL,
895                 "vcache hashed by cbExpires");
896     cmd_AddParm(ts, "-vnodes", CMD_FLAG, CMD_OPTIONAL, "afs vnodes");
897     cmd_AddParm(ts, "-buffers", CMD_FLAG, CMD_OPTIONAL,
898                 "afs dir buffer cache");
899     cmd_AddParm(ts, "-allocedmem", CMD_FLAG, CMD_OPTIONAL,
900                 "allocated memory");
901     cmd_AddParm(ts, "-user", CMD_FLAG, CMD_OPTIONAL,
902                 "core is from a user-level program");
903     cmd_AddParm(ts, "-bkg", CMD_FLAG, CMD_OPTIONAL, "background daemon info");
904     cmd_AddParm(ts, "-vlru", CMD_FLAG, CMD_OPTIONAL, "vcache lru list");
905     cmd_AddParm(ts, "-callout", CMD_FLAG, CMD_OPTIONAL,
906                 "callout info (aix only)");
907     cmd_AddParm(ts, "-dnlc", CMD_FLAG, CMD_OPTIONAL,
908                 "DNLC table,freelist,trace");
909     cmd_AddParm(ts, "-dlru", CMD_FLAG, CMD_OPTIONAL, "dcache lru list");
910
911
912     cmd_AddParm(ts, "-raw", CMD_FLAG, CMD_OPTIONAL, "show raw values");
913     cmd_AddParm(ts, "-gcpags", CMD_FLAG, CMD_OPTIONAL,
914                 "PAG garbage collection info");
915     cmd_AddParm(ts, "-dhash", CMD_FLAG, CMD_OPTIONAL,
916                 "show dcache hash chains");
917
918     code = cmd_Dispatch(argc, argv);
919     return code;
920 }
921 #endif /* !AFS_KDUMP_LIB */
922
923 #ifdef  AFS_AIX_ENV
924 #ifndef AFS_KDUMP_LIB
925 int
926 Knlist(struct afs_nlist *sp, int cnt, int size)
927 {
928     int code;
929
930     if (UserLevel)
931         code = nlist(obj, sp);
932     else
933         code = knlist(sp, cnt, size);
934     return code;
935 }
936 #endif /*AFS_KDUMP_LIB */
937 #endif
938
939 #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
940 int
941 findsym(char *sname, off_t * offset)
942 {
943 #if     defined(AFS_SUN5_ENV)
944 #ifdef  _LP64
945     Elf64_Sym *ss_ans;
946 #else
947     Elf32_Sym *ss_ans;
948 #endif
949     ss_ans = symsrch(sname);
950     if (!ss_ans) {
951         printf("(WARNING) Couldn't find %s in %s. Proceeding..\n", sname,
952                obj);
953         *offset = 0;
954         return 0;
955     }
956     *offset = ss_ans->st_value;
957     return 1;
958 #else /* defined(AFS_SUN5_ENV) */
959 #if     defined(AFS_AIX_ENV)
960     if (!UserLevel) {
961         struct afs_nlist nl;
962         nl.n_name = sname;
963         if (Knlist(&nl, 1, sizeof nl) == -1) {
964             printf("(WARNING) knlist: couldn't find %s. Proceeding...",
965                    sname);
966             *offset = 0;
967             return 0;
968         }
969         *offset = nl.n_value;
970         return 1;
971     }
972 #endif /* defined(AFS_AIX_ENV) */
973     {
974         struct afs_nlist request[2];
975
976         memset(request, 0, sizeof request);
977         request[0].n_name = sname;
978         if (AFSNLIST(obj, request) < 0) {
979             fprintf(stderr, "nlist(%s, %s) failure: %d (%s)\n", obj, sname,
980                     errno, strerror(errno));
981             exit(1);
982         }
983         *offset = request[0].n_value;
984         if (!request[0].n_value) {
985             printf("(WARNING) Couldn't find %s in %s. Proceeding..\n", sname,
986                    obj);
987             return 0;
988         }
989         return 1;
990     }
991 #endif /* defined(AFS_SUN5_ENV) */
992 }
993 #endif
994
995 #define CBHTSIZE 128
996
997 int
998 kdump(void)
999 {
1000 #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
1001     printf("Kdump not supported\n");
1002 #else
1003     int cell, cnt, cnt1;
1004 #ifndef AFS_KDUMP_LIB
1005
1006     kmem = opencore(core);
1007
1008 #endif /* AFS_KDUMP_LIB */
1009
1010 #ifdef KDUMP_RX_LOCK
1011     /* Test to see if kernel is using RX_ENABLE_LOCKS in rx structs. */
1012 #ifdef AFS_SGI53_ENV
1013 #ifdef AFS_SGI64_ENV
1014     use_rx_lock = 1;            /* Always using fine gain locking. */
1015 #else
1016     use_rx_lock = (sysmp(MP_NPROCS) > 1) ? 1 : 0;
1017 #endif
1018 #endif /* AFS_SGI53_ENV */
1019 #endif /* KDUMP_RX_LOCK */
1020
1021     if (Dcells || Dall) {
1022         print_cells(1);         /* Handle the afs_cells structures */
1023         print_cellaliases(1);
1024         print_cellnames(1);
1025     }
1026
1027     if (Dusers || Dall) {
1028         print_users(1);         /* Handle the afs_users structs */
1029     }
1030
1031     if (Dservers || Dall) {
1032         print_servers(1);       /* Handle the afs_servers structs */
1033     }
1034
1035     if (Dconns) {
1036         print_Conns(1);         /* Handle the afs_servers structs */
1037     }
1038
1039     if (Dvols || Dall) {
1040         print_volumes(1);       /* Handle the afs_volumes structs */
1041     }
1042
1043     if (Ddvols || Dall) {
1044         printf
1045             ("\n\nIGNORE reading the 'volumeinfo' file for now (NOT IMPORTANT)!\n");
1046     }
1047
1048     if (DCallbacks || Dall) {
1049         print_cbHash(1);        /* Handle the cbHashT table of queued vcaches */
1050     }
1051
1052     if (Dvstats || Dall || Dvnodes) {
1053         print_vcaches(1);       /* Handle the afs_vcaches structs */
1054     }
1055
1056     if (Ddstats || Dall) {
1057         print_dcaches(1);
1058     }
1059
1060     if (Dindextimes || Dall) {
1061         print_DindexTimes(1);
1062     }
1063
1064     if (Dindexflags || Dall) {
1065         print_DindexFlags(1);
1066     }
1067
1068     if (DdvnextTbl || Dall) {
1069         print_DdvnextTbl(1);
1070     }
1071
1072     if (DdcnextTbl || Dall) {
1073         print_DdcnextTbl(1);
1074     }
1075
1076     if (Dbuffers || Dall) {
1077         print_buffers(1);
1078     }
1079
1080     if (Dnfs || Dall) {
1081         print_nfss(1);
1082     }
1083
1084     if (Dstats || Dall) {
1085         off_t symoff;
1086         struct afs_CMStats afs_cmstats;
1087         struct afs_stats_CMPerf afs_cmperfstats;
1088
1089         printf("\n\nPrinting count references to cm-related functions..\n\n");
1090         findsym("afs_cmstats", &symoff);
1091         kread(kmem, symoff, (char *)&afs_cmstats, sizeof afs_cmstats);
1092         print_cmstats(&afs_cmstats);
1093         printf("\n\nPrinting some cm struct performance stats..\n\n");
1094         findsym("afs_stats_cmperf", &symoff);
1095         kread(kmem, symoff, (char *)&afs_cmperfstats, sizeof afs_cmperfstats);
1096         print_cmperfstats(&afs_cmperfstats);
1097
1098     }
1099     if (Dlocks || Dall) {
1100         print_global_locks(kmem);
1101     }
1102     if (Dglobals || Dall) {
1103         printf("\n\nPrinting Misc afs globals...\n");
1104         print_global_afs_resource(kmem);
1105         print_global_afs_cache(kmem);
1106     }
1107     if (Dbkg || Dall) {
1108         print_bkg(kmem);
1109     }
1110     if (Dvlru || Dall) {
1111         print_vlru(kmem);
1112     }
1113     if (Ddlru || Dall) {
1114         print_dlru(kmem);
1115     }
1116     if (Drxstats || Dall) {
1117         print_rxstats(kmem);
1118     }
1119     if (Drx || Dall) {
1120         print_rx(kmem);
1121     }
1122 #ifndef AFS_KDUMP_LIB
1123     if (Dallocs || Dall) {
1124         print_allocs(1);
1125     }
1126 #endif
1127     if (Dcallout || Dall) {
1128         print_callout(kmem);
1129     }
1130     if (Ddnlc || Dall) {
1131         print_dnlc(kmem);
1132     }
1133     if (Dgcpags || Dall) {
1134         print_gcpags(1);
1135     }
1136 #endif
1137     return 0;
1138 }
1139
1140 #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
1141 int Sum_cellnames = 0, Sum_userstp = 0, Sum_volnames = 0, Sum_exps =
1142     0, Sum_nfssysnames = 0;
1143 int Sum_vcachemvids = 0, Sum_vcachelinkData = 0, Sum_vcacheacc =
1144     0, Sum_vcachelocks = 0;
1145 int Sum_cellaliases = 0, Sum_cellname_names = 0;
1146
1147 int
1148 print_cells(int pnt)
1149 {
1150     off_t symoff;
1151     struct cell *cells, cle, *clentry = &cle, *clep;
1152     long j = 0, cell;
1153     struct afs_q CellLRU, lru, *vu = &lru, *tq, *uq;
1154     u_long lru_addr;
1155
1156     if (pnt)
1157         printf("\n\nPrinting Cells' LRU list...\n");
1158     findsym("CellLRU", &symoff);
1159     kread(kmem, symoff, (char *)&CellLRU, sizeof CellLRU);
1160     lru_addr = (u_long) symoff;
1161     for (tq = CellLRU.next; (u_long) tq != lru_addr; tq = uq) {
1162         clep = QTOC(tq);
1163         kread(kmem, (off_t) tq, (char *)vu, sizeof CellLRU);
1164         uq = vu->next;
1165         kread(kmem, (off_t) clep, (char *)clentry, sizeof *clentry);
1166         print_cell(kmem, clentry, clep, pnt);
1167         j++;
1168     }
1169     if (pnt)
1170         printf("... found %d 'afs_cells' entries\n", j);
1171
1172     return j;
1173 }
1174
1175 int
1176 print_cellaliases(int pnt)
1177 {
1178     off_t symoff;
1179     struct cell_alias *ca, cae;
1180     long j = 0;
1181
1182     if (pnt)
1183         printf("\n\nPrinting cell_alias list...\n");
1184     findsym("afs_cellalias_head", &symoff);
1185     kread(kmem, symoff, (char *)&ca, sizeof ca);
1186     while (ca) {
1187         char alias[100], cell[100];
1188
1189         kread(kmem, (off_t) ca, (char *)&cae, sizeof cae);
1190         kread(kmem, (off_t) cae.alias, alias, (KDUMP_SIZE_T) 40);
1191         alias[40] = '\0';
1192         Sum_cellaliases += strlen(alias) + 1;
1193         kread(kmem, (off_t) cae.cell, cell, (KDUMP_SIZE_T) 40);
1194         cell[40] = '\0';
1195         Sum_cellaliases += strlen(cell) + 1;
1196         if (pnt)
1197             printf("%x: alias=%s cell=%s index=%d\n", ca, alias, cell,
1198                    cae.index);
1199         ca = cae.next;
1200         j++;
1201     }
1202     if (pnt)
1203         printf("... found %d 'cell_alias' entries\n", j);
1204
1205     return j;
1206 }
1207
1208 int
1209 print_cellnames(int pnt)
1210 {
1211     off_t symoff;
1212     struct cell_name *cn, cne;
1213     long j = 0;
1214
1215     if (pnt)
1216         printf("\n\nPrinting cell_name list...\n");
1217     findsym("afs_cellname_head", &symoff);
1218     kread(kmem, symoff, (char *)&cn, sizeof cn);
1219     while (cn) {
1220         char cellname[100];
1221
1222         kread(kmem, (off_t) cn, (char *)&cne, sizeof cne);
1223         kread(kmem, (off_t) cne.cellname, cellname, (KDUMP_SIZE_T) 40);
1224         cellname[40] = '\0';
1225         Sum_cellname_names += strlen(cellname) + 1;
1226         if (pnt)
1227             printf("%x: cellnum=%d cellname=%s used=%d\n", cn, cne.cellnum,
1228                    cellname, cne.used);
1229         cn = cne.next;
1230         j++;
1231     }
1232     if (pnt)
1233         printf("... found %d 'cell_name' entries\n", j);
1234
1235     return j;
1236 }
1237
1238 int
1239 print_users(int pnt)
1240 {
1241     off_t symoff;
1242     struct unixuser *afs_users[NUSERS], ue, *uentry = &ue, *uep;
1243     int i, j;
1244
1245     if (pnt)
1246         printf("\n\nPrinting 'afs_users' structures...\n");
1247     findsym("afs_users", &symoff);
1248     kread(kmem, symoff, (char *)afs_users, sizeof afs_users);
1249     for (i = 0, j = 0; i < NUSERS; i++) {
1250         for (uep = afs_users[i]; uep; uep = uentry->next, j++) {
1251             kread(kmem, (off_t) uep, (char *)uentry, sizeof *uentry);
1252             print_unixuser(kmem, uentry, uep, pnt);
1253         }
1254     }
1255     if (pnt)
1256         printf("... found %d 'afs_users' entries\n", j);
1257     return j;
1258 }
1259
1260 struct server **serversFound = NULL;
1261 afs_int32 NserversFound = 0;
1262 #define SF_ALLOCATION_STEP 500
1263
1264 int
1265 add_found_server(struct server *sep)
1266 {
1267     static afs_int32 NserversAllocated = 0;
1268     static afs_int32 failed = 0;
1269
1270     if (failed)
1271         return -1;
1272
1273     if (NserversFound >= NserversAllocated) {
1274         NserversAllocated += SF_ALLOCATION_STEP;
1275         if (!serversFound) {
1276             serversFound = malloc(NserversAllocated *
1277                                   sizeof(struct server *));
1278         } else {
1279             serversFound = realloc(serversFound,
1280                                    NserversAllocated *
1281                                    sizeof(struct server *));
1282         }
1283         if (!serversFound) {
1284             printf("Can't allocate %lu bytes for list of found servers.\n",
1285                    NserversAllocated * sizeof(struct server *));
1286             failed = 1;
1287             NserversFound = 0;
1288             return -1;
1289         }
1290     }
1291     serversFound[NserversFound++] = sep;
1292     return 0;
1293 }
1294
1295 int
1296 find_server(struct server *sep)
1297 {
1298     int i;
1299
1300     for (i = 0; i < NserversFound; i++) {
1301         if (sep == serversFound[i])
1302             return 1;
1303     }
1304     return 0;
1305 }
1306
1307 int
1308 print_servers(int pnt)
1309 {
1310     off_t symoff;
1311     struct server *afs_servers[NSERVERS], se, *sentry = &se, *sep;
1312     struct srvAddr *afs_srvAddrs[NSERVERS], sa, *sap;
1313     afs_int32 i, nServers, nSrvAddrs, nSrvAddrStructs;
1314     afs_int32 afs_totalServers, afs_totalSrvAddrs;
1315     int failed = 0;
1316     int chainCount[NSERVERS];
1317
1318     if (pnt) {
1319         memset(chainCount, 0, sizeof(chainCount));
1320         printf("\n\nPrinting 'afs_servers' structures...\n");
1321     }
1322     findsym("afs_servers", &symoff);
1323     kread(kmem, symoff, (char *)afs_servers, NSERVERS * sizeof(long));
1324     for (i = 0, nServers = 0; i < NSERVERS; i++) {
1325         if (pnt)
1326             printf(" --- Chain %d ---\n", i);
1327         for (sep = afs_servers[i]; sep; sep = sentry->next, nServers++) {
1328             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
1329             if (pnt && !failed) {
1330                 if (add_found_server(sep) < 0)
1331                     failed = 1;
1332             }
1333             if (pnt)
1334                 chainCount[i]++;
1335             if (Dconns || Dall || !pnt)
1336                 print_server(kmem, sentry, sep, 1, pnt);
1337             else
1338                 print_server(kmem, sentry, sep, 0, pnt);
1339         }
1340     }
1341     if (pnt) {
1342         if (Dconns || Dall)
1343             printf("... found %d 'afs_servers' entries (total conns = %d)\n",
1344                    nServers, Nconns);
1345         else
1346             printf("... found %d 'afs_servers' entries\n", nServers);
1347         printf("Chain lengths:\n");
1348         for (i = 0; i < NSERVERS; i++) {
1349             printf("%2d: %5d\n", i, chainCount[i]);
1350         }
1351     }
1352     Dconns = 0;
1353
1354
1355     /* Verify against afs_totalServers. */
1356     if (pnt) {
1357         memset(chainCount, 0, sizeof(chainCount));
1358         if (findsym("afs_totalServers", &symoff)) {
1359             kread(kmem, symoff, (char *)&afs_totalServers, sizeof(afs_int32));
1360             if (afs_totalServers != nServers) {
1361                 printf
1362                     ("ERROR: afs_totalServers = %d, differs from # of servers in hash table.\n",
1363                      afs_totalServers);
1364             } else {
1365                 printf("afs_totalServers = %d, matches hash chain count.\n",
1366                        afs_totalServers);
1367             }
1368         }
1369
1370         printf("\n\nPrinting 'afs_srvAddr' structures...\n");
1371         if (findsym("afs_srvAddrs", &symoff)) {
1372             kread(kmem, symoff, (char *)afs_srvAddrs,
1373                   NSERVERS * sizeof(long));
1374             nSrvAddrStructs = 0;
1375             for (i = 0, nSrvAddrs = 0; i < NSERVERS; i++) {
1376                 printf(" --- Chain %d ---\n", i);
1377                 for (sap = afs_srvAddrs[i]; sap; sap = sa.next_bkt) {
1378                     kread(kmem, (off_t) sap, (char *)&sa, sizeof(sa));
1379                     printf
1380                         ("%lx: sa_ip=%s, sa_port=%d, sa_iprank=%d, sa_flags=%x, conns=%lx, server=%lx, nexth=%lx\n",
1381                          sap, PrintIPAddr(sa.sa_ip), sa.sa_portal,
1382                          sa.sa_iprank, sa.sa_flags, sa.conns, sa.server,
1383                          sa.next_bkt);
1384                     if (sap != (struct srvAddr *)sa.server) {
1385                         /* only count ones not in a server struct. */
1386                         nSrvAddrStructs++;
1387                     }
1388                     nSrvAddrs++;
1389                     chainCount[i]++;
1390                     if (!failed) {
1391                         if (!find_server(sa.server)) {
1392                             kread(kmem, (off_t) sa.server, (char *)sentry,
1393                                   sizeof *sentry);
1394                             printf
1395                                 ("ERROR: Server missing from hash chain: server=%lx, server->next=%lx\n",
1396                                  sa.server, sentry->next);
1397                             print_server(kmem, sentry, sa.server, 1, pnt);
1398                             printf
1399                                 ("----------------------------------------------------\n");
1400                         }
1401                     }
1402
1403                 }
1404             }
1405             printf
1406                 ("... found %d 'afs_srvAddr' entries, %d alloc'd (not in server struct)\n",
1407                  nSrvAddrs, nSrvAddrStructs);
1408             printf("Chain lengths:\n");
1409             for (i = 0; i < NSERVERS; i++) {
1410                 printf("%2d: %5d\n", i, chainCount[i]);
1411             }
1412             if (findsym("afs_totalSrvAddrs", &symoff)) {
1413                 kread(kmem, symoff, (char *)&afs_totalSrvAddrs,
1414                       sizeof(afs_int32));
1415                 if (afs_totalSrvAddrs != nSrvAddrStructs) {
1416                     printf
1417                         ("ERROR: afs_totalSrvAddrs = %d, differs from number of alloc'd srvAddrs in hash table.\n",
1418                          afs_totalSrvAddrs);
1419                 } else {
1420                     printf
1421                         ("afs_totalSrvAddrs = %d, matches alloc'd srvAddrs in hash chain count.\n",
1422                          afs_totalSrvAddrs);
1423                 }
1424             }
1425         }
1426     }
1427     return nServers;
1428 }
1429
1430
1431 void
1432 print_Conns(int pnt)
1433 {
1434     off_t symoff;
1435     struct server *afs_servers[NSERVERS], se, *sentry = &se, *sep;
1436     afs_int32 i, j;
1437
1438     if (pnt)
1439         printf("\n\nPrinting all 'afs_conns' to  the servers...\n");
1440     findsym("afs_servers", &symoff);
1441     kread(kmem, symoff, (char *)afs_servers, sizeof afs_servers);
1442     for (i = 0, j = 0; i < NSERVERS; i++) {
1443         for (sep = afs_servers[i]; sep; sep = sentry->next, j++) {
1444             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
1445             print_server(kmem, sentry, sep, 2, pnt);
1446         }
1447     }
1448     if (pnt)
1449         printf("... found %d 'afs_conns' entries\n", Nconns);
1450 }
1451
1452
1453 int
1454 print_volumes(int pnt)
1455 {
1456     off_t symoff;
1457     struct volume *afs_volumes[NVOLS], ve, *ventry = &ve, *vep;
1458     afs_int32 i, j;
1459
1460     if (pnt)
1461         printf("\n\nPrinting 'afs_volumes' structures...\n");
1462     findsym("afs_volumes", &symoff);
1463     kread(kmem, symoff, (char *)afs_volumes, NVOLS * sizeof(long));
1464     for (i = 0, j = 0; i < NVOLS; i++) {
1465         for (vep = afs_volumes[i]; vep; vep = ventry->next, j++) {
1466             kread(kmem, (off_t) vep, (char *)ventry, sizeof *ventry);
1467             print_volume(kmem, ventry, vep, pnt);
1468         }
1469     }
1470     if (pnt)
1471         printf("... found %d 'afs_volumes' entries\n", j);
1472     return (j);
1473 }
1474
1475 void
1476 print_cbHash(int pnt)
1477 {
1478     off_t symoff;
1479     struct afs_q cbHashT[CBHTSIZE];
1480     afs_int32 i, j;
1481
1482     if (pnt)
1483         printf("\n\nPrinting 'cbHashT' table...\n");
1484     findsym("cbHashT", &symoff);
1485     kread(kmem, symoff, (char *)cbHashT, sizeof cbHashT);
1486     for (i = 0; i < CBHTSIZE; i++) {
1487         if (pnt)
1488             printf("%lx: %x %x\n", (long)symoff + 8 * i, cbHashT[i].prev,
1489                    cbHashT[i].next);
1490     }
1491     if (pnt)
1492         printf("... that should be %d callback hash entries\n", i);
1493 }
1494
1495 int
1496 print_vcaches(int pnt)
1497 {
1498     off_t symoff;
1499     struct vcache *afs_vhashTable[VCSIZE], Ve, *Ventry = &Ve, *Vep;
1500     afs_int32 i, j;
1501
1502     if (pnt)
1503         printf("\n\nPrinting afs_vcaches structures...\n");
1504     if (pnt)
1505         printf("print_vcaches: sizeof(struct vcache) = %ld\n",
1506                (long)sizeof(struct vcache));
1507     findsym("afs_vhashT", &symoff);
1508     kread(kmem, symoff, (char *)afs_vhashTable, sizeof afs_vhashTable);
1509     for (i = 0, j = 0; i < VCSIZE; i++) {
1510         if (pnt)
1511             printf("Printing hash chain %d...\n", i);
1512         for (Vep = afs_vhashTable[i]; Vep; Vep = Ventry->hnext, j++) {
1513             kread(kmem, (off_t) Vep, (char *)Ventry, sizeof *Ventry);
1514             if (Dvstats || Dall || !pnt)
1515                 print_vcache(kmem, Ventry, Vep, pnt);
1516             if (Dvnodes || Dall)
1517                 print_vnode(kmem, Ventry, Vep, pnt);
1518         }
1519     }
1520     if (pnt)
1521         printf("... found %d 'afs_vcaches' entries\n", j);
1522     return j;
1523 }
1524
1525 int
1526 print_dcaches(int pnt)
1527 {
1528     off_t symoff;
1529     long table, *ptr;
1530     struct dcache dc, *dcp = &dc, *dp;
1531     afs_int32 i, j, count;
1532     struct afs_q dlru;
1533
1534     /* Handle the afs_dcaches structs */
1535     if (pnt)
1536         printf("\n\nPrinting afs_dcache related structures...\n");
1537     findsym("afs_cacheFiles", &symoff);
1538     kread(kmem, symoff, (char *)&count, sizeof count);
1539     findsym("afs_indexTable", &symoff);
1540     kread(kmem, symoff, (char *)&table, sizeof(long));
1541     ptr = malloc(count * sizeof(long));
1542     kread(kmem, table, (char *)ptr, count * sizeof(long));
1543     for (i = 0, j = 0; i < count; i++) {
1544         if (dp = (struct dcache *)ptr[i]) {
1545             if (pnt)
1546                 printf("afs_indexTable[%d] %x: ", i, dp);
1547             kread(kmem, (off_t) dp, (char *)dcp, sizeof *dcp);
1548             print_dcache(kmem, dcp, dp, pnt);
1549             j++;
1550         }
1551     }
1552     if (pnt)
1553         printf("... found %d 'dcache' entries\n", j);
1554     findsym("afs_DLRU", &symoff);
1555     kread(kmem, symoff, (char *)&dlru, sizeof(struct afs_q));
1556     if (pnt)
1557         printf("DLRU next=0x%x, prev=0x%x\n", dlru.next, dlru.prev);
1558     free(ptr);
1559
1560     return j;
1561 }
1562
1563
1564 void
1565 print_DindexTimes(int pnt)
1566 {
1567     off_t symoff;
1568     long table;
1569     afs_hyper_t *ptr;
1570     afs_int32 temp, *indexTime = &temp;
1571     afs_int32 i, j, count;
1572
1573     /* Handle the afs_indexTimes array */
1574     if (pnt)
1575         printf("\n\nPrinting afs_indexTimes[]...\n");
1576     findsym("afs_cacheFiles", &symoff);
1577     kread(kmem, symoff, (char *)&count, sizeof count);
1578     findsym("afs_indexTimes", &symoff);
1579     kread(kmem, symoff, (char *)&table, sizeof(long));
1580     ptr = malloc(count * sizeof(afs_hyper_t));
1581     kread(kmem, table, (char *)ptr, count * sizeof(afs_hyper_t));
1582     for (i = 0, j = 0; i < count; i++) {
1583         if (pnt)
1584             printf("afs_indexTimes[%d]\t%10d.%d\n", i, ptr[i].high,
1585                    ptr[i].low);
1586 /*      if (dp = (struct dcache *)ptr[i]) {
1587         printf("afs_indexTable[%d] %lx: ", i, dp);
1588         kread(kmem, (off_t) dp, (char *)dcp, sizeof *dcp);
1589         print_dcache(kmem, dcp, dp);
1590         }
1591 */
1592         j++;
1593     }
1594     if (pnt)
1595         printf("afs_indexTimes has %d entries\n", j);
1596     free(ptr);
1597 }
1598
1599
1600 void
1601 print_DdvnextTbl(int pnt)
1602 {
1603     off_t symoff;
1604     long table;
1605     afs_int32 *ptr;
1606     afs_int32 temp, *indexTime = &temp;
1607     afs_int32 i, j, count;
1608
1609     /* Handle the afs_dvnextTbl arrays */
1610     if (pnt)
1611         printf("\n\nPrinting afs_dvnextTbl[]...\n");
1612     findsym("afs_cacheFiles", &symoff);
1613     kread(kmem, symoff, (char *)&count, sizeof count);
1614     findsym("afs_dvnextTbl", &symoff);
1615     kread(kmem, symoff, (char *)&table, sizeof(long));
1616     ptr = malloc(count * sizeof(afs_int32));
1617     kread(kmem, table, (char *)ptr, count * sizeof(afs_int32));
1618     for (i = 0, j = 0; i < count; i++) {
1619         if (pnt)
1620             printf("afs_dvnextTbl[%d]\t%d\n", i, ptr[i]);
1621         j++;
1622     }
1623     if (pnt)
1624         printf("afs_dvnextTbl has %d entries\n", j);
1625     free(ptr);
1626 }
1627
1628
1629 void
1630 print_DdcnextTbl(int pnt)
1631 {
1632     off_t symoff;
1633     long table;
1634     afs_int32 *ptr;
1635     afs_int32 temp, *indexTime = &temp;
1636     afs_int32 i, j, count;
1637
1638     /* Handle the afs_dcnextTbl arrays */
1639     if (pnt)
1640         printf("\n\nPrinting afs_dcnextTbl[]...\n");
1641     findsym("afs_cacheFiles", &symoff);
1642     kread(kmem, symoff, (char *)&count, sizeof count);
1643     findsym("afs_dcnextTbl", &symoff);
1644     kread(kmem, symoff, (char *)&table, sizeof(long));
1645     ptr = malloc(count * sizeof(afs_int32));
1646     kread(kmem, table, (char *)ptr, count * sizeof(afs_int32));
1647     for (i = 0, j = 0; i < count; i++) {
1648         if (pnt)
1649             printf("afs_dcnextTbl[%d]\t%d\n", i, ptr[i]);
1650         j++;
1651     }
1652     if (pnt)
1653         printf("afs_dcnextTbl has %d entries\n", j);
1654     free(ptr);
1655 }
1656
1657
1658 void
1659 print_DindexFlags(int pnt)
1660 {
1661     off_t symoff;
1662     afs_int32 count;
1663     long table;
1664     unsigned char *flags;
1665     afs_int32 temp, *indexTime = &temp;
1666     afs_int32 i, j;
1667
1668     /* Handle the afs_indexFlags array */
1669     if (pnt)
1670         printf("\n\nPrinting afs_indexFlags[]...\n");
1671     findsym("afs_cacheFiles", &symoff);
1672     kread(kmem, symoff, (char *)&count, sizeof count);
1673     findsym("afs_indexFlags", &symoff);
1674     kread(kmem, symoff, (char *)&table, sizeof(long));
1675     flags = malloc(count * sizeof(char));
1676     kread(kmem, table, flags, count * sizeof(char));
1677     for (i = 0, j = 0; i < count; i++) {
1678         if (pnt)
1679             printf("afs_indexFlags[%d]\t%4u\n", i, flags[i]);
1680         j++;
1681     }
1682     if (pnt)
1683         printf("afs_indexFlags has %d entries\n", j);
1684     free(flags);
1685 }
1686
1687
1688 void
1689 print_buffers(int pnt)
1690 {
1691     off_t symoff;
1692     long table;
1693     afs_int32 count;
1694     unsigned char *buffers;
1695     struct buffer *bp;
1696     afs_int32 i, j;
1697
1698     if (pnt)
1699         printf("\n\nPrinting 'buffers' table...\n");
1700     findsym("Buffers", &symoff);
1701     kread(kmem, symoff, (char *)&table, sizeof(long));
1702     findsym("nbuffers", &symoff);
1703     kread(kmem, symoff, (char *)&count, sizeof(int));
1704     buffers = malloc(count * sizeof(struct buffer));
1705     kread(kmem, table, buffers, count * sizeof(struct buffer));
1706     bp = (struct buffer *)buffers;
1707     for (i = 0, j = 0; i < count; i++, bp++) {
1708 #ifdef AFS_SGI62_ENV
1709         if (pnt)
1710             printf
1711                 ("Buffer #%d:\tfid=%llu page=%d, accTime=%d,\n\tHash=%x, data=%x, lockers=%x, dirty=%d, hashI=%d\n",
1712                  i, bp->fid[0], bp->page, bp->accesstime, bp->hashNext,
1713                  bp->data, bp->lockers, bp->dirty, bp->hashIndex);
1714 #else
1715         if (pnt)
1716             printf
1717                 ("Buffer #%d:\tfid=%lu page=%d, accTime=%d,\n\tHash=%x, data=%x, lockers=%x, dirty=%d, hashI=%d\n",
1718                  i, bp->fid, bp->page, bp->accesstime, bp->hashNext,
1719                  bp->data, bp->lockers, bp->dirty, bp->hashIndex);
1720 #endif
1721         j++;
1722     }
1723     if (pnt)
1724         printf("\n\t   ... that should be %d buffer entries\n", i);
1725 }
1726
1727
1728 int
1729 print_nfss(int pnt)
1730 {
1731     off_t symoff;
1732     struct afs_exporter *exp_entry, ex, *exp = &ex, *exp1;
1733     struct nfsclientpag *afs_nfspags[NNFSCLIENTS], e, *entry = &e, *ep;
1734     long i, j, cell;
1735
1736     /* Handle the afs_exporter structures */
1737     if (pnt)
1738         printf("\n\nPrinting 'afs_exporters' link list...\n");
1739     findsym("root_exported", &symoff);
1740     kread(kmem, symoff, (char *)&cell, sizeof(long));
1741     for (exp1 = (struct afs_exporter *)cell, j = 0; exp1;
1742          exp1 = exp->exp_next, j++) {
1743         kread(kmem, (off_t) exp1, (char *)exp, sizeof *exp);
1744         if (pnt)
1745             printf("AFS_EXPORTER(%x): \n", exp1);
1746         print_exporter(kmem, exp, exp1, pnt);
1747         Sum_exps++;
1748     }
1749     if (pnt)
1750         printf("... found %d 'afs_exporters' entries\n", j);
1751
1752     /* Handle the afs_nfsclientpags structs */
1753     if (pnt)
1754         printf("\n\nPrinting 'afs_nfsclientpags' structures...\n");
1755     if (!findsym("afs_nfspags", &symoff))
1756         return 0;
1757     kread(kmem, symoff, (char *)afs_nfspags, sizeof afs_nfspags);
1758     for (i = 0, j = 0; i < NNFSCLIENTS; i++) {
1759         for (ep = afs_nfspags[i]; ep; ep = entry->next, j++) {
1760             kread(kmem, (off_t) ep, (char *)entry, sizeof *entry);
1761             print_nfsclient(kmem, entry, ep, pnt);
1762         }
1763     }
1764     if (pnt)
1765         printf("... found %d 'afs_nfsclientpags' entries\n", j);
1766     return j;
1767 }
1768
1769 #if defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV)
1770 typedef struct event {
1771     struct event *next;         /* next in hash chain */
1772     char *event;                /* lwp event: an address */
1773     int refcount;               /* Is it in use? */
1774     kcondvar_t cond;            /* Currently associated condition variable */
1775     int seq;                    /* Sequence number: this is incremented
1776                                  * by wakeup calls; wait will not return until
1777                                  * it changes */
1778 } event_t;
1779 #endif
1780
1781
1782 #ifdef AFS_LINUX22_ENV
1783 /* This is replicated from LINUX/osi_alloc.c */
1784 #define MEM_SPACE sizeof(int)
1785
1786 #define KM_TYPE 1
1787 #define VM_TYPE 2
1788 struct osi_linux_mem {
1789     int mem_next;               /* types are or'd into low bits of next */
1790     char data[1];
1791 };
1792 #define MEMTYPE(A) ((A) & 0x3)
1793 #define MEMADDR(A) ((struct osi_linux_mem*)((A) & (~0x3)))
1794 #define PR_MEMTYPE(A) ((MEMTYPE(A) == KM_TYPE) ? "phys" : "virt")
1795 void
1796 print_alloced_memlist(void)
1797 {
1798     off_t symoff;
1799     struct osi_linux_mem *memp, memlist, next;
1800     off_t next_addr;
1801     int count;
1802     int n = 0;
1803
1804     findsym("afs_linux_memlist_size", &symoff);
1805     kread(kmem, symoff, (char *)&count, sizeof count);
1806     findsym("afs_linux_memlist", &symoff);
1807     kread(kmem, symoff, (char *)&memp, sizeof memp);
1808     if (memp) {
1809 #ifdef AFS_LINUX_64BIT_KERNEL
1810         kread(kmem, (unsigned long)memp, (char *)&next, sizeof next);
1811 #else
1812         kread(kmem, (int)memp, (char *)&next, sizeof next);
1813 #endif /* AFS_LINUX_64BIT_KERNEL */
1814     } else {
1815         memset(&next, 0, sizeof next);
1816     }
1817     printf("Allocated memory list: %d elements\n", count);
1818     printf("%20s %4s %10s\n", "Address", "Type", "Next");
1819     printf("%20lx %4s %10x\n", (long)((char *)memp) + MEM_SPACE,
1820            PR_MEMTYPE(next.mem_next), next.mem_next);
1821     n = 1;
1822     while (next_addr = (off_t) MEMADDR(next.mem_next)) {
1823         n++;
1824         memlist = next;
1825         kread(kmem, next_addr, (char *)&next, sizeof next);
1826         printf("%20lx %4s %10x\n", (long)next_addr + MEM_SPACE,
1827                PR_MEMTYPE(next.mem_next), next.mem_next);
1828     }
1829     printf("Found %d elements in allocated memory list, expected %d\n", n,
1830            count);
1831 }
1832 #endif
1833
1834 void
1835 print_allocs(int pnt)
1836 {
1837     off_t symoff;
1838     long count, i, j, k, l, m, n, T = 0, tvs;
1839     struct afs_CMStats afs_cmstats;
1840     struct afs_stats_CMPerf afs_cmperfstats;
1841
1842     findsym("afs_cmstats", &symoff);
1843     kread(kmem, symoff, (char *)&afs_cmstats, sizeof afs_cmstats);
1844     findsym("afs_stats_cmperf", &symoff);
1845     kread(kmem, symoff, (char *)&afs_cmperfstats, sizeof afs_cmperfstats);
1846
1847     T += MAXSYSNAME;
1848     printf("\n\n%20s:\t%8d bytes\n", "Sysname area", MAXSYSNAME);
1849
1850     Sum_cellnames = 0;
1851     i = print_cells(0);
1852     j = (i * sizeof(struct cell)) + Sum_cellnames;
1853     T += j;
1854     printf
1855         ("%20s:\t%8d bytes\t[%d cells/%d bytes each + %d bytes for cell names]\n",
1856          "Cell package", j, i, sizeof(struct cell), Sum_cellnames);
1857
1858     Sum_cellaliases = 0;
1859     i = print_cellaliases(0);
1860     j = (i * sizeof(struct cell_alias)) + Sum_cellaliases;
1861     T += j;
1862     printf
1863         ("%20s:\t%8d bytes\t[%d cell_aliases/%d bytes each + %d bytes for cell names]\n",
1864          "Cell package", j, i, sizeof(struct cell_alias), Sum_cellaliases);
1865
1866     Sum_cellname_names = 0;
1867     i = print_cellnames(0);
1868     j = (i * sizeof(struct cell_name)) + Sum_cellname_names;
1869     T += j;
1870     printf
1871         ("%20s:\t%8d bytes\t[%d cell_names/%d bytes each + %d bytes for cell name strings]\n",
1872          "Cell package", j, i, sizeof(struct cell_name), Sum_cellname_names);
1873
1874     Sum_userstp = 0;
1875     i = print_users(0);
1876     j = (i * sizeof(struct unixuser)) + Sum_userstp;
1877     T += j;
1878     printf
1879         ("%20s:\t%8d bytes\t[%d users/%d bytes each + %d bytes for secret tokens]\n",
1880          "User package", j, i, sizeof(struct unixuser), Sum_userstp);
1881
1882     i = print_servers(0);
1883     j = (i * sizeof(struct server));
1884     T += j;
1885     printf("%20s:\t%8d bytes\t[%d servers/%d bytes each]\n", "Server package",
1886            j, i, sizeof(struct server));
1887     j = (Nconns * sizeof(struct afs_conn));
1888     T += j;
1889     printf("%20s:\t%8d bytes\t[%d conns/%d bytes each]\n",
1890            "Connection package", j, Nconns, sizeof(struct afs_conn));
1891
1892     i = (AFS_NCBRS * sizeof(struct afs_cbr)) * (j =
1893                                                 afs_cmperfstats.
1894                                                 CallBackAlloced);
1895     T += i;
1896     if (i)
1897         printf("%20s:\t%8d bytes\t[%d cbs/%d bytes each]\n",
1898                "Server CB free pool", i, (j * AFS_NCBRS),
1899                sizeof(struct afs_cbr));
1900
1901     Sum_volnames = 0;
1902     i = print_volumes(0);
1903     j = (MAXVOLS * sizeof(struct volume)) + Sum_volnames;
1904     T += j;
1905     printf
1906         ("%20s:\t%8d bytes\t[%d volumes/%d bytes each + %d bytes for volnames - %d active entries]\n",
1907          "Volume package", j, MAXVOLS, sizeof(struct volume), Sum_volnames,
1908          i);
1909
1910     Sum_vcachemvids = Sum_vcachelinkData = Sum_vcacheacc = Sum_vcachelocks =
1911         0;
1912     tvs = i = print_vcaches(0);
1913     j = (i * sizeof(struct vcache));
1914 /*    T += j;*/
1915 /*    printf("%20s:\t%d bytes\t[%d vcaches/%d bytes each]\n", "Vcache package", j, i, sizeof(struct vcache));*/
1916 #ifdef  AFS_AIX32_ENV
1917     i = (tvs + Sum_vcachemvids + Sum_vcachelinkData +
1918          Sum_vcachelocks) * AFS_SMALLOCSIZ;
1919     printf
1920         ("%20s:\t%8d bytes\t[%d act gnodes, %d mount pnts, %d symbolic links, %d unix locks]\n",
1921          "[VC use of sml fp]*", i, tvs, Sum_vcachemvids, Sum_vcachelinkData,
1922          Sum_vcachelocks);
1923 #else
1924     i = (Sum_vcachemvids + Sum_vcachelinkData +
1925          Sum_vcachelocks) * AFS_SMALLOCSIZ;
1926     printf
1927         ("%20s:\t8%d bytes\t[%d mount pnts, %d symbolic links, %d unix locks]\n",
1928          "[VC use of sml fp]*", i, Sum_vcachemvids, Sum_vcachelinkData,
1929          Sum_vcachelocks);
1930 #endif
1931
1932 #define NAXSs (1000 / sizeof(struct axscache))
1933 #ifdef  AFS32
1934     i = (NAXSs * sizeof(struct axscache));
1935     T += i;
1936     printf("%20s:\t%8d bytes\t[%d access used by vcaches/%d bytes each]\n",
1937            "ACL List free pool", i, Sum_vcacheacc, sizeof(struct axscache));
1938 #else
1939     {
1940         struct axscache *xp, xpe, *nxp = &xpe;
1941
1942         findsym("afs_xaxscnt", &symoff);
1943         kread(kmem, symoff, (char *)&i, sizeof i);
1944         j = i * (NAXSs * sizeof(struct axscache));
1945         T += j;
1946         printf
1947             ("%20s:\t%8d bytes\t[%d access used by vcaches/%d bytes each - %d blocks of %d]\n",
1948              "ACL List free pool", j, Sum_vcacheacc, sizeof(struct axscache),
1949              i, (NAXSs * sizeof(struct axscache)));
1950     }
1951 #endif
1952
1953 #ifdef  AFS32
1954     i = print_dcaches(0);
1955     j = (i * sizeof(struct dcache));
1956     T += j;
1957     printf
1958         ("%20s:\t%8d bytes\t[%d dcaches/%d bytes each - ONLY USED COUNTED]\n",
1959          "Dcache package", j, i, sizeof(struct dcache));
1960 #else
1961     findsym("afs_dcentries", &symoff);
1962     kread(kmem, symoff, (char *)&i, sizeof i);
1963     j = (i * sizeof(struct dcache));
1964     T += j;
1965     printf("%20s:\t%8d bytes\t[%d dcaches/%d bytes each]\n", "Dcache package",
1966            j, i, sizeof(struct dcache));
1967 #endif
1968     findsym("afs_cacheFiles", &symoff);
1969     kread(kmem, symoff, (char *)&i, sizeof i);
1970     findsym("afs_cacheStats", &symoff);
1971     kread(kmem, symoff, (char *)&j, sizeof j);
1972
1973     k = (j * sizeof(struct vcache));
1974     printf
1975         ("%20s:\t%8d bytes\t[%d free vcaches/%d bytes each - %d active entries]\n",
1976          "Vcache free list", k, j, sizeof(struct vcache), tvs);
1977     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
1978            "Dcache Index Table", i * 4, i, 4);
1979 #ifndef AFS32
1980     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
1981            "Dcache Index Times", i * 8, i, 8);
1982 #else
1983     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
1984            "Dcache Index Times", i * 4, i, 4);
1985 #endif
1986     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
1987            "Dcache Index Flags", i, i, 1);
1988 /*    printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n", "Dcache free list", i, i, 1);*/
1989 #ifndef AFS32
1990     T += k + (i * 4) + (i * 8) + i;
1991 #else
1992     T += k + (i * 4) + (i * 4) + i;
1993 #endif
1994
1995     i = (j = afs_cmperfstats.bufAlloced) * sizeof(struct buffer);
1996     T += i;
1997     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n", "Buffer package",
1998            i, j, sizeof(struct buffer));
1999 #define AFS_BUFFER_PAGESIZE 2048
2000     i = j * AFS_BUFFER_PAGESIZE;
2001     T += i;
2002     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2003            "Xtra Buffer pkg area", i, j, AFS_BUFFER_PAGESIZE);
2004
2005     Sum_exps = 0;
2006     Sum_nfssysnames = 0;
2007     i = print_nfss(0);
2008     k = Sum_exps * sizeof(struct afs_exporter);
2009     T += k;
2010     if (k)
2011         printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2012                "Xlator Exporter list", k, Sum_exps,
2013                sizeof(struct afs_exporter));
2014
2015     j = (i * sizeof(struct nfsclientpag)) + Sum_nfssysnames;
2016     T += j;
2017     if (j)
2018         printf
2019             ("%20s:\t%8d bytes\t[%d entries/%d bytes each + %d for remote sysnames]\n",
2020              "Xlator Nfs clnt pkg", j, i, sizeof(struct nfsclientpag),
2021              Sum_nfssysnames);
2022
2023     i = (j = afs_cmperfstats.LargeBlocksAlloced) * AFS_LRALLOCSIZ;
2024     T += i;
2025     printf
2026         ("%20s:\t%8d bytes\t[%d entries/%d bytes each - %d active entries]\n",
2027          "Large Free Pool", i, j, AFS_LRALLOCSIZ,
2028          afs_cmperfstats.LargeBlocksActive);
2029
2030     i = (j = afs_cmperfstats.SmallBlocksAlloced) * AFS_SMALLOCSIZ;
2031     T += i;
2032     printf
2033         ("%20s:\t%8d bytes\t[%d entries/%d bytes each - %d active entries]\n",
2034          "Small Free Pool", i, j, AFS_SMALLOCSIZ,
2035          afs_cmperfstats.SmallBlocksActive);
2036
2037 #if defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV)
2038     findsym("afs_evhashcnt", &symoff);
2039     kread(kmem, symoff, (char *)&j, sizeof j);
2040     i = (j * sizeof(event_t));
2041     T += i;
2042     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2043            "afs glock Event Pool", i, j, sizeof(event_t));
2044 /*    printf("XXXXXXX Count event queue allocs!!!! XXXXXX\n");*/
2045
2046 #endif
2047     i = j = 0;
2048     if (findsym("rxevent_nFree", &symoff))
2049         kread(kmem, symoff, (char *)&j, sizeof j);
2050     if (findsym("rxevent_nPosted", &symoff))
2051         kread(kmem, symoff, (char *)&i, sizeof i);
2052     k = (i + j) * sizeof(struct rxevent);
2053     if (k) {
2054         T += k;
2055         printf("%20s:\t%8d bytes\t[%d free, %d posted/%d bytes each]\n",
2056                "Rx event pkg", k, j, i, sizeof(struct rxevent));
2057     } else {
2058         T += (k = 20 * sizeof(struct rxevent));
2059         printf
2060             ("%20s:\t%8d bytes\t[%d entries/%d bytes each - THIS IS MIN ALLOC/NOT ACTUAL]\n",
2061              "Rx event pkg", k, 20, sizeof(struct rxevent));
2062     }
2063
2064     findsym("rx_nFreePackets", &symoff);
2065     kread(kmem, symoff, (char *)&count, sizeof count);
2066 /*
2067     findsym("rx_initSendWindow", &symoff);
2068     kread(kmem, symoff, (char *) &i, sizeof i);
2069 */
2070     i = 0;
2071     findsym("rx_nPackets", &symoff);
2072     kread(kmem, symoff, (char *)&j, sizeof j);
2073     k = (j + i + 2) * sizeof(struct rx_packet);
2074     T += k;
2075     printf("%20s:\t%8d bytes\t[%d free packets/%d bytes each]\n",
2076            "Rx packet freelist", k, count, sizeof(struct rx_packet));
2077 #define rx_hashTableSize 256    /* XXX */
2078     i = (rx_hashTableSize * sizeof(struct rx_connection *));
2079     j = (rx_hashTableSize * sizeof(struct rx_peer *));
2080     k = i + j;
2081     T += k;
2082     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2083            "Rx conn/peer tables", k, rx_hashTableSize,
2084            sizeof(struct rx_connection *));
2085
2086     findsym("rxi_Alloccnt", &symoff);
2087     kread(kmem, symoff, (char *)&j, sizeof j);
2088     findsym("rxi_Allocsize", &symoff);
2089     kread(kmem, symoff, (char *)&i, sizeof i);
2090     T += i;
2091     printf("%20s:\t%8d bytes\t[%d outstanding allocs]\n", "RX misc allocs", i,
2092            j);
2093
2094
2095     j = afs_cmperfstats.OutStandingMemUsage;
2096     printf("\n\n%20s:\t%8d bytes\n", "Mem used by afs", j);
2097     printf("%20s:\t%8d bytes\n", "Accounted-for mem", T);
2098     printf("%20s:\t%8d bytes\n", "Non acc'd-for mem", j - T);
2099
2100     printf
2101         ("\n\nNOTE:\n\tAll [...]* entries above aren't counted towards the total mem since they're redundant\n");
2102
2103 #ifdef AFS_LINUX22_ENV
2104     if (pnt)
2105         print_alloced_memlist();
2106 #endif
2107 }
2108
2109 #if     defined(sparc) && !defined(__linux__)
2110 int
2111 readmem(kmem, buf, vad, len)
2112      int kmem, len;
2113 #ifdef AFS_SUN5_ENV
2114      uintptr_t vad;
2115 #else
2116      int vad;
2117 #endif          /** AFS_SUN5_ENV **/
2118      char *buf;
2119 {
2120     int newlen;
2121     if ((newlen = kvm_kread(kd, vad, buf, len)) != len) {
2122         printf("Couldn't process dumpfile with supplied namelist %s\n", obj);
2123         exit(1);
2124     }
2125 }
2126 #endif
2127
2128 #ifndef AFS_KDUMP_LIB
2129 void
2130 kread(int kmem, off_t loc, void *buf, KDUMP_SIZE_T len)
2131 {
2132     int i;
2133
2134     memset(buf, 0, len);
2135
2136 #if     defined(sparc) && !defined(__linux__)
2137 #ifndef AFS_SUN5_ENV
2138     if (mem) {
2139 #endif
2140         readmem(kmem, buf, (off_t) loc, len);
2141         return;
2142 #ifndef AFS_SUN5_ENV
2143     }
2144 #endif
2145 #endif
2146 #if     ! defined(AFS_SUN5_ENV)
2147 #if defined(AFS_SGI61_ENV) && !defined(AFS_32BIT_KERNEL_ENV)
2148     if (lseek64(kmem, loc, L_SET /*0 */ ) != loc)
2149 #else
2150     if (lseek(kmem, loc, L_SET /*0 */ ) != loc)
2151 #endif
2152     {
2153         perror("lseek");
2154         exit(1);
2155     }
2156     if (loc == 0)
2157         printf("WARNING: Read failed: loc=0\n");
2158     else
2159         if ((i = read(kmem, buf, len)) != len) {
2160             printf("WARNING: Read failed: ");
2161             if (sizeof(loc) > sizeof(long)) {
2162                 printf("loc=%llx", loc);
2163             } else {
2164                 printf("loc=%lx", (long)loc);
2165             }
2166             printf(", buf=%lx, len=%ld, i=%d, errno=%d\n", (long)buf,
2167                    (long)len, i, errno);
2168             return;                     /*exit(1); */
2169         }
2170 #endif
2171 }
2172 #endif /* AFS_KDUMP_LIB */
2173
2174 #ifdef  AFS_SUN5_ENV
2175
2176 /**
2177   * When examining the dump of a 64 bit kernel, we use this function to
2178   * read symbols. The function opencore() calls this or rdsymbols() using
2179   * the macro RDSYMBOLS
2180   */
2181
2182 void
2183 rdsymbols(void)
2184 {
2185
2186     FILE *fp;
2187     Elf *efd;
2188     Elf_Scn *cn = NULL;
2189 #ifdef  _LP64
2190     Elf64_Shdr *shdr;
2191     Elf64_Sym *stbl, *p1, *p2;
2192     Elf64_Shdr *(*elf_getshdr) (Elf_Scn *) = elf64_getshdr;
2193 #else
2194     Elf32_Shdr *shdr;
2195     Elf32_Sym *stbl, *p1, *p2;
2196     Elf32_Shdr *(*elf_getshdr) (Elf_Scn *) = elf32_getshdr;
2197 #endif
2198     Elf_Data *dp = NULL, *sdp = NULL;
2199
2200     int nsyms, i, fd;
2201
2202     if (!(fp = fopen(obj, "r"))) {
2203         printf("Can't open %s (%d)\n", core, errno);
2204         exit(1);
2205     }
2206
2207     fd = fileno(fp);
2208     lseek(fd, 0L, 0);
2209     if ((efd = elf_begin(fd, ELF_C_READ, 0)) == NULL) {
2210         printf("Can't elf begin (%d)\n", errno);
2211         exit(1);
2212     }
2213     while (cn = elf_nextscn(efd, cn)) {
2214         if ((shdr = elf_getshdr(cn)) == NULL) {
2215             elf_end(efd);
2216             printf("Can't read section header (%d)\n", errno);
2217             exit(1);
2218         }
2219         if (shdr->sh_type == SHT_SYMTAB)
2220             break;
2221     }
2222     dp = elf_getdata(cn, dp);
2223     p1 = stbl = (void *)dp->d_buf;
2224     nsyms = dp->d_size / sizeof(*stbl);
2225     cn = elf_getscn(efd, shdr->sh_link);
2226     sdp = elf_getdata(cn, sdp);
2227     tblp = malloc(sdp->d_size);
2228     memcpy(tblp, sdp->d_buf, sdp->d_size);
2229     p2 = tbl = malloc(nsyms * sizeof(*stbl));
2230     for (i = 0, scnt = 0; i < nsyms; i++, p1++, p2++) {
2231         p2->st_name = p1->st_name;
2232         p2->st_value = p1->st_value;
2233         p2->st_size = p1->st_size;
2234         p2->st_info = p1->st_info;
2235         p2->st_shndx = p1->st_shndx;
2236         scnt++;
2237     }
2238     elf_end(efd);
2239     close(fd);
2240 }
2241
2242 #endif          /** AFS_SUN5_ENV **/
2243
2244
2245 int
2246 opencore(char *core)
2247 {
2248 #ifdef AFS_KDUMP_LIB
2249     return 0;
2250 #else /* AFS_KDUMP_LIB */
2251     int fd;
2252
2253 #if     defined(sparc) && !defined(__linux__)
2254 #ifndef AFS_SUN5_ENV
2255     if (mem) {
2256 #endif
2257
2258         if ((kd = kvm_open(obj, core, NULL, O_RDONLY, "crash")) == NULL) {
2259             printf("Can't open kvm - core file %s\n", core);
2260             exit(1);
2261         }
2262 #ifndef AFS_SUN5_ENV
2263     } else
2264 #endif
2265 #ifdef  AFS_SUN5_ENV
2266         rdsymbols();
2267 #endif
2268 #endif /* sparc */
2269
2270     {
2271         if ((fd = open(core, O_RDONLY)) < 0) {
2272             perror(core);
2273             exit(1);
2274         }
2275         return fd;
2276     }
2277 #endif /* AFS_KDUMP_LIB */
2278 }
2279
2280
2281 void
2282 print_exporter(int kmem, struct afs_exporter *exporter,
2283                struct afs_exporter *ptr, int pnt)
2284 {
2285     if (pnt) {
2286         printf("\tstates=%x, type=%x, *data=%lx\n", exporter->exp_states,
2287                exporter->exp_type, exporter->exp_data);
2288         printf
2289             ("\texp_stats (calls=%d, rejectedcalls=%d, nopag=%d, invalidpag=%d)\n",
2290              exporter->exp_stats.calls, exporter->exp_stats.rejectedcalls,
2291              exporter->exp_stats.nopag, exporter->exp_stats.invalidpag);
2292     }
2293 }
2294
2295
2296 void
2297 print_nfsclient(int kmem, struct nfsclientpag *ep,
2298                 struct nfsclientpag *ptr, int pnt)
2299 {
2300     char sysname[100];
2301         int count;
2302
2303     if (pnt)
2304         printf("%lx: uid=%d, host=%x, pag=%x, lastt=%d, ref=%d count=%d\n",
2305                ptr, ep->uid, ep->host, ep->pag,
2306                ep->lastcall, ep->refCount, ep->sysnamecount);
2307
2308         for(count = 0; count < ep->sysnamecount; count++){
2309                 kread(kmem, (off_t) ep->sysname[count], sysname, (KDUMP_SIZE_T) 30);
2310                 printf("   %lx: @sys[%d]=%s\n",
2311                         ep->sysname[count], count, sysname);
2312                 Sum_nfssysnames += MAXSYSNAME;
2313         }
2314 }
2315
2316
2317 #if     defined(AFS_SUN5_ENV)
2318 void
2319 pmutex(char *sp, kmutex_t *mp)
2320 {
2321 }
2322
2323 #endif
2324
2325 void
2326 print_unixuser(int kmem, struct unixuser *uep,
2327                struct unixuser *ptr, int pnt)
2328 {
2329     Sum_userstp += uep->stLen;
2330     if (pnt) {
2331         printf
2332             ("%lx: uid=x%x, cell=%x, vid=%d, refc=%d, states=%x, tokTime=%d, tikLen=%d\n",
2333              ptr, uep->uid, uep->cell, uep->vid, uep->refCount, uep->states,
2334              uep->tokenTime, uep->stLen);
2335         printf
2336             ("\tstp=%lx, clearTok[Han=x%x, x<%x,%x,%x,%x,%x,%x,%x,%x>, vid=%d, Bt=%d, Et=%d], exporter=%lx\n",
2337              uep->stp, uep->ct.AuthHandle, uep->ct.HandShakeKey[0],
2338              uep->ct.HandShakeKey[1], uep->ct.HandShakeKey[2],
2339              uep->ct.HandShakeKey[3], uep->ct.HandShakeKey[4],
2340              uep->ct.HandShakeKey[5], uep->ct.HandShakeKey[6],
2341              uep->ct.HandShakeKey[7], uep->ct.ViceId, uep->ct.BeginTimestamp,
2342              uep->ct.EndTimestamp, uep->exporter);
2343     }
2344 }
2345
2346 void
2347 print_cell(int kmem, struct cell *clep, struct cell *ptr, int pnt)
2348 {
2349     int i;
2350     char cellName[100];
2351     struct in_addr in;
2352
2353
2354     kread(kmem, (off_t) clep->cellName, cellName, (KDUMP_SIZE_T) 40);
2355     cellName[40] = 0;
2356     Sum_cellnames += strlen(cellName) + 1;
2357     if (pnt) {
2358         printf
2359             ("%lx: cellname=%s, states=%x, cnum=%d, cindex=%d fsport=%d vlport=%d timeout=%d cnamep=%x\n",
2360              ptr, cellName, clep->states, clep->cellNum, clep->cellIndex,
2361              clep->fsport, clep->vlport, clep->timeout, clep->cnamep);
2362 #ifdef  AFS33
2363         if (clep->lcellp)
2364             printf("\tlinked cellp %lx\n", clep->lcellp);
2365 #endif
2366         printf("\tCell's servers: ");
2367         for (i = 0; i < AFS_MAXCELLHOSTS; i++) {
2368             if (pretty && (clep->cellHosts[i] == 0))
2369                 break;
2370             printf("[%lx] ", clep->cellHosts[i]);
2371         }
2372         printf("\n");
2373     }
2374 }
2375
2376
2377 void
2378 print_server(int kmem, struct server *sep, struct server *ptr, int conns,
2379              int pnt)
2380 {
2381     struct srvAddr sa, *sap = &sa, *sap1;
2382     int j, mh = 0, cnt;
2383
2384     if (conns != 2 && pnt) {
2385         printf
2386             ("%lx: cell=%lx, addr=%lx, flags=0x%x, actTime=%x, lastDownS=%x, numDownIn=%d, sumofDownt=%d\n",
2387              ptr, sep->cell, sep->addr, sep->flags, sep->activationTime,
2388              sep->lastDowntimeStart, sep->numDowntimeIncidents,
2389              sep->sumOfDowntimes);
2390         if (sep->flags & SRVR_MULTIHOMED) {
2391             if (pnt) {
2392                 printf
2393                     ("\tuuid=[%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x]  addr_uniquifier=%x\n",
2394                      sep->sr_uuid.time_low, sep->sr_uuid.time_mid,
2395                      sep->sr_uuid.time_hi_and_version,
2396                      sep->sr_uuid.clock_seq_hi_and_reserved,
2397                      sep->sr_uuid.clock_seq_low, sep->sr_uuid.node[0],
2398                      sep->sr_uuid.node[1], sep->sr_uuid.node[2],
2399                      sep->sr_uuid.node[3], sep->sr_uuid.node[4],
2400                      sep->sr_uuid.node[5], sep->sr_addr_uniquifier);
2401             }
2402             mh = 1;
2403         }
2404         for (j = 0, cnt = 1, sap1 = sep->addr; sap1;
2405              sap1 = sap->next_sa, j++, cnt++) {
2406             kread(kmem, (off_t) sap1, (char *)sap, sizeof(*sap));
2407             if (pnt) {
2408                 if (mh) {
2409                     printf
2410                         ("\t   #%d ip-addr(%lx): [sa_ip=%s, sa_port=%d, sa_iprank=%d, sa_flags=%x, conns=%lx, server=%lx, next_bkt=%lx]\n",
2411                          cnt, sap1, PrintIPAddr(sap->sa_ip), sap->sa_portal,
2412                          sap->sa_iprank, sap->sa_flags, sap->conns,
2413                          sap->server, sap->next_bkt);
2414                 } else {
2415                     printf
2416                         ("\t[sa_ip=%s, sa_port=%d, sa_iprank=%d, sa_flags=%x, conns=%lx, server=%lx, nexth=%lx]\n",
2417                          PrintIPAddr(sap->sa_ip), sap->sa_portal,
2418                          sap->sa_iprank, sap->sa_flags, sap->conns,
2419                          sap->server, sap->next_bkt);
2420                 }
2421             }
2422         }
2423     }
2424     if (sep->cbrs && pnt) {
2425         struct afs_cbr cba, *cbsap = &cba, *cbsap1;
2426
2427         printf(" Callbacks to be returned:\n");
2428         for (j = 0, cbsap1 = sep->cbrs; cbsap1; cbsap1 = cbsap->next, j++) {
2429             kread(kmem, (off_t) cbsap1, (char *)cbsap, sizeof(*cbsap));
2430             printf("     #%2d) %lx [v=%d, n=%d, u=%d]\n", j, cbsap1,
2431                    cbsap->fid.Volume, cbsap->fid.Vnode, cbsap->fid.Unique);
2432         }
2433     }
2434     if (conns) {
2435         for (j = 0, sap1 = sep->addr; sap1; sap1 = sap->next_sa, j++) {
2436             kread(kmem, (off_t) sap1, (char *)sap, sizeof(*sap));
2437             print_conns(kmem, sap1, sap->conns, conns, pnt);
2438         }
2439     } else if (pnt)
2440         printf("\n");
2441 }
2442
2443
2444 void
2445 print_conns(int kmem, struct srvAddr *srv, struct afs_conn *conns, int Con,
2446             int pnt)
2447 {
2448     struct afs_conn *cep, ce, *centry = &ce;
2449     int i = 1;
2450
2451     cep = (struct afs_conn *)conns;
2452     if (pnt && Con != 2) {
2453         if (cep)
2454             printf("\tRPC connections for server %lx:\n", srv);
2455         else
2456             printf("\tNO RPC connections for server %x\n", srv);
2457     }
2458     for (; cep; cep = centry->next, Nconns++, i++) {
2459         if (pnt && Con != 2)
2460             printf("\t   #%d> ", i);
2461         kread(kmem, (off_t) cep, (char *)centry, sizeof *centry);
2462         print_conn(kmem, centry, cep, pnt);
2463     }
2464 }
2465
2466
2467 void
2468 print_conn(int kmem, struct afs_conn *conns, struct afs_conn *ptr, int pnt)
2469 {
2470     if (!pnt)
2471         return;
2472     printf("%lx: user=%lx, rx=%lx, srvr=%lx, ref=%d, port=%d, forceC=%d\n",
2473            ptr, conns->user, conns->id, conns->srvr, conns->refCount,
2474            conns->port, conns->forceConnectFS);
2475
2476 }
2477
2478
2479 void
2480 print_volume(int kmem, struct volume *vep, struct volume *ptr, int pnt)
2481 {
2482     int i;
2483     afs_int32 *loc;
2484     char Volname[100];
2485
2486
2487
2488     loc = (afs_int32 *) & vep->lock;
2489     if (vep->name) {
2490         kread(kmem, (off_t) vep->name, Volname, (KDUMP_SIZE_T) 40);
2491         Sum_volnames += strlen(Volname) + 1;
2492     }
2493     if (!pnt)
2494         return;
2495     printf("%lx: cell=%x, vol=%d, name=%s, roVol=%d, backVol=%d\n", ptr,
2496            vep->cell, vep->volume, (vep->name ? Volname : "nil"), vep->roVol,
2497            vep->backVol);
2498 #ifdef  AFS33
2499     printf
2500         ("\trwVol=%d, setupTime=%d, copyDate=%d, expTime=%d, vtix=%d, refC=%d, states=%x\n",
2501          vep->rwVol, vep->setupTime, vep->copyDate, vep->expireTime,
2502          vep->vtix, vep->refCount, vep->states);
2503 #else
2504     printf
2505         ("\trwVol=%d, setupTime=%d, copyDate=%d, vtix=%d, refC=%d, states=%x\n",
2506          vep->rwVol, vep->setupTime, vep->copyDate, vep->vtix, vep->refCount,
2507          vep->states);
2508 #endif
2509     printf("\tVolume's statuses: ");
2510     for (i = 0; i < AFS_MAXHOSTS && vep->serverHost[i]; i++)
2511         printf("[%d] ", vep->status[i]);
2512     printf("\n");
2513
2514     printf("\tVolume's servers: ");
2515     for (i = 0; i < AFS_MAXHOSTS && vep->serverHost[i]; i++)
2516         printf("[%lx] ", vep->serverHost[i]);
2517     printf("\n");
2518
2519     print_venusfid("\tdotdot", &vep->dotdot);
2520     printf("\n");
2521
2522     print_venusfid("\tmtpnt", &vep->mtpoint);
2523     printf("\n");
2524
2525 #ifdef  AFS33
2526     if (vep->rootVnode)
2527         printf("\trootVnode = %d, rootUnique = %d\n", vep->rootVnode,
2528                vep->rootUnique);
2529 #endif
2530     printf("\tlock=0x%x\n", *loc);
2531 }
2532
2533
2534 void
2535 print_venusfid(char *string, struct VenusFid *vid)
2536 {
2537     printf("%s(c=%x, v=%d, n=%d, u=%d)", string, vid->Cell, vid->Fid.Volume,
2538            vid->Fid.Vnode, vid->Fid.Unique);
2539 }
2540
2541
2542 void
2543 print_vnode(int kmem, struct vnode *vep, struct vnode *ptr, int pnt)
2544 {
2545 #ifdef AFS_AIX_ENV
2546     struct gnode gnode;
2547     struct gnode *save_gnode;
2548 #endif /* AFS_AIX_ENV */
2549
2550     if (!pnt)
2551         return;
2552     printf("\n");
2553 #ifdef AFS_AIX_ENV
2554     save_gnode = vep->v_gnode;
2555     kread(kmem, (off_t) save_gnode, (char *)&gnode, sizeof(struct gnode));
2556     vep->v_gnode = &gnode;
2557 #endif /* AFS_AIX_ENV */
2558
2559 #ifdef  AFS_SUN5_ENV
2560     printf("%x: v_type=%d, v_flag=%d, v_count=%d, \n", ptr, vep->v_type,
2561            vep->v_flag, vep->v_count);
2562     printf
2563         ("\tv_v_stream=%x, v_pages=0x%x, v_mountdhere=%d, v_rdev=%d, v_vfsp=0x%x, v_filocks=0x%x\n",
2564          vep->v_stream, vep->v_pages, vep->v_vfsmountedhere, vep->v_rdev,
2565          vep->v_vfsp, vep->v_filocks);
2566     pmutex("\tVnode", &vep->v_lock);
2567     printf("\tCond v: 0x%x\n", vep->v_cv);
2568 #endif
2569 #ifdef AFS_AIX_ENV
2570     vep->v_gnode = save_gnode;
2571 #endif /* AFS_AIX_ENV */
2572 #ifdef AFS_SGI65_ENV
2573 #if defined(AFS_32BIT_KERNEL_ENV)
2574     printf("%lx: v_mreg=0x%lx", ptr, vep->v_mreg);
2575 #else
2576     printf("%llx: v_mreg=0x%llx", ptr, vep->v_mreg);
2577 #endif
2578     printf(", v_mregb=0x%lx\n", vep->v_mregb);
2579 #endif
2580 #ifdef AFS_LINUX22_ENV
2581     /* Print out the stat cache and other inode info. */
2582     printf
2583         ("\ti_ino=%d, i_mode=%x, i_nlink=%d, i_uid=%d, i_gid=%d, i_size=%d\n",
2584          vep->i_ino, vep->i_mode, vep->i_nlink, vep->i_uid, vep->i_gid,
2585          vep->i_size);
2586 #ifdef AFS_LINUX24_ENV
2587     printf
2588         ("\ti_atime=%u, i_mtime=%u, i_ctime=%u, i_version=%u, i_nrpages=%u\n",
2589          vep->i_atime, vep->i_mtime, vep->i_ctime, vep->i_version,
2590          vep->i_data.nrpages);
2591 #else
2592     printf
2593         ("\ti_atime=%u, i_mtime=%u, i_ctime=%u, i_version=%u, i_nrpages=%u\n",
2594          vep->i_atime, vep->i_mtime, vep->i_ctime, vep->i_version,
2595          vep->i_nrpages);
2596 #endif
2597 #ifdef AFS_LINUX26_ENV
2598     printf("\ti_op=0x%x, i_rdev=0x%x, i_sb=0x%x\n", vep->i_op,
2599            vep->i_rdev, vep->i_sb);
2600 #else /* AFS_LINUX26_ENV */
2601     printf("\ti_op=0x%x, i_dev=0x%x, i_rdev=0x%x, i_sb=0x%x\n", vep->i_op,
2602            vep->i_dev, vep->i_rdev, vep->i_sb);
2603 #endif /* AFS_LINUX26_ENV */
2604 #ifdef AFS_LINUX24_ENV
2605     printf("\ti_sem: count=%d, sleepers=%d, wait=0x%x\n", vep->i_sem.count,
2606            vep->i_sem.sleepers, vep->i_sem.wait);
2607 #else
2608     printf("\ti_sem: count=%d, waking=%d, wait=0x%x\n", vep->i_sem.count,
2609            vep->i_sem.waking, vep->i_sem.wait);
2610 #endif
2611 #ifdef AFS_LINUX26_ENV
2612     printf("\ti_hash=0x%x:0x%x, i_list=0x%x:0x%x, i_dentry=0x%x:0x%x\n",
2613            vep->i_hash.pprev, vep->i_hash.next, vep->i_list.prev,
2614            vep->i_list.next, vep->i_dentry.prev, vep->i_dentry.next);
2615 #else /* AFS_LINUX26_ENV */
2616     printf("\ti_hash=0x%x:0x%x, i_list=0x%x:0x%x, i_dentry=0x%x:0x%x\n",
2617            vep->i_hash.prev, vep->i_hash.next, vep->i_list.prev,
2618            vep->i_list.next, vep->i_dentry.prev, vep->i_dentry.next);
2619 #endif /* AFS_LINUX26_ENV */
2620 #endif /* AFS_LINUX22_ENV */
2621 }
2622
2623 void
2624 print_vcache(int kmem, struct vcache *vep, struct vcache *ptr, int pnt)
2625 {
2626     long *loc, j = 0;
2627     char *cloc;
2628     struct VenusFid vid;
2629     struct axscache acc, *accp = &acc, *acp;
2630     struct SimpleLocks sl, *slcp = &sl, *slp;
2631     char linkchar;
2632
2633     if (vep->mvid) {
2634         kread(kmem, (off_t) vep->mvid, (char *)&vid, sizeof(struct VenusFid));
2635         Sum_vcachemvids++;
2636     }
2637     if (vep->linkData)
2638         Sum_vcachelinkData++;
2639     loc = (long *)&vep->lock;
2640
2641     if (pnt) {
2642         if (!Dvnodes)
2643             printf("\n");
2644 #ifdef  AFS33
2645         printf("%lx: refC=%d, pv=%d, pu=%d, flushDv=%d.%d, mapDV=%d.%d, ",
2646                ptr, VREFCOUNT(vep), vep->parentVnode, vep->parentUnique,
2647                vep->flushDV.high, vep->flushDV.low, vep->mapDV.high,
2648                vep->mapDV.low);
2649 #ifdef AFS_64BIT_CLIENT
2650         printf
2651             ("truncPos=(0x%x, 0x%x),\n\tcallb=x%lx, cbE=%d, opens=%d, XoW=%d, ",
2652              (int)(vep->truncPos >> 32), (int)(vep->truncPos & 0xffffffff),
2653              vep->callback, vep->cbExpires, vep->opens, vep->execsOrWriters);
2654 #else /* AFS_64BIT_CLIENT */
2655         printf("truncPos=%d,\n\tcallb=x%lx, cbE=%d, opens=%d, XoW=%d, ",
2656                vep->truncPos, vep->callback, vep->cbExpires, vep->opens,
2657                vep->execsOrWriters);
2658 #endif /* AFS_64BIT_CLIENT */
2659         printf("flcnt=%d, mvstat=%d\n", vep->flockCount, vep->mvstat);
2660         printf("\tstates=x%x, ", vep->states);
2661 #ifdef  AFS_SUN5_ENV
2662         printf("vstates=x%x, ", vep->vstates);
2663 #endif /* AFS_SUN5_ENV */
2664         printf("dchint=%x, anyA=0x%x\n", vep->dchint, vep->anyAccess);
2665 #ifdef AFS_64BIT_CLIENT
2666         printf
2667             ("\tmstat[len=(0x%x, 0x%x), DV=%d.%d, Date=%d, Owner=%d, Group=%d, Mode=0%o, linkc=%d]\n",
2668              (int)(vep->m.Length >> 32), (int)(vep->m.Length & 0xffffffff),
2669              vep->m.DataVersion.high, vep->m.DataVersion.low, vep->m.Date,
2670              vep->m.Owner, vep->m.Group, vep->m.Mode, vep->m.LinkCount);
2671 #else /* AFS_64BIT_CLIENT */
2672         printf("\tquick[dc=%x, stamp=%x, f=%x, min=%d, len=%d]\n",
2673                vep->quick.dc, vep->quick.stamp, vep->quick.f,
2674                vep->quick.minLoc, vep->quick.len);
2675         printf
2676             ("\tmstat[len=%d, DV=%d.%d, Date=%d, Owner=%d, Group=%d, Mode=0%o, linkc=%d]\n",
2677              vep->m.Length, vep->m.DataVersion.high, vep->m.DataVersion.low,
2678              vep->m.Date, vep->m.Owner, vep->m.Group, vep->m.Mode,
2679              vep->m.LinkCount);
2680 #endif /* AFS_64BIT_CLIENT */
2681 #else /* AFS33 */
2682         printf
2683             ("%x: refC=%d, pv=%d, pu=%d, flushDv=%d, mapDV=%d, truncPos=%d\n",
2684              ptr, vep->vrefCount, vep->parentVnode, vep->parentUnique,
2685              vep->flushDV, vep->mapDV, vep->truncPos);
2686         printf("\tcallb=x%x, cbE=%d, opens=%d, XoW=%d, flcnt=%d, mvstat=%d\n",
2687                vep->callback, vep->cbExpires, vep->opens, vep->execsOrWriters,
2688                vep->flockCount, vep->mvstat);
2689         printf("\tstates=x%x, dchint=%x, anyA=0x%x\n", vep->states,
2690                vep->h1.dchint, vep->anyAccess);
2691         printf
2692             ("\tmstat[len=%d, DV=%d, Date=%d, Owner=%d, Group=%d, Mode=%d, linkc=%d]\n",
2693              vep->m.Length, vep->m.DataVersion, vep->m.Date, vep->m.Owner,
2694              vep->m.Group, vep->m.Mode, vep->m.LinkCount);
2695 #endif /* AFS33 */
2696 #ifdef  AFS_AIX32_ENV
2697         loc = (afs_int32 *) & vep->pvmlock;
2698         printf("\tpvmlock=x%x, segid=%X, credp=%lx\n", *loc, vep->segid,
2699                vep->credp);
2700 #endif
2701         printf
2702             ("\tlock [wait=%x excl=%x readers=%x #waiting=%x last_reader=%d writer=%d src=%d]\n",
2703              vep->lock.wait_states, vep->lock.excl_locked,
2704              vep->lock.readers_reading, vep->lock.num_waiting,
2705              vep->lock.pid_last_reader, vep->lock.pid_writer,
2706              vep->lock.src_indicator);
2707         print_venusfid("\tfid", &vep->fid);
2708         if (vep->mvid) {
2709             printf(" ");
2710             print_venusfid("mvid", &vid);
2711         }
2712         printf("\n");
2713     }
2714     if (vep->Access) {
2715         if (pnt)
2716             printf("\tAccess Link list: %x\n", vep->Access);
2717         for (j = 0, acp = vep->Access; acp; acp = accp->next, j++) {
2718             kread(kmem, (off_t) acp, (char *)accp, sizeof(*accp));
2719             Sum_vcacheacc++;
2720             if (pnt)
2721                 printf("\t   %lx: %d) uid=0x%x, access=0x%x, next=%lx\n", acp,
2722                        j, accp->uid, accp->axess, accp->next);
2723         }
2724     }
2725     if (vep->slocks) {
2726         if (pnt)
2727             printf("\tLocking Link list: %lx\n", vep->slocks);
2728     }
2729 #ifdef  AFS33
2730     if (pnt)
2731         printf("\tCallbacks queue prev= %lx next= %lx\n", vep->callsort.prev,
2732                vep->callsort.next);
2733 #endif
2734     printf("\tvlruq.prev=%lx, vlruq.next=%lx\n", vep->vlruq.prev,
2735            vep->vlruq.next);
2736
2737     /* For defect 7733 - Print linkData field for symlinks */
2738     if (pnt) {
2739         if (vep->linkData) {
2740             cloc = (char *)vep->linkData;
2741             printf("\tSymlink information = '");
2742             while (1) {
2743                 kread(kmem, (off_t) cloc, &linkchar, (KDUMP_SIZE_T) 1);
2744                 cloc++;
2745                 if (linkchar == '\0') {
2746                     printf("'\n");
2747                     break;
2748                 } else {
2749                     printf("%c", linkchar);
2750                 }
2751             }
2752         }
2753     }
2754 #ifdef AFS_LINUX22_ENV
2755     printf("\tmapcnt=%d\n", vep->mapcnt);
2756 #endif
2757 }
2758
2759
2760 void
2761 print_dcache(int kmem, struct dcache *dcp, struct dcache *dp, int pnt)
2762 {
2763     if (!pnt)
2764         return;
2765     printf("%lx: ", dp);
2766     print_venusfid(" fid", &dcp->f.fid);
2767     printf("refcnt=%d, dflags=%x, mflags=%x, validPos=%d\n", dcp->refCount,
2768            dcp->dflags, dcp->mflags, dcp->validPos);
2769
2770 #ifdef  AFS33
2771     printf("\tf.modtime=%d, f.versNo=%d.%d\n", dcp->f.modTime,
2772            dcp->f.versionNo.high, dcp->f.versionNo.low);
2773 #else
2774     printf("\tf.hvn=%d, f.hcn=%d, f.modtime=%d, f.versNo=%d\n",
2775            dcp->f.hvNextp, dcp->f.hcNextp, dcp->f.modTime, dcp->f.versionNo);
2776 #endif
2777 #ifdef AFS_SGI62_ENV
2778     printf
2779         ("\tf.chunk=%d, f.inode=%" AFS_INT64_FMT ", f.chunkBytes=%d, f.states=%x",
2780          dcp->f.chunk, dcp->f.inode, dcp->f.chunkBytes, dcp->f.states);
2781 #else
2782     printf
2783         ("\tf.chunk=%d, f.inode=%d, f.chunkBytes=%d, f.states=%x\n",
2784          dcp->f.chunk, dcp->f.inode, dcp->f.chunkBytes, dcp->f.states);
2785 #endif
2786     printf("\tlruq.prev=%lx, lruq.next=%lx, index=%d\n",
2787            dcp->lruq.prev, dcp->lruq.next, dcp->index);
2788 }
2789
2790 void
2791 print_bkg(int kmem)
2792 {
2793     off_t symoff;
2794     struct brequest afs_brs[NBRS], ue, *uentry = &ue, *uep;
2795     afs_int32 count, i, j;
2796     short scount;
2797
2798     printf("\n\nPrinting some background daemon info...\n\n");
2799     findsym("afs_brsWaiters", &symoff);
2800     kread(kmem, symoff, (char *)&scount, sizeof scount);
2801     printf("Number of processes waiting for bkg daemon %d\n", scount);
2802     findsym("afs_brsDaemons", &symoff);
2803     kread(kmem, symoff, (char *)&scount, sizeof scount);
2804     printf("Number of free bkg daemons %d\n", scount);
2805     findsym("afs_brs", &symoff);
2806     kread(kmem, symoff, (char *)afs_brs, sizeof afs_brs);
2807     printf("Print the current bkg process table\n");
2808     for (i = 0, j = 0; i < NBRS; i++, j++) {
2809 /*      kread(kmem, (off_t) afs_brs[i], (char *)uentry, sizeof *uentry);*/
2810         uentry = &afs_brs[i];
2811         if (uentry->refCount == 0)
2812             break;
2813         printf
2814             ("[%d] vcache=0x%lx, cred=0x%lx, code=%d, refCount=%d, opcode=%d, flags=%x [%lx, %lx, %lx, %lx]\n",
2815              i, uentry->vc, uentry->cred, uentry->code, uentry->refCount,
2816              uentry->opcode, uentry->flags, uentry->size_parm[0],
2817              uentry->size_parm[1], uentry->ptr_parm[0], uentry->ptr_parm[1]);
2818
2819     }
2820     printf("... found %d active 'afs_brs' entries\n", j);
2821 }
2822
2823 void
2824 print_vlru(int kmem)
2825 {
2826     off_t symoff;
2827     struct vcache Ve, *Ventry = &Ve, *Vep, *tvc;
2828     struct afs_q VLRU, vlru, *vu = &vlru, *tq, *uq;
2829     u_long vlru_addr, l1, l2, l3;
2830     afs_int32 count, i, j = 0, maxvcount, vcount, nvnode;
2831     short scount;
2832
2833     printf("\n\nPrinting vcache VLRU info (oldest first)...\n\n");
2834     findsym("afs_cacheStats", &symoff);
2835     kread(kmem, symoff, (char *)&maxvcount, sizeof maxvcount);
2836     findsym("VLRU", &symoff);
2837     kread(kmem, symoff, (char *)&VLRU, sizeof VLRU);
2838     vlru_addr = (u_long) symoff;
2839     for (tq = VLRU.prev; (u_long) tq != vlru_addr; tq = uq) {
2840         tvc = QTOV(tq);
2841         kread(kmem, (off_t) tq, (char *)vu, sizeof VLRU);
2842         uq = vu->prev;
2843         kread(kmem, (off_t) tvc, (char *)Ventry, sizeof *Ventry);
2844         print_vcache(kmem, Ventry, tvc, 1);
2845         j++;
2846     }
2847     printf("... found %d active vcache entries in the VLRU\n", j);
2848 }
2849
2850 void
2851 print_dlru(int kmem)
2852 {
2853     off_t symoff;
2854     struct dcache Ve, *Ventry = &Ve, *Vep, *tdc;
2855     struct afs_q DLRU, dlru, *vu = &dlru, *tq, *uq;
2856     u_long dlru_addr, l1, l2, l3;
2857     afs_int32 count, i, j = 0, maxvcount, vcount, nvnode;
2858     short scount;
2859
2860     printf("\n\nPrinting vcache DLRU info...\n\n");
2861     findsym("afs_DLRU", &symoff);
2862     kread(kmem, symoff, (char *)&DLRU, sizeof DLRU);
2863     dlru_addr = (u_long) symoff;
2864     for (tq = DLRU.prev; (u_long) tq != dlru_addr; tq = uq) {
2865         tdc = (struct dcache *)tq;
2866         kread(kmem, (off_t) tq, (char *)vu, sizeof DLRU);
2867         uq = vu->prev;
2868         kread(kmem, (off_t) tdc, (char *)Ventry, sizeof *Ventry);
2869         print_dcache(kmem, Ventry, tdc, 1);
2870         j++;
2871     }
2872     printf("... found %d active dcache entries in the DLRU\n\n\n", j);
2873
2874     findsym("afs_freeDSList", &symoff);
2875     kread(kmem, symoff, (char *)&dlru_addr, sizeof dlru_addr);
2876     printf("\tfreeDSList link list starts at 0x%x\n", dlru_addr);
2877     j = 0;
2878     for (tdc = (struct dcache *)dlru_addr; tdc;
2879          tdc = (struct dcache *)Ventry->lruq.next) {
2880         kread(kmem, (off_t) tdc, (char *)Ventry, sizeof *Ventry);
2881         print_dcache(kmem, Ventry, tdc, 1);
2882         j++;
2883 /*      printf("%3d) %x\n", j, tdc);*/
2884     }
2885     printf("... found %d dcache entries in the freeDSList\n", j);
2886 }
2887
2888 int
2889 print_gcpags(int pnt)
2890 {
2891     off_t symoff;
2892     afs_int32 afs_gcpags;
2893     afs_int32 afs_gcpags_procsize;
2894
2895     if (pnt)
2896         printf("\n\nPrinting GCPAGS structures...\n");
2897
2898     findsym("afs_gcpags", &symoff);
2899     kread(kmem, symoff, (char *)&afs_gcpags, sizeof afs_gcpags);
2900
2901     findsym("afs_gcpags_procsize", &symoff);
2902     kread(kmem, symoff, (char *)&afs_gcpags_procsize,
2903           sizeof afs_gcpags_procsize);
2904
2905     printf("afs_gcpags=%d\n", afs_gcpags);
2906     printf("afs_gcpags_procsize=%d\n", afs_gcpags_procsize);
2907
2908     return 0;
2909 }
2910
2911
2912 #ifdef  AFS_AIX_ENV
2913 #include <sys/syspest.h>        /* to define the assert and ASSERT macros       */
2914 #include <sys/timer.h>          /* For the timer related defines                */
2915 #include <sys/intr.h>           /* for the serialization defines                */
2916 #include <sys/malloc.h>         /* for the parameters to xmalloc()              */
2917
2918 struct tos {
2919     struct tos *toprev;         /* previous tos in callout table */
2920     struct tos *tonext;         /* next tos in callout table    */
2921     struct trb *trb;            /* this timer request block     */
2922     afs_int32 type;
2923     long p1;
2924 };
2925
2926 struct callo {
2927     int ncallo;                 /* number of callout table elements     */
2928     struct tos *head;           /* callout table head element           */
2929 };
2930 #endif
2931
2932 void
2933 print_callout(int kmem)
2934 {
2935     off_t symoff;
2936 #ifndef AFS_AIX_ENV
2937     printf("\n\nCallout table doesn't exist for this system\n");
2938 #else
2939     struct callo Co, *Coe = &Co, *Cop;
2940     struct tos To, *Toe = &To, *tos;
2941     struct trb Trb, *Trbe = &Trb, *trb;
2942     int i = 0;
2943
2944
2945     printf("\n\nPrinting callout table info...\n\n");
2946     findsym("afs_callo", &symoff);
2947     kread(kmem, symoff, (char *)&Co, sizeof Co);
2948     printf("Number of callouts %d\n", Co.ncallo);
2949     if (Co.ncallo > 0) {
2950         printf("Count\tType\taddr\tfunc\tdata\n");
2951         for (tos = Co.head; tos != NULL; tos = Toe->tonext) {
2952             i++;
2953             kread(kmem, (off_t) tos, (char *)&To, sizeof To);
2954             kread(kmem, (off_t) Toe->trb, (char *)&Trb, sizeof Trb);
2955             printf("%d\t%d\t%x\t%x\t%x\n", i, Toe->type, Toe->p1, Trbe->tof,
2956                    Trbe->func_data);
2957         }
2958     }
2959 #endif
2960 }
2961
2962 void
2963 print_dnlc(int kmem)
2964 {
2965     struct nc *nameHash[256];
2966
2967 }
2968
2969
2970 void
2971 print_global_locks(int kmem)
2972 {
2973     off_t symoff;
2974     afs_int32 count;
2975     int i;
2976     static struct {
2977         char *name;
2978     } locks[] = { {
2979     "afs_xvcache"}, {
2980     "afs_xdcache"}, {
2981     "afs_xserver"}, {
2982     "afs_xvcb"}, {
2983     "afs_xbrs"}, {
2984     "afs_xcell"}, {
2985     "afs_xconn"}, {
2986     "afs_xuser"}, {
2987     "afs_xvolume"},
2988 #ifndef AFS_AIX_ENV
2989     {
2990     "osi_fsplock"},
2991 #endif
2992     {
2993     "osi_flplock"}, {
2994     "afs_xcbhash"}, {
2995     "afs_xinterface"}, {
2996     0},};
2997
2998
2999     printf("\n\nPrinting afs global locks...\n\n");
3000     for (i = 0; locks[i].name; i++) {
3001         findsym(locks[i].name, &symoff);
3002         kread(kmem, symoff, (char *)&count, sizeof count);
3003         printf("%s = 0x%x\n", locks[i].name, count);
3004     }
3005 }
3006
3007
3008 void
3009 print_global_afs_resource(int kmem)
3010 {
3011     off_t symoff;
3012     char sysname[100];
3013     afs_int32 count;
3014     long addr;
3015
3016     printf("\n\nPrinting some general resource related globals...\n\n");
3017     findsym("afs_setTimeHost", &symoff);
3018     kread(kmem, symoff, (char *)&count, sizeof count);
3019     printf("\tafs_setTimeHost = 0x%x\n", count);
3020     findsym("afs_volCounter", &symoff);
3021     kread(kmem, symoff, (char *)&count, sizeof count);
3022     printf("\tafs_volCounter = 0x%x\n", count);
3023     findsym("afs_cellindex", &symoff);
3024     kread(kmem, symoff, (char *)&count, sizeof count);
3025     printf("\tafs_cellIndex = 0x%x\n", count);
3026     findsym("afs_marinerHost", &symoff);
3027     kread(kmem, symoff, (char *)&count, sizeof count);
3028     printf("\tafs_marinerHost = 0x%x\n", count);
3029     findsym("afs_sysname", &symoff);
3030     kread(kmem, symoff, (char *)&addr, sizeof addr);
3031 #ifdef  AFS_HPUX_ENV
3032     printf("\tafs_sysname = %d\n", addr);
3033 #else
3034     kread(kmem, (off_t) addr, sysname, (KDUMP_SIZE_T) 30);
3035     printf("\tafs_sysname = %s\n", sysname);
3036 #endif
3037 #ifdef AFS_SGI65_ENV
3038     findsym("afs_ipno", &symoff);
3039     kread(kmem, symoff, (char *)&count, sizeof count);
3040     printf("\tCPU BOARD = IP%d\n", count);
3041 #endif
3042 }
3043
3044
3045 void
3046 print_global_afs_cache(int kmem)
3047 {
3048     off_t symoff;
3049     char sysname[100];
3050     afs_int32 count;
3051 #ifdef AFS_SGI62_ENV
3052     ino64_t inode;
3053 #endif
3054 #ifndef AFS32
3055     afs_hyper_t h;
3056 #endif
3057
3058     printf("\n\nPrinting some general cache related globals...\n\n");
3059     findsym("afs_mariner", &symoff);
3060     kread(kmem, symoff, (char *)&count, sizeof count);
3061     printf("\tafs_mariner = 0x%x\n", count);
3062     findsym("freeVCList", &symoff);
3063     kread(kmem, symoff, (char *)&count, sizeof count);
3064     printf("\tafs_freeVCList = 0x%x XXX\n", count);
3065     findsym("afs_freeDCList", &symoff);
3066     kread(kmem, symoff, (char *)&count, sizeof count);
3067     printf("\tfreeDCList = 0x%x\n", count);
3068     findsym("afs_freeDCCount", &symoff);
3069     kread(kmem, symoff, (char *)&count, sizeof count);
3070     printf("\tfreeDCCount = 0x%x (%d)\n", count, count);
3071     findsym("afs_discardDCList", &symoff);
3072     kread(kmem, symoff, (char *)&count, sizeof count);
3073     printf("\tdiscardDCList = 0x%x\n", count);
3074     findsym("afs_discardDCCount", &symoff);
3075     kread(kmem, symoff, (char *)&count, sizeof count);
3076     printf("\tdiscardDCCount = 0x%x (%d)\n", count, count);
3077     findsym("afs_freeDSList", &symoff);
3078     kread(kmem, symoff, (char *)&count, sizeof count);
3079     printf("\tfreeDSList= 0x%x XXXX\n", count);
3080 #ifdef AFS_SGI62_ENV
3081     findsym("cacheInode", &symoff);
3082     kread(kmem, symoff, (char *)&inode, sizeof inode);
3083     printf("\tcacheInode = 0x%llx (%" AFS_INT64_FMT ")\n", inode, inode);
3084     findsym("volumeInode", &symoff);
3085     kread(kmem, symoff, (char *)&inode, sizeof inode);
3086     printf("\tvolumeInode = 0x%llx (%" AFS_INT64_FMT ")\n", inode, inode);
3087 #else
3088     findsym("cacheInode", &symoff);
3089     kread(kmem, symoff, (char *)&count, sizeof count);
3090     printf("\tcacheInode = 0x%x (%d)\n", count, count);
3091     findsym("volumeInode", &symoff);
3092     kread(kmem, symoff, (char *)&count, sizeof count);
3093     printf("\tvolumeInode = 0x%x (%d)\n", count, count);
3094 #endif
3095     findsym("cacheDiskType", &symoff);
3096     kread(kmem, symoff, (char *)&count, sizeof count);
3097     printf("\tcacheDiskType = 0x%x (%d)\n", count, count);
3098 #ifndef AFS32
3099     findsym("afs_indexCounter", &symoff);
3100     kread(kmem, symoff, (char *)&h, sizeof(struct afs_hyper_t));
3101     printf("\tafs_indexCounter = 0x%X.%X (%d.%d)\n", h.high, h.low, h.high,
3102            h.low);
3103 #endif
3104     findsym("afs_cacheFiles", &symoff);
3105     kread(kmem, symoff, (char *)&count, sizeof count);
3106     printf("\tafs_cacheFiles = 0x%x (%d)\n", count, count);
3107     findsym("afs_cacheBlocks", &symoff);
3108     kread(kmem, symoff, (char *)&count, sizeof count);
3109     printf("\tafs_cacheBlocks = 0x%x (%d)\n", count, count);
3110     findsym("afs_cacheStats", &symoff);
3111     kread(kmem, symoff, (char *)&count, sizeof count);
3112     printf("\tafs_cacheStats = 0x%x (%d)\n", count, count);
3113     findsym("afs_blocksUsed", &symoff);
3114     kread(kmem, symoff, (char *)&count, sizeof count);
3115     printf("\tafs_blocksUsed = 0x%x (%d)\n", count, count);
3116     findsym("afs_blocksDiscarded", &symoff);
3117     kread(kmem, symoff, (char *)&count, sizeof count);
3118     printf("\tafs_blocksDiscarded = 0x%x (%d)\n", count, count);
3119     findsym("afs_fsfragsize", &symoff);
3120     kread(kmem, symoff, (char *)&count, sizeof count);
3121     printf("\tafs_fsfragsize = 0x%x\n", count);
3122     findsym("afs_WaitForCacheDrain", &symoff);
3123     kread(kmem, symoff, (char *)&count, sizeof count);
3124     printf("\tafs_WaitForCacheDrain = 0x%x (%d)\n", count, count);
3125     findsym("afs_CacheTooFull", &symoff);
3126     kread(kmem, symoff, (char *)&count, sizeof count);
3127     printf("\tafs_CacheTooFull = 0x%x (%d)\n", count, count);
3128
3129
3130     if (findsym("pagCounter", &symoff)) {
3131         kread(kmem, symoff, (char *)&count, sizeof count);
3132         printf("\tpagCounter = 0x%x (%d)\n", count, count);
3133     } else {
3134         printf("Ignoring pagCounter\n");
3135     }
3136 }
3137
3138
3139 void
3140 print_rxstats(int kmem)
3141 {
3142     off_t symoff;
3143     char sysname[100];
3144     afs_int32 count, i;
3145     struct rx_statistics rx_stats;
3146
3147     printf("\n\nPrinting some general RX stats...\n\n");
3148     findsym("rx_stats", &symoff);
3149     kread(kmem, symoff, (char *)&rx_stats, sizeof rx_stats);
3150     printf("\t\tpacketRequests = %d\n", rx_stats.packetRequests);
3151     printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_RECEIVE,
3152            rx_stats.receivePktAllocFailures);
3153     printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_SEND,
3154            rx_stats.sendPktAllocFailures);
3155     printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_SPECIAL,
3156            rx_stats.specialPktAllocFailures);
3157     printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_RECV_CBUF,
3158            rx_stats.receiveCbufPktAllocFailures);
3159     printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_SEND_CBUF,
3160            rx_stats.sendCbufPktAllocFailures);
3161     printf("\t\tsocketGreedy = %d\n", rx_stats.socketGreedy);
3162     printf("\t\tbogusPacketOnRead = %d\n", rx_stats.bogusPacketOnRead);
3163     printf("\t\tbogusHost = %d\n", rx_stats.bogusHost);
3164     printf("\t\tnoPacketOnRead = %d\n", rx_stats.noPacketOnRead);
3165     printf("\t\tnoPacketBuffersOnRead = %d\n",
3166            rx_stats.noPacketBuffersOnRead);
3167     printf("\t\tselects = %d\n", rx_stats.selects);
3168     printf("\t\tsendSelects = %d\n", rx_stats.sendSelects);
3169     for (i = 0; i < RX_N_PACKET_TYPES; i++)
3170         printf("\t\tpacketsRead[%d] = %d\n", i, rx_stats.packetsRead[i]);
3171     printf("\t\tdataPacketsRead = %d\n", rx_stats.dataPacketsRead);
3172     printf("\t\tackPacketsRead = %d\n", rx_stats.ackPacketsRead);
3173     printf("\t\tdupPacketsRead = %d\n", rx_stats.dupPacketsRead);
3174     printf("\t\tspuriousPacketsRead = %d\n", rx_stats.spuriousPacketsRead);
3175     for (i = 0; i < RX_N_PACKET_TYPES; i++)
3176         printf("\t\tpacketsSent[%d] = %d\n", i, rx_stats.packetsSent[i]);
3177     printf("\t\tackPacketsSent = %d\n", rx_stats.ackPacketsSent);
3178     printf("\t\tpingPacketsSent = %d\n", rx_stats.pingPacketsSent);
3179     printf("\t\tabortPacketsSent = %d\n", rx_stats.abortPacketsSent);
3180     printf("\t\tbusyPacketsSent = %d\n", rx_stats.busyPacketsSent);
3181     printf("\t\tdataPacketsSent = %d\n", rx_stats.dataPacketsSent);
3182     printf("\t\tdataPacketsReSent = %d\n", rx_stats.dataPacketsReSent);
3183     printf("\t\tdataPacketsPushed = %d\n", rx_stats.dataPacketsPushed);
3184     printf("\t\tignoreAckedPacket = %d\n", rx_stats.ignoreAckedPacket);
3185     printf("\t\ttotalRtt = %d sec, %d usec\n", rx_stats.totalRtt.sec,
3186            rx_stats.totalRtt.usec);
3187     printf("\t\tminRtt = %d sec, %d usec\n", rx_stats.minRtt.sec,
3188            rx_stats.minRtt.usec);
3189     printf("\t\tmaxRtt = %d sec, %d usec\n", rx_stats.maxRtt.sec,
3190            rx_stats.maxRtt.usec);
3191     printf("\t\tnRttSamples = %d\n", rx_stats.nRttSamples);
3192     printf("\t\tnServerConns = %d\n", rx_stats.nServerConns);
3193     printf("\t\tnClientConns = %d\n", rx_stats.nClientConns);
3194     printf("\t\tnPeerStructs = %d\n", rx_stats.nPeerStructs);
3195     printf("\t\tnCallStructs = %d\n", rx_stats.nCallStructs);
3196     printf("\t\tnFreeCallStructs = %d\n", rx_stats.nFreeCallStructs);
3197     printf("\t\tnetSendFailures  = %d\n", rx_stats.netSendFailures);
3198     printf("\t\tfatalErrors      = %d\n", rx_stats.fatalErrors);
3199 }
3200
3201
3202 void
3203 print_rx(int kmem)
3204 {
3205     off_t symoff;
3206     char sysname[100], c;
3207     afs_int32 count, i, ar[100];
3208     short sm;
3209     struct rx_statistics rx_stats;
3210
3211     printf("\n\nPrinting some RX globals...\n\n");
3212     findsym("rx_extraQuota", &symoff);
3213     kread(kmem, symoff, (char *)&count, sizeof count);
3214     printf("\trx_extraQuota = %d\n", count);
3215     findsym("rx_extraPackets", &symoff);
3216     kread(kmem, symoff, (char *)&count, sizeof count);
3217     printf("\trx_extraPackets = %d\n", count);
3218     findsym("rx_stackSize", &symoff);
3219     kread(kmem, symoff, (char *)&count, sizeof count);
3220     printf("\trx_stackSize = %d\n", count);
3221     findsym("rx_connDeadTime", &symoff);
3222     kread(kmem, symoff, (char *)&count, sizeof count);
3223
3224     printf("\trx_connDeadTime = %d\n", count);
3225     findsym("rx_idleConnectionTime", &symoff);
3226     kread(kmem, symoff, (char *)&count, sizeof count);
3227
3228     printf("\trx_idleConnectionTime = %d\n", count);
3229
3230     findsym("rx_idlePeerTime", &symoff);
3231     kread(kmem, symoff, (char *)&count, sizeof count);
3232     printf("\trx_idlePeerTime = %d\n", count);
3233
3234     findsym("rx_initSendWindow", &symoff);
3235     kread(kmem, symoff, (char *)&count, sizeof count);
3236     printf("\trx_initSendWindow = %d\n", count);
3237
3238     findsym("rxi_nSendFrags", &symoff);
3239     kread(kmem, symoff, (char *)&count, sizeof count);
3240     printf("\trxi_nSendFrags = %d\n", count);
3241
3242     findsym("rx_nPackets", &symoff);
3243     kread(kmem, symoff, (char *)&count, sizeof count);
3244
3245     printf("\trx_nPackets = %d\n", count);
3246     findsym("rx_nFreePackets", &symoff);
3247     kread(kmem, symoff, (char *)&count, sizeof count);
3248
3249     printf("\trx_nFreePackets = %d\n", count);
3250     findsym("rx_socket", &symoff);
3251     kread(kmem, symoff, (char *)&count, sizeof count);
3252
3253     printf("\trx_socket = 0x%x\n", count);
3254     findsym("rx_port", &symoff);
3255     kread(kmem, symoff, (char *)&sm, sizeof sm);
3256
3257     printf("\trx_Port = %d\n", sm);
3258     findsym("rx_packetQuota", &symoff);
3259     kread(kmem, symoff, (char *)ar, sizeof ar);
3260
3261     for (i = 0; i < RX_N_PACKET_CLASSES; i++)
3262         printf("\trx_packetQuota[%d] = %d\n", i, ar[i]);
3263     findsym("rx_nextCid", &symoff);
3264     kread(kmem, symoff, (char *)&count, sizeof count);
3265
3266     printf("\trx_nextCid = 0x%x\n", count);
3267     findsym("rx_epoch", &symoff);
3268     kread(kmem, symoff, (char *)&count, sizeof count);
3269
3270     printf("\trx_epoch = 0u%u\n", count);
3271     findsym("rx_waitingForPackets", &symoff);
3272     kread(kmem, symoff, (char *)&c, sizeof(c));
3273
3274     printf("\trx_waitingForPackets = %x\n", (int)c);
3275     findsym("rxi_nCalls", &symoff);
3276     kread(kmem, symoff, (char *)&count, sizeof count);
3277
3278     printf("\trxi_nCalls = %d\n", count);
3279     findsym("rxi_dataQuota", &symoff);
3280     kread(kmem, symoff, (char *)&count, sizeof count);
3281
3282     printf("\trxi_dataQuota = %d\n", count);
3283 #ifdef  AFS_AIX_ENV
3284     if (findsym("rxi_Alloccnt", &symoff)) {
3285         kread(kmem, symoff, (char *)&count, sizeof count);
3286         printf("\trxi_Alloccnt = %d\n", count);
3287     }
3288
3289     if (findsym("rxi_Allocsize", &symoff)) {
3290         kread(kmem, symoff, (char *)&count, sizeof count);
3291         printf("\trxi_Allocsize = %d\n", count);
3292     }
3293 #endif
3294     findsym("rxi_availProcs", &symoff);
3295     kread(kmem, symoff, (char *)&count, sizeof count);
3296
3297     printf("\trxi_availProcs = %d\n", count);
3298     findsym("rxi_totalMin", &symoff);
3299     kread(kmem, symoff, (char *)&count, sizeof count);
3300
3301     printf("\trxi_totalMin = %d\n", count);
3302     findsym("rxi_minDeficit", &symoff);
3303     kread(kmem, symoff, (char *)&count, sizeof count);
3304
3305     printf("\trxi_minDeficit = %d\n", count);
3306     print_services(kmem);
3307 #ifdef KDUMP_RX_LOCK
3308     if (use_rx_lock) {
3309         print_peertable_lock(kmem);
3310         print_conntable_lock(kmem);
3311         print_calltable_lock(kmem);
3312     } else {
3313         print_peertable(kmem);
3314         print_conntable(kmem);
3315         print_calltable(kmem);
3316     }
3317 #else
3318     print_peertable(kmem);
3319     print_conntable(kmem);
3320     print_calltable(kmem);
3321 #endif
3322     print_eventtable(kmem);
3323     print_rxstats(kmem);
3324 }
3325
3326
3327 void
3328 print_services(afs_int32 kmem)
3329 {
3330     off_t symoff;
3331     struct rx_service *rx_services[RX_MAX_SERVICES], se, *sentry = &se, *sep;
3332     char sysname[100];
3333     afs_int32 count, i, j;
3334
3335     findsym("rx_services", &symoff);
3336     kread(kmem, symoff, (char *)rx_services, RX_MAX_SERVICES * sizeof(long));
3337
3338     printf("\n\nPrinting all 'rx_services' structures...\n");
3339     for (i = 0, j = 0; i < RX_MAX_SERVICES; i++) {
3340         if (rx_services[i]) {
3341             j++;
3342             kread(kmem, (off_t) rx_services[i], (char *)sentry,
3343                   sizeof *sentry);
3344             kread(kmem, (off_t) sentry->serviceName, sysname,
3345                   (KDUMP_SIZE_T) 40);
3346             printf
3347                 ("\t%lx: serviceId=%d, port=%d, serviceName=%s, socket=0x%x\n",
3348                  rx_services[i], sentry->serviceId, sentry->servicePort,
3349                  sysname, sentry->socket);
3350             printf
3351                 ("\t\tnSecObj=%d, nReqRunning=%d, maxProcs=%d, minProcs=%d, connDeadTime=%d, idleDeadTime=%d\n",
3352                  sentry->nSecurityObjects, sentry->nRequestsRunning,
3353                  sentry->maxProcs, sentry->minProcs, sentry->connDeadTime,
3354                  sentry->idleDeadTime);
3355         }
3356     }
3357     printf("... found %d 'rx_services' entries in the table\n", j);
3358 }
3359
3360
3361 #ifdef KDUMP_RX_LOCK
3362 void
3363 print_peertable_lock(afs_int32 kmem)
3364 {
3365     off_t symoff;
3366     struct rx_peer_rx_lock *rx_peerTable[256], se, *sentry = &se, *sep;
3367     long count, i, j;
3368
3369     findsym("rx_peerHashTable", &symoff);
3370     kread(kmem, symoff, (char *)&count, sizeof(long));
3371     if (!count) {
3372         printf("No 'rx_peer' structures found.\n");
3373         return;
3374     }
3375
3376     kread(kmem, count, (char *)rx_peerTable, 256 * sizeof(long));
3377     printf("\n\nPrinting all 'rx_peer' structures...\n");
3378     for (i = 0, j = 0; i < 256; i++) {
3379         for (sep = rx_peerTable[i]; sep; sep = sentry->next, j++) {
3380             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3381             printf("\t%lx: next=0x%lx, host=0x%x, ", sep, sentry->next,
3382                    sentry->host);
3383             printf("ifMTU=%d, natMTU=%d, maxMTU=%d\n", sentry->ifMTU,
3384                    sentry->natMTU, sentry->maxMTU);
3385             printf("\t\trtt=%d:%d, timeout(%d:%d), nSent=%d, reSends=%d\n",
3386                    sentry->rtt, sentry->rtt_dev, sentry->timeout.sec,
3387                    sentry->timeout.usec, sentry->nSent, sentry->reSends);
3388             printf("\t\trefCount=%d, port=%d, idleWhen=0x%x\n",
3389                    sentry->refCount, sentry->port, sentry->idleWhen);
3390             printf
3391                 ("\t\tCongestionQueue (0x%x:0x%x), inPacketSkew=0x%x, outPacketSkew=0x%x\n",
3392                  sentry->congestionQueue.prev, sentry->congestionQueue.next,
3393                  sentry->inPacketSkew, sentry->outPacketSkew);
3394             printf("\t\tpeer_lock=%d\n", sentry->peer_lock);
3395         }
3396     }
3397     printf("... found %d 'rx_peer' entries in the table\n", j);
3398 }
3399
3400 #endif /* KDUMP_RX_LOCK */
3401 void
3402 print_peertable(afs_int32 kmem)
3403 {
3404     off_t symoff;
3405     struct rx_peer *rx_peerTable[256], se, *sentry = &se, *sep;
3406     long count, i, j;
3407
3408     findsym("rx_peerHashTable", &symoff);
3409     kread(kmem, symoff, (char *)&count, sizeof(long));
3410
3411     kread(kmem, count, (char *)rx_peerTable, 256 * sizeof(long));
3412     printf("\n\nPrinting all 'rx_peer' structures...\n");
3413     for (i = 0, j = 0; i < 256; i++) {
3414         for (sep = rx_peerTable[i]; sep; sep = sentry->next, j++) {
3415             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3416             printf("\t%lx: next=0x%lx, host=0x%x, ", sep, sentry->next,
3417                    sentry->host);
3418             printf("ifMTU=%d, natMTU=%d, maxMTU=%d\n", sentry->ifMTU,
3419                    sentry->natMTU, sentry->maxMTU);
3420             printf("\t\trtt=%d:%d, timeout(%d:%d), nSent=%d, reSends=%d\n",
3421                    sentry->rtt, sentry->rtt_dev, sentry->timeout.sec,
3422                    sentry->timeout.usec, sentry->nSent, sentry->reSends);
3423             printf("\t\trefCount=%d, port=%d, idleWhen=0x%x\n",
3424                    sentry->refCount, sentry->port, sentry->idleWhen);
3425             printf
3426                 ("\t\tCongestionQueue (0x%x:0x%x), inPacketSkew=0x%x, outPacketSkew=0x%x\n",
3427                  sentry->congestionQueue.prev, sentry->congestionQueue.next,
3428                  sentry->inPacketSkew, sentry->outPacketSkew);
3429 #ifdef RX_ENABLE_LOCKS
3430             printf("\t\tpeer_lock=%d\n", sentry->peer_lock);
3431 #endif /* RX_ENABLE_LOCKS */
3432         }
3433     }
3434     printf("... found %d 'rx_peer' entries in the table\n", j);
3435 }
3436
3437
3438 #ifdef KDUMP_RX_LOCK
3439 void
3440 print_conntable_lock(afs_int32 kmem)
3441 {
3442     off_t symoff;
3443     struct rx_connection_rx_lock *rx_connTable[256], se, *sentry = &se;
3444     struct rx_connection_rx_lock *sep;
3445     long count, i, j;
3446
3447     findsym("rx_connHashTable", &symoff);
3448     kread(kmem, symoff, (char *)&count, sizeof(long));
3449     if (!count) {
3450         printf("No 'rx_connection' structures found.\n");
3451         return;
3452     }
3453
3454     kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
3455     printf("\n\nPrinting all 'rx_connection' structures...\n");
3456     for (i = 0, j = 0; i < 256; i++) {
3457         for (sep = rx_connTable[i]; sep; sep = sentry->next, j++) {
3458             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3459             printf
3460                 ("\t%lx: next=0x%lx, peer=0x%lx, epoch=0x%x, cid=0x%x, ackRate=%d\n",
3461                  sep, se.next, se.peer, se.epoch, se.cid, se.ackRate);
3462             printf("\t\tcall[%lx=%d, %lx=%d, %lx=%d, %lx=%d]\n", se.call[0],
3463                    se.callNumber[0], se.call[1], se.callNumber[1], se.call[2],
3464                    se.callNumber[2], se.call[3], se.callNumber[3]);
3465             printf
3466                 ("\t\ttimeout=%d, flags=0x%x, type=0x%x, serviceId=%d, service=0x%lx, refCount=%d\n",
3467                  se.timeout, se.flags, se.type, se.serviceId, se.service,
3468                  se.refCount);
3469             printf
3470                 ("\t\tserial=%d, lastSerial=%d, secsUntilDead=%d, secsUntilPing=%d, secIndex=%d\n",
3471                  se.serial, se.lastSerial, se.secondsUntilDead,
3472                  se.secondsUntilPing, se.securityIndex);
3473             printf
3474                 ("\t\terror=%d, secObject=0x%lx, secData=0x%lx, secHeaderSize=%d, secmaxTrailerSize=%d\n",
3475                  se.error, se.securityObject, se.securityData,
3476                  se.securityHeaderSize, se.securityMaxTrailerSize);
3477             printf
3478                 ("\t\tchallEvent=0x%lx, lastSendTime=0x%x, maxSerial=%d, hardDeadTime=%d\n",
3479                  se.challengeEvent, se.lastSendTime, se.maxSerial,
3480                  se.hardDeadTime);
3481             if (se.flags & RX_CONN_MAKECALL_WAITING)
3482                 printf
3483                     ("\t\t***** Conn in RX_CONN_MAKECALL_WAITING state *****\n");
3484             printf
3485                 ("\t\tcall_lock=%d, call_cv=%d, data_lock=%d, refCount=%d\n",
3486                  se.conn_call_lock, se.conn_call_cv, se.conn_data_lock,
3487                  se.refCount);
3488         }
3489     }
3490     printf("... found %d 'rx_connection' entries in the table\n", j);
3491 }
3492 #endif /* KDUMP_RX_LOCK */
3493
3494 void
3495 print_conntable(afs_int32 kmem)
3496 {
3497     off_t symoff;
3498     struct rx_connection *rx_connTable[256], se, *sentry = &se, *sep;
3499     long count, i, j;
3500
3501     findsym("rx_connHashTable", &symoff);
3502     kread(kmem, symoff, (char *)&count, sizeof(long));
3503
3504     kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
3505     printf("\n\nPrinting all 'rx_connection' structures...\n");
3506     for (i = 0, j = 0; i < 256; i++) {
3507         for (sep = rx_connTable[i]; sep; sep = sentry->next, j++) {
3508             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3509             printf
3510                 ("\t%lx: next=0x%lx, peer=0x%lx, epoch=0x%x, cid=0x%x, ackRate=%d\n",
3511                  sep, se.next, se.peer, se.epoch, se.cid, se.ackRate);
3512             printf("\t\tcall[%x=%d, %x=%d, %x=%d, %x=%d]\n", se.call[0],
3513                    se.callNumber[0], se.call[1], se.callNumber[1], se.call[2],
3514                    se.callNumber[2], se.call[3], se.callNumber[3]);
3515             printf
3516                 ("\t\ttimeout=%d, flags=0x%x, type=0x%x, serviceId=%d, service=0x%lx, refCount=%d\n",
3517                  se.timeout, se.flags, se.type, se.serviceId, se.service,
3518                  se.refCount);
3519             printf
3520                 ("\t\tserial=%d, lastSerial=%d, secsUntilDead=%d, secsUntilPing=%d, secIndex=%d\n",
3521                  se.serial, se.lastSerial, se.secondsUntilDead,
3522                  se.secondsUntilPing, se.securityIndex);
3523             printf
3524                 ("\t\terror=%d, secObject=0x%lx, secData=0x%lx, secHeaderSize=%d, secmaxTrailerSize=%d\n",
3525                  se.error, se.securityObject, se.securityData,
3526                  se.securityHeaderSize, se.securityMaxTrailerSize);
3527             printf
3528                 ("\t\tchallEvent=0x%lx, lastSendTime=0x%x, maxSerial=%d, hardDeadTime=%d\n",
3529                  se.challengeEvent, se.lastSendTime, se.maxSerial,
3530                  se.hardDeadTime);
3531             if (se.flags & RX_CONN_MAKECALL_WAITING)
3532                 printf
3533                     ("\t\t***** Conn in RX_CONN_MAKECALL_WAITING state *****\n");
3534 #ifdef RX_ENABLE_LOCKS
3535             printf
3536                 ("\t\tcall_lock=%d, call_cv=%d, data_lock=%d, refCount=%d\n",
3537                  se.conn_call_lock, se.conn_call_cv, se.conn_data_lock,
3538                  se.refCount);
3539 #endif /* RX_ENABLE_LOCKS */
3540         }
3541     }
3542     printf("... found %d 'rx_connection' entries in the table\n", j);
3543 }
3544
3545
3546 #ifdef KDUMP_RX_LOCK
3547 void
3548 print_calltable_lock(afs_int32 kmem)
3549 {
3550     off_t symoff;
3551     struct rx_connection_rx_lock *rx_connTable[256], se;
3552     struct rx_connection_rx_lock *sentry = &se;
3553     struct rx_connection_rx_lock *sep;
3554     long count, i, j, k;
3555
3556     findsym("rx_connHashTable", &symoff);
3557     kread(kmem, symoff, (char *)&count, sizeof(long));
3558     if (!count) {
3559         printf("No 'rx_call' structures found.\n");
3560         return;
3561     }
3562
3563     kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
3564     printf("\n\nPrinting all active 'rx_call' structures...\n");
3565     for (i = 0, j = 0; i < 256; i++) {
3566         for (sep = rx_connTable[i]; sep; sep = se.next) {
3567             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3568             for (k = 0; k < RX_MAXCALLS; k++) {
3569                 struct rx_call_rx_lock ce, *centry = &ce;
3570                 struct rx_call_rx_lock *call = se.call[k];
3571                 if (call) {
3572                     j++;
3573                     kread(kmem, (off_t) call, (char *)centry, sizeof *centry);
3574                     printf
3575                         ("\t%lx: conn=0x%lx, qiheader(0x%lx:0x%lx), tq(0x%lx:0x%lx), rq(0x%lx:0x%lx)\n",
3576                          call, centry->conn, centry->queue_item_header.prev,
3577                          centry->queue_item_header.next, centry->tq.prev,
3578                          centry->tq.next, centry->rq.prev, centry->rq.next);
3579                     printf
3580                         ("\t\t: curvec=%d, curpos=%d, nLeft=%d, nFree=%d, currPacket=0x%lx, callNumber=0x%x\n",
3581                          centry->curvec, centry->curpos, centry->nLeft,
3582                          centry->nFree, centry->currentPacket,
3583                          centry->callNumber);
3584                     printf
3585                         ("\t\t: channel=%d, state=0x%x, mode=0x%x, flags=0x%x, localStatus=0x%x, remStatus=0x%x\n",
3586                          centry->channel, centry->state, centry->mode,
3587                          centry->flags, centry->localStatus,
3588                          centry->remoteStatus);
3589                     printf
3590                         ("\t\t: error=%d, timeout=0x%x, rnext=0x%x, rprev=0x%x, rwind=0x%x, tfirst=0x%x, tnext=0x%x\n",
3591                          centry->error, centry->timeout, centry->rnext,
3592                          centry->rprev, centry->rwind, centry->tfirst,
3593                          centry->tnext);
3594                     printf
3595                         ("\t\t: twind=%d, resendEvent=0x%lx, timeoutEvent=0x%lx, keepAliveEvent=0x%lx, delayedAckEvent=0x%lx\n",
3596                          centry->twind, centry->resendEvent,
3597                          centry->timeoutEvent, centry->keepAliveEvent,
3598                          centry->delayedAckEvent);
3599                     printf
3600                         ("\t\t: lastSendTime=0x%x, lastReceiveTime=0x%x, lastAcked=0x%x, startTime=0x%x, startWait=0x%x\n",
3601                          centry->lastSendTime, centry->lastReceiveTime,
3602                          centry->lastAcked, centry->startTime,
3603                          centry->startWait);
3604                     if (centry->flags & RX_CALL_WAIT_PROC)
3605                         printf
3606                             ("\t\t******** Call in RX_CALL_WAIT_PROC state **********\n");
3607                     if (centry->flags & RX_CALL_WAIT_WINDOW_ALLOC)
3608                         printf
3609                             ("\t\t******** Call in RX_CALL_WAIT_WINDOW_ALLOC state **********\n");
3610                     if (centry->flags & RX_CALL_READER_WAIT)
3611                         printf
3612                             ("\t\t******** Conn in RX_CALL_READER_WAIT state **********\n");
3613                     if (centry->flags & RX_CALL_WAIT_PACKETS)
3614                         printf
3615                             ("\t\t******** Conn in RX_CALL_WAIT_PACKETS state **********\n");
3616                     printf
3617                         ("\t\t: lock=0x%x, cv_twind=0x%x, cv_rq=0x%x, refCount=%d\n",
3618                          centry->lock, centry->cv_twind, centry->cv_rq,
3619                          centry->refCount);
3620                     printf("\t\t: MTU=%d\n", centry->MTU);
3621                 }
3622             }
3623         }
3624     }
3625     printf("... found %d 'rx_call' entries in the table\n", j);
3626 }
3627 #endif /* KDUMP_RX_LOCK */
3628
3629 void
3630 print_calltable(afs_int32 kmem)
3631 {
3632     off_t symoff;
3633     struct rx_connection *rx_connTable[256], se, *sentry = &se, *sep;
3634     long count, i, j, k;
3635
3636     findsym("rx_connHashTable", &symoff);
3637     kread(kmem, symoff, (char *)&count, sizeof(long));
3638
3639     kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
3640     printf("\n\nPrinting all active 'rx_call' structures...\n");
3641     for (i = 0, j = 0; i < 256; i++) {
3642         for (sep = rx_connTable[i]; sep; sep = se.next) {
3643             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3644             for (k = 0; k < RX_MAXCALLS; k++) {
3645                 struct rx_call ce, *centry = &ce, *call = se.call[k];
3646                 if (call) {
3647                     j++;
3648                     kread(kmem, (off_t) call, (char *)centry, sizeof *centry);
3649                     printf
3650                         ("\t%lx: conn=0x%lx, qiheader(0x%lx:0x%lx), tq(0x%lx:0x%lx), rq(0x%lx:0x%lx)\n",
3651                          call, centry->conn, centry->queue_item_header.prev,
3652                          centry->queue_item_header.next, centry->tq.prev,
3653                          centry->tq.next, centry->rq.prev, centry->rq.next);
3654                     printf
3655                         ("\t\t: curvec=%d, curpos=%d, nLeft=%d, nFree=%d, currPacket=0x%lx, callNumber=0x%x\n",
3656                          centry->curvec, centry->curpos, centry->nLeft,
3657                          centry->nFree, centry->currentPacket,
3658                          centry->callNumber);
3659                     printf
3660                         ("\t\t: channel=%d, state=0x%x, mode=0x%x, flags=0x%x, localStatus=0x%x, remStatus=0x%x\n",
3661                          centry->channel, centry->state, centry->mode,
3662                          centry->flags, centry->localStatus,
3663                          centry->remoteStatus);
3664                     printf
3665                         ("\t\t: error=%d, timeout=0x%x, rnext=0x%x, rprev=0x%x, rwind=0x%x, tfirst=0x%x, tnext=0x%x\n",
3666                          centry->error, centry->timeout, centry->rnext,
3667                          centry->rprev, centry->rwind, centry->tfirst,
3668                          centry->tnext);
3669                     printf
3670                         ("\t\t: twind=%d, resendEvent=0x%lx, timeoutEvent=0x%lx, keepAliveEvent=0x%lx, delayedAckEvent=0x%lx\n",
3671                          centry->twind, centry->resendEvent,
3672                          centry->timeoutEvent, centry->keepAliveEvent,
3673                          centry->delayedAckEvent);
3674                     printf
3675                         ("\t\t: lastSendTime=0x%x, lastReceiveTime=0x%x, lastAcked=0x%x, startTime=0x%x, startWait=0x%x\n",
3676                          centry->lastSendTime, centry->lastReceiveTime,
3677                          centry->lastAcked, centry->startTime,
3678                          centry->startWait);
3679                     if (centry->flags & RX_CALL_WAIT_PROC)
3680                         printf
3681                             ("\t\t******** Call in RX_CALL_WAIT_PROC state **********\n");
3682                     if (centry->flags & RX_CALL_WAIT_WINDOW_ALLOC)
3683                         printf
3684                             ("\t\t******** Call in RX_CALL_WAIT_WINDOW_ALLOC state **********\n");
3685                     if (centry->flags & RX_CALL_READER_WAIT)
3686                         printf
3687                             ("\t\t******** Conn in RX_CALL_READER_WAIT state **********\n");
3688                     if (centry->flags & RX_CALL_WAIT_PACKETS)
3689                         printf
3690                             ("\t\t******** Conn in RX_CALL_WAIT_PACKETS state **********\n");
3691 #ifdef RX_ENABLE_LOCKS
3692                     printf
3693                         ("\t\t: lock=0x%x, cv_twind=0x%x, cv_rq=0x%x, refCount=%d\n",
3694                          centry->lock, centry->cv_twind, centry->cv_rq,
3695                          centry->refCount);
3696 #endif /* RX_ENABLE_LOCKS */
3697                     printf("\t\t: MTU=%d\n", centry->MTU);
3698                 }
3699             }
3700         }
3701     }
3702     printf("... found %d 'rx_call' entries in the table\n", j);
3703 }
3704
3705 void
3706 print_eventtable(afs_int32 kmem)
3707 {
3708     off_t symoff;
3709     struct rx_queue epq;
3710     struct rx_queue evq;
3711     char *epend, *evend;
3712     afs_int32 count, i, j = 0, k = 0;
3713
3714 #if ! defined(AFS_HPUX_ENV) && ! defined(AFS_AIX_ENV)
3715     findsym("rxevent_nFree", &symoff);
3716     kread(kmem, symoff, (char *)&count, sizeof(afs_int32));
3717     printf("\n\n\trxevent_nFree = %d\n", count);
3718
3719     findsym("rxevent_nPosted", &symoff);
3720     kread(kmem, symoff, (char *)&count, sizeof(afs_int32));
3721     printf("\trxevent_nPosted = %d\n", count);
3722 #endif
3723 }
3724
3725 /*
3726  * print_upDownStats
3727  *
3728  * Print the up/downtime stats for the given class of server records
3729  * provided.
3730  */
3731 void
3732 print_upDownStats(struct afs_stats_SrvUpDownInfo *a_upDownP)
3733 {                               /*print_upDownStats */
3734
3735     /*
3736      * First, print the simple values.
3737      */
3738     printf("\t\t%10d numTtlRecords\n", a_upDownP->numTtlRecords);
3739     printf("\t\t%10d numUpRecords\n", a_upDownP->numUpRecords);
3740     printf("\t\t%10d numDownRecords\n", a_upDownP->numDownRecords);
3741     printf("\t\t%10d sumOfRecordAges\n", a_upDownP->sumOfRecordAges);
3742     printf("\t\t%10d ageOfYoungestRecord\n", a_upDownP->ageOfYoungestRecord);
3743     printf("\t\t%10d ageOfOldestRecord\n", a_upDownP->ageOfOldestRecord);
3744     printf("\t\t%10d numDowntimeIncidents\n",
3745            a_upDownP->numDowntimeIncidents);
3746     printf("\t\t%10d numRecordsNeverDown\n", a_upDownP->numRecordsNeverDown);
3747     printf("\t\t%10d maxDowntimesInARecord\n",
3748            a_upDownP->maxDowntimesInARecord);
3749     printf("\t\t%10d sumOfDowntimes\n", a_upDownP->sumOfDowntimes);
3750     printf("\t\t%10d shortestDowntime\n", a_upDownP->shortestDowntime);
3751     printf("\t\t%10d longestDowntime\n", a_upDownP->longestDowntime);
3752
3753     /*
3754      * Now, print the array values.
3755      */
3756     printf("\t\tDowntime duration distribution:\n");
3757     printf("\t\t\t%8d: 0 min .. 10 min\n", a_upDownP->downDurations[0]);
3758     printf("\t\t\t%8d: 10 min .. 30 min\n", a_upDownP->downDurations[1]);
3759     printf("\t\t\t%8d: 30 min .. 1 hr\n", a_upDownP->downDurations[2]);
3760     printf("\t\t\t%8d: 1 hr .. 2 hr\n", a_upDownP->downDurations[3]);
3761     printf("\t\t\t%8d: 2 hr .. 4 hr\n", a_upDownP->downDurations[4]);
3762     printf("\t\t\t%8d: 4 hr .. 8 hr\n", a_upDownP->downDurations[5]);
3763     printf("\t\t\t%8d: > 8 hr\n", a_upDownP->downDurations[6]);
3764
3765     printf("\t\tDowntime incident distribution:\n");
3766     printf("\t\t\t%8d: 0 times\n", a_upDownP->downIncidents[0]);
3767     printf("\t\t\t%8d: 1 time\n", a_upDownP->downDurations[1]);
3768     printf("\t\t\t%8d: 2 .. 5 times\n", a_upDownP->downDurations[2]);
3769     printf("\t\t\t%8d: 6 .. 10 times\n", a_upDownP->downDurations[3]);
3770     printf("\t\t\t%8d: 10 .. 50 times\n", a_upDownP->downDurations[4]);
3771     printf("\t\t\t%8d: > 50 times\n", a_upDownP->downDurations[5]);
3772 }                               /*print_upDownStats */
3773
3774
3775 void
3776 print_cmperfstats(struct afs_stats_CMPerf *perfP)
3777 {
3778     struct afs_stats_SrvUpDownInfo *upDownP;    /*Ptr to server up/down info */
3779
3780     printf("\t%10d numPerfCalls\n", perfP->numPerfCalls);
3781     printf("\t%10d epoch\n", perfP->epoch);
3782     printf("\t%10d numCellsVisible\n", perfP->numCellsVisible);
3783     printf("\t%10d numCellsContacted\n", perfP->numCellsContacted);
3784     printf("\t%10d dlocalAccesses\n", perfP->dlocalAccesses);
3785     printf("\t%10d vlocalAccesses\n", perfP->vlocalAccesses);
3786     printf("\t%10d dremoteAccesses\n", perfP->dremoteAccesses);
3787     printf("\t%10d vremoteAccesses\n", perfP->vremoteAccesses);
3788     printf("\t%10d cacheNumEntries\n", perfP->cacheNumEntries);
3789     printf("\t%10d cacheBlocksTotal\n", perfP->cacheBlocksTotal);
3790     printf("\t%10d cacheBlocksInUse\n", perfP->cacheBlocksInUse);
3791     printf("\t%10d cacheBlocksOrig\n", perfP->cacheBlocksOrig);
3792     printf("\t%10d cacheMaxDirtyChunks\n", perfP->cacheMaxDirtyChunks);
3793     printf("\t%10d cacheCurrDirtyChunks\n", perfP->cacheCurrDirtyChunks);
3794     printf("\t%10d dcacheHits\n", perfP->dcacheHits);
3795     printf("\t%10d vcacheHits\n", perfP->vcacheHits);
3796     printf("\t%10d dcacheMisses\n", perfP->dcacheMisses);
3797     printf("\t%10d vcacheMisses\n", perfP->vcacheMisses);
3798     printf("\t%10d cacheFlushes\n", perfP->cacheFlushes);
3799     printf("\t%10d cacheFilesReused\n", perfP->cacheFilesReused);
3800     printf("\t%10d vcacheXAllocs\n", perfP->vcacheXAllocs);
3801     printf("\t%10d dcacheXAllocs\n", perfP->dcacheXAllocs);
3802
3803     printf("\t%10d bufAlloced\n", perfP->bufAlloced);
3804     printf("\t%10d bufHits\n", perfP->bufHits);
3805     printf("\t%10d bufMisses\n", perfP->bufMisses);
3806     printf("\t%10d bufFlushDirty\n", perfP->bufFlushDirty);
3807
3808     printf("\t%10d LargeBlocksActive\n", perfP->LargeBlocksActive);
3809     printf("\t%10d LargeBlocksAlloced\n", perfP->LargeBlocksAlloced);
3810     printf("\t%10d SmallBlocksActive\n", perfP->SmallBlocksActive);
3811     printf("\t%10d SmallBlocksAlloced\n", perfP->SmallBlocksAlloced);
3812     printf("\t%10d MediumBlocksActive\n", perfP->MediumBlocksActive);
3813     printf("\t%10d MediumBlocksAlloced\n", perfP->MediumBlocksAlloced);
3814     printf("\t%10d OutStandingMemUsage\n", perfP->OutStandingMemUsage);
3815     printf("\t%10d OutStandingAllocs\n", perfP->OutStandingAllocs);
3816     printf("\t%10d CallBackAlloced\n", perfP->CallBackAlloced);
3817     printf("\t%10d CallBackFlushes\n", perfP->CallBackFlushes);
3818     printf("\t%10d CallBackLoops\n", perfP->cbloops);
3819
3820     printf("\t%10d srvRecords\n", perfP->srvRecords);
3821     printf("\t%10d srvNumBuckets\n", perfP->srvNumBuckets);
3822     printf("\t%10d srvMaxChainLength\n", perfP->srvMaxChainLength);
3823     printf("\t%10d srvRecordsHWM\n", perfP->srvRecordsHWM);
3824     printf("\t%10d srvMaxChainLengthHWM\n", perfP->srvMaxChainLengthHWM);
3825
3826     printf("\t%10d sysName_ID\n", perfP->sysName_ID);
3827     printf("\t%10d osi_Read_EFAULTS\n", perfP->osiread_efaults);
3828
3829     printf("\tFile Server up/downtimes, same cell:\n");
3830     print_upDownStats(&(perfP->fs_UpDown[0]));
3831
3832     printf("\tFile Server up/downtimes, diff cell:\n");
3833     print_upDownStats(&(perfP->fs_UpDown[1]));
3834
3835     printf("\tVL Server up/downtimes, same cell:\n");
3836     print_upDownStats(&(perfP->vl_UpDown[0]));
3837
3838     printf("\tVL Server up/downtimes, diff cell:\n");
3839     print_upDownStats(&(perfP->vl_UpDown[1]));
3840 }
3841
3842
3843 void
3844 print_cmstats(struct afs_CMStats *cmp)
3845 {
3846     printf("\t%10d afs_init\n", cmp->callInfo.C_afs_init);
3847     printf("\t%10d gop_rdwr\n", cmp->callInfo.C_gop_rdwr);
3848     printf("\t%10d aix_gnode_rele\n", cmp->callInfo.C_aix_gnode_rele);
3849     printf("\t%10d gettimeofday\n", cmp->callInfo.C_gettimeofday);
3850     printf("\t%10d m_cpytoc\n", cmp->callInfo.C_m_cpytoc);
3851     printf("\t%10d aix_vattr_null\n", cmp->callInfo.C_aix_vattr_null);
3852     printf("\t%10d afs_gn_frunc\n", cmp->callInfo.C_afs_gn_ftrunc);
3853     printf("\t%10d afs_gn_rdwr\n", cmp->callInfo.C_afs_gn_rdwr);
3854     printf("\t%10d afs_gn_ioctl\n", cmp->callInfo.C_afs_gn_ioctl);
3855     printf("\t%10d afs_gn_locktl\n", cmp->callInfo.C_afs_gn_lockctl);
3856     printf("\t%10d afs_gn_readlink\n", cmp->callInfo.C_afs_gn_readlink);
3857     printf("\t%10d afs_gn_readdir\n", cmp->callInfo.C_afs_gn_readdir);
3858     printf("\t%10d afs_gn_select\n", cmp->callInfo.C_afs_gn_select);
3859     printf("\t%10d afs_gn_strategy\n", cmp->callInfo.C_afs_gn_strategy);
3860     printf("\t%10d afs_gn_symlink\n", cmp->callInfo.C_afs_gn_symlink);
3861     printf("\t%10d afs_gn_revoke\n", cmp->callInfo.C_afs_gn_revoke);
3862     printf("\t%10d afs_gn_link\n", cmp->callInfo.C_afs_gn_link);
3863     printf("\t%10d afs_gn_mkdir\n", cmp->callInfo.C_afs_gn_mkdir);
3864     printf("\t%10d afs_gn_mknod\n", cmp->callInfo.C_afs_gn_mknod);
3865     printf("\t%10d afs_gn_remove\n", cmp->callInfo.C_afs_gn_remove);
3866     printf("\t%10d afs_gn_rename\n", cmp->callInfo.C_afs_gn_rename);
3867     printf("\t%10d afs_gn_rmdir\n", cmp->callInfo.C_afs_gn_rmdir);
3868     printf("\t%10d afs_gn_fid\n", cmp->callInfo.C_afs_gn_fid);
3869     printf("\t%10d afs_gn_lookup\n", cmp->callInfo.C_afs_gn_lookup);
3870     printf("\t%10d afs_gn_open\n", cmp->callInfo.C_afs_gn_open);
3871     printf("\t%10d afs_gn_create\n", cmp->callInfo.C_afs_gn_create);
3872     printf("\t%10d afs_gn_hold\n", cmp->callInfo.C_afs_gn_hold);
3873     printf("\t%10d afs_gn_rele\n", cmp->callInfo.C_afs_gn_rele);
3874     printf("\t%10d afs_gn_unmap\n", cmp->callInfo.C_afs_gn_unmap);
3875     printf("\t%10d afs_gn_access\n", cmp->callInfo.C_afs_gn_access);
3876     printf("\t%10d afs_gn_getattr\n", cmp->callInfo.C_afs_gn_getattr);
3877     printf("\t%10d afs_gn_setattr\n", cmp->callInfo.C_afs_gn_setattr);
3878     printf("\t%10d afs_gn_fclear\n", cmp->callInfo.C_afs_gn_fclear);
3879     printf("\t%10d afs_gn_fsync\n", cmp->callInfo.C_afs_gn_fsync);
3880     printf("\t%10d phash\n", cmp->callInfo.C_pHash);
3881     printf("\t%10d DInit\n", cmp->callInfo.C_DInit);
3882     printf("\t%10d DRead\n", cmp->callInfo.C_DRead);
3883     printf("\t%10d FixupBucket\n", cmp->callInfo.C_FixupBucket);
3884     printf("\t%10d afs_newslot\n", cmp->callInfo.C_afs_newslot);
3885     printf("\t%10d DRelease\n", cmp->callInfo.C_DRelease);
3886     printf("\t%10d DFlush\n", cmp->callInfo.C_DFlush);
3887     printf("\t%10d DFlushEntry\n", cmp->callInfo.C_DFlushEntry);
3888     printf("\t%10d DVOffset\n", cmp->callInfo.C_DVOffset);
3889     printf("\t%10d DZap\n", cmp->callInfo.C_DZap);
3890     printf("\t%10d DNew\n", cmp->callInfo.C_DNew);
3891     printf("\t%10d afs_RemoveVCB\n", cmp->callInfo.C_afs_RemoveVCB);
3892     printf("\t%10d afs_NewVCache\n", cmp->callInfo.C_afs_NewVCache);
3893     printf("\t%10d afs_FlushActiveVcaches\n",
3894            cmp->callInfo.C_afs_FlushActiveVcaches);
3895     printf("\t%10d afs_VerifyVCache\n", cmp->callInfo.C_afs_VerifyVCache);
3896     printf("\t%10d afs_WriteVCache\n", cmp->callInfo.C_afs_WriteVCache);
3897     printf("\t%10d afs_GetVCache\n", cmp->callInfo.C_afs_GetVCache);
3898     printf("\t%10d afs_StuffVcache\n", cmp->callInfo.C_afs_StuffVcache);
3899     printf("\t%10d afs_FindVCache\n", cmp->callInfo.C_afs_FindVCache);
3900     printf("\t%10d afs_PutDCache\n", cmp->callInfo.C_afs_PutDCache);
3901     printf("\t%10d afs_PutVCache\n", cmp->callInfo.C_afs_PutVCache);
3902     printf("\t%10d CacheStoreProc\n", cmp->callInfo.C_CacheStoreProc);
3903     printf("\t%10d afs_FindDcache\n", cmp->callInfo.C_afs_FindDCache);
3904     printf("\t%10d afs_TryToSmush\n", cmp->callInfo.C_afs_TryToSmush);
3905     printf("\t%10d afs_AdjustSize\n", cmp->callInfo.C_afs_AdjustSize);
3906     printf("\t%10d afs_CheckSize\n", cmp->callInfo.C_afs_CheckSize);
3907     printf("\t%10d afs_StoreWarn\n", cmp->callInfo.C_afs_StoreWarn);
3908     printf("\t%10d CacheFetchProc\n", cmp->callInfo.C_CacheFetchProc);
3909     printf("\t%10d UFS_CacheStoreProc\n", cmp->callInfo.C_UFS_CacheStoreProc);
3910     printf("\t%10d UFS_CacheFetchProc\n", cmp->callInfo.C_UFS_CacheFetchProc);
3911     printf("\t%10d afs_GetDCache\n", cmp->callInfo.C_afs_GetDCache);
3912     printf("\t%10d afs_SimpleVStat\n", cmp->callInfo.C_afs_SimpleVStat);
3913     printf("\t%10d afs_ProcessFS\n", cmp->callInfo.C_afs_ProcessFS);
3914     printf("\t%10d afs_InitCacheInfo\n", cmp->callInfo.C_afs_InitCacheInfo);
3915     printf("\t%10d afs_InitVolumeInfo\n", cmp->callInfo.C_afs_InitVolumeInfo);
3916     printf("\t%10d afs_InitCacheFile\n", cmp->callInfo.C_afs_InitCacheFile);
3917     printf("\t%10d afs_CacheInit\n", cmp->callInfo.C_afs_CacheInit);
3918     printf("\t%10d afs_GetDSlot\n", cmp->callInfo.C_afs_GetDSlot);
3919     printf("\t%10d afs_WriteThroughDSlots\n",
3920            cmp->callInfo.C_afs_WriteThroughDSlots);
3921     printf("\t%10d afs_MemGetDSlot\n", cmp->callInfo.C_afs_MemGetDSlot);
3922     printf("\t%10d afs_UFSGetDSlot\n", cmp->callInfo.C_afs_UFSGetDSlot);
3923     printf("\t%10d afs_StoreDCache\n", cmp->callInfo.C_afs_StoreDCache);
3924     printf("\t%10d afs_StoreMini\n", cmp->callInfo.C_afs_StoreMini);
3925     printf("\t%10d afs_StoreAllSegments\n",
3926            cmp->callInfo.C_afs_StoreAllSegments);
3927     printf("\t%10d afs_InvalidateAllSegments\n",
3928            cmp->callInfo.C_afs_InvalidateAllSegments);
3929     printf("\t%10d afs_TruncateAllSegments\n",
3930            cmp->callInfo.C_afs_TruncateAllSegments);
3931     printf("\t%10d afs_CheckVolSync\n", cmp->callInfo.C_afs_CheckVolSync);
3932     printf("\t%10d afs_wakeup\n", cmp->callInfo.C_afs_wakeup);
3933     printf("\t%10d afs_CFileOpen\n", cmp->callInfo.C_afs_CFileOpen);
3934     printf("\t%10d afs_CFileTruncate\n", cmp->callInfo.C_afs_CFileTruncate);
3935     printf("\t%10d afs_GetDownD\n", cmp->callInfo.C_afs_GetDownD);
3936     printf("\t%10d afs_WriteDCache\n", cmp->callInfo.C_afs_WriteDCache);
3937     printf("\t%10d afs_FlushDCache\n", cmp->callInfo.C_afs_FlushDCache);
3938     printf("\t%10d afs_GetDownDSlot\n", cmp->callInfo.C_afs_GetDownDSlot);
3939     printf("\t%10d afs_FlushVCache\n", cmp->callInfo.C_afs_FlushVCache);
3940     printf("\t%10d afs_GetDownV\n", cmp->callInfo.C_afs_GetDownV);
3941     printf("\t%10d afs_QueueVCB\n", cmp->callInfo.C_afs_QueueVCB);
3942     printf("\t%10d afs_call\n", cmp->callInfo.C_afs_call);
3943     printf("\t%10d afs_syscall_call\n", cmp->callInfo.C_afs_syscall_call);
3944     printf("\t%10d afs_syscall_icreate\n",
3945            cmp->callInfo.C_afs_syscall_icreate);
3946     printf("\t%10d afs_syscall_iopen\n", cmp->callInfo.C_afs_syscall_iopen);
3947     printf("\t%10d afs_syscall_iincdec\n",
3948            cmp->callInfo.C_afs_syscall_iincdec);
3949     printf("\t%10d afs_syscall_ireadwrite\n",
3950            cmp->callInfo.C_afs_syscall_ireadwrite);
3951     printf("\t%10d afs_syscall\n", cmp->callInfo.C_afs_syscall);
3952     printf("\t%10d lpioctl\n", cmp->callInfo.C_lpioctl);
3953     printf("\t%10d lsetpag\n", cmp->callInfo.C_lsetpag);
3954     printf("\t%10d afs_CheckInit\n", cmp->callInfo.C_afs_CheckInit);
3955     printf("\t%10d ClearCallback\n", cmp->callInfo.C_ClearCallBack);
3956     printf("\t%10d SRXAFSCB_GetCE\n", cmp->callInfo.C_SRXAFSCB_GetCE);
3957     printf("\t%10d SRXAFSCB_GetLock\n", cmp->callInfo.C_SRXAFSCB_GetLock);
3958     printf("\t%10d SRXAFSCB_CallBack\n", cmp->callInfo.C_SRXAFSCB_CallBack);
3959     printf("\t%10d SRXAFSCB_InitCallBackState\n",
3960            cmp->callInfo.C_SRXAFSCB_InitCallBackState);
3961     printf("\t%10d SRXAFSCB_Probe\n", cmp->callInfo.C_SRXAFSCB_Probe);
3962     printf("\t%10d afs_Chunk\n", cmp->callInfo.C_afs_Chunk);
3963     printf("\t%10d afs_ChunkBase\n", cmp->callInfo.C_afs_ChunkBase);
3964     printf("\t%10d afs_ChunkOffset\n", cmp->callInfo.C_afs_ChunkOffset);
3965     printf("\t%10d afs_ChunkSize\n", cmp->callInfo.C_afs_ChunkSize);
3966     printf("\t%10d afs_ChunkToBase\n", cmp->callInfo.C_afs_ChunkToBase);
3967     printf("\t%10d afs_ChunkToSize\n", cmp->callInfo.C_afs_ChunkToSize);
3968     printf("\t%10d afs_SetChunkSize\n", cmp->callInfo.C_afs_SetChunkSize);
3969     printf("\t%10d afs_config\n", cmp->callInfo.C_afs_config);
3970     printf("\t%10d mem_freebytes\n", cmp->callInfo.C_mem_freebytes);
3971     printf("\t%10d mem_getbytes\n", cmp->callInfo.C_mem_getbytes);
3972     printf("\t%10d afs_Daemon\n", cmp->callInfo.C_afs_Daemon);
3973     printf("\t%10d afs_CheckRootVolume\n",
3974            cmp->callInfo.C_afs_CheckRootVolume);
3975     printf("\t%10d BPath\n", cmp->callInfo.C_BPath);
3976     printf("\t%10d BPrefetch\n", cmp->callInfo.C_BPrefetch);
3977     printf("\t%10d BStore\n", cmp->callInfo.C_BStore);
3978     printf("\t%10d afs_BBusy\n", cmp->callInfo.C_afs_BBusy);
3979     printf("\t%10d afs_BQueue\n", cmp->callInfo.C_afs_BQueue);
3980     printf("\t%10d afs_BRelease\n", cmp->callInfo.C_afs_BRelease);
3981     printf("\t%10d afs_BackgroundDaemon\n",
3982            cmp->callInfo.C_afs_BackgroundDaemon);
3983     printf("\t%10d exporter_add\n", cmp->callInfo.C_exporter_add);
3984     printf("\t%10d exporter_find\n", cmp->callInfo.C_exporter_find);
3985     printf("\t%10d afs_gfs_kalloc\n", cmp->callInfo.C_afs_gfs_kalloc);
3986     printf("\t%10d afs_gfs_kfree\n", cmp->callInfo.C_afs_gfs_kfree);
3987     printf("\t%10d gop_lookupname\n", cmp->callInfo.C_gop_lookupname);
3988     printf("\t%10d afs_uniqtime\n", cmp->callInfo.C_afs_uniqtime);
3989     printf("\t%10d gfs_vattr_null\n", cmp->callInfo.C_gfs_vattr_null);
3990     printf("\t%10d afs_lock\n", cmp->callInfo.C_afs_lock);
3991     printf("\t%10d afs_unlock\n", cmp->callInfo.C_afs_unlock);
3992     printf("\t%10d afs_update\n", cmp->callInfo.C_afs_update);
3993     printf("\t%10d afs_gclose\n", cmp->callInfo.C_afs_gclose);
3994     printf("\t%10d afs_gopen\n", cmp->callInfo.C_afs_gopen);
3995     printf("\t%10d afs_greadlink\n", cmp->callInfo.C_afs_greadlink);
3996     printf("\t%10d afs_select\n", cmp->callInfo.C_afs_select);
3997     printf("\t%10d afs_gbmap\n", cmp->callInfo.C_afs_gbmap);
3998     printf("\t%10d afs_getfsdata\n", cmp->callInfo.C_afs_getfsdata);
3999     printf("\t%10d afs_gsymlink\n", cmp->callInfo.C_afs_gsymlink);
4000     printf("\t%10d afs_namei\n", cmp->callInfo.C_afs_namei);
4001     printf("\t%10d afs_gmount\n", cmp->callInfo.C_afs_gmount);
4002     printf("\t%10d afs_gget\n", cmp->callInfo.C_afs_gget);
4003     printf("\t%10d afs_glink\n", cmp->callInfo.C_afs_glink);
4004     printf("\t%10d afs_gmkdir\n", cmp->callInfo.C_afs_gmkdir);
4005     printf("\t%10d afs_unlink\n", cmp->callInfo.C_afs_unlink);
4006     printf("\t%10d afs_grmdir\n", cmp->callInfo.C_afs_grmdir);
4007     printf("\t%10d afs_makenode\n", cmp->callInfo.C_afs_makenode);
4008     printf("\t%10d afs_grename\n", cmp->callInfo.C_afs_grename);
4009     printf("\t%10d afs_rele\n", cmp->callInfo.C_afs_rele);
4010     printf("\t%10d afs_syncgp\n", cmp->callInfo.C_afs_syncgp);
4011     printf("\t%10d afs_getval\n", cmp->callInfo.C_afs_getval);
4012     printf("\t%10d afs_trunc\n", cmp->callInfo.C_afs_trunc);
4013     printf("\t%10d afs_rwgp\n", cmp->callInfo.C_afs_rwgp);
4014     printf("\t%10d afs_stat\n", cmp->callInfo.C_afs_stat);
4015     printf("\t%10d afsc_link\n", cmp->callInfo.C_afsc_link);
4016     printf("\t%10d afs_vfs_mount\n", cmp->callInfo.C_afs_vfs_mount);
4017     printf("\t%10d afs_uniqtime\n", cmp->callInfo.C_afs_uniqtime);
4018     printf("\t%10d iopen\n", cmp->callInfo.C_iopen);
4019     printf("\t%10d idec\n", cmp->callInfo.C_idec);
4020     printf("\t%10d iinc\n", cmp->callInfo.C_iinc);
4021     printf("\t%10d ireadwrite\n", cmp->callInfo.C_ireadwrite);
4022     printf("\t%10d iread\n", cmp->callInfo.C_iread);
4023     printf("\t%10d iwrite\n", cmp->callInfo.C_iwrite);
4024     printf("\t%10d iforget\n", cmp->callInfo.C_iforget);
4025     printf("\t%10d icreate\n", cmp->callInfo.C_icreate);
4026     printf("\t%10d igetinode\n", cmp->callInfo.C_igetinode);
4027     printf("\t%10d osi_SleepR\n", cmp->callInfo.C_osi_SleepR);
4028     printf("\t%10d osi_SleepS\n", cmp->callInfo.C_osi_SleepS);
4029     printf("\t%10d osi_SleepW\n", cmp->callInfo.C_osi_SleepW);
4030     printf("\t%10d osi_Sleep\n", cmp->callInfo.C_osi_Sleep);
4031     printf("\t%10d afs_LookupMCE\n", cmp->callInfo.C_afs_LookupMCE);
4032     printf("\t%10d afs_MemReadBlk\n", cmp->callInfo.C_afs_MemReadBlk);
4033     printf("\t%10d afs_MemReadUIO\n", cmp->callInfo.C_afs_MemReadUIO);
4034     printf("\t%10d afs_MemWriteBlk\n", cmp->callInfo.C_afs_MemWriteBlk);
4035     printf("\t%10d afs_MemWriteUIO\n", cmp->callInfo.C_afs_MemWriteUIO);
4036     printf("\t%10d afs_MemCacheStoreProc\n",
4037            cmp->callInfo.C_afs_MemCacheStoreProc);
4038     printf("\t%10d afs_MemCacheFetchProc\n",
4039            cmp->callInfo.C_afs_MemCacheFetchProc);
4040     printf("\t%10d afs_MemCacheTruncate\n",
4041            cmp->callInfo.C_afs_MemCacheTruncate);
4042     printf("\t%10d afs_MemCacheStoreProc\n",
4043            cmp->callInfo.C_afs_MemCacheStoreProc);
4044     printf("\t%10d afs_GetNfsClientPag\n",
4045            cmp->callInfo.C_afs_GetNfsClientPag);
4046     printf("\t%10d afs_FindNfsClientPag\n",
4047            cmp->callInfo.C_afs_FindNfsClientPag);
4048     printf("\t%10d afs_PutNfsClientPag\n",
4049            cmp->callInfo.C_afs_PutNfsClientPag);
4050     printf("\t%10d afs_nfsclient_reqhandler\n",
4051            cmp->callInfo.C_afs_nfsclient_reqhandler);
4052     printf("\t%10d afs_nfsclient_GC\n", cmp->callInfo.C_afs_nfsclient_GC);
4053     printf("\t%10d afs_nfsclient_hold\n", cmp->callInfo.C_afs_nfsclient_hold);
4054     printf("\t%10d afs_nfsclient_stats\n",
4055            cmp->callInfo.C_afs_nfsclient_stats);
4056     printf("\t%10d afs_nfsclient_sysname\n",
4057            cmp->callInfo.C_afs_nfsclient_sysname);
4058     printf("\t%10d afs_rfs_dispatch\n", cmp->callInfo.C_afs_rfs_dispatch);
4059     printf("\t%10d afs_nfs2afscall\n", cmp->callInfo.C_Nfs2AfsCall);
4060     printf("\t%10d afs_sun_xuntext\n", cmp->callInfo.C_afs_sun_xuntext);
4061     printf("\t%10d osi_Active\n", cmp->callInfo.C_osi_Active);
4062     printf("\t%10d osi_FlushPages\n", cmp->callInfo.C_osi_FlushPages);
4063     printf("\t%10d osi_FlushText\n", cmp->callInfo.C_osi_FlushText);
4064     printf("\t%10d osi_CallProc\n", cmp->callInfo.C_osi_CallProc);
4065     printf("\t%10d osi_CancelProc\n", cmp->callInfo.C_osi_CancelProc);
4066     printf("\t%10d osi_Invisible\n", cmp->callInfo.C_osi_Invisible);
4067     printf("\t%10d osi_Time\n", cmp->callInfo.C_osi_Time);
4068     printf("\t%10d osi_Alloc\n", cmp->callInfo.C_osi_Alloc);
4069     printf("\t%10d osi_SetTime\n", cmp->callInfo.C_osi_SetTime);
4070     printf("\t%10d osi_Dump\n", cmp->callInfo.C_osi_Dump);
4071     printf("\t%10d osi_Free\n", cmp->callInfo.C_osi_Free);
4072     printf("\t%10d osi_UFSOpen\n", cmp->callInfo.C_osi_UFSOpen);
4073     printf("\t%10d osi_Close\n", cmp->callInfo.C_osi_Close);
4074     printf("\t%10d osi_Stat\n", cmp->callInfo.C_osi_Stat);
4075     printf("\t%10d osi_Truncate\n", cmp->callInfo.C_osi_Truncate);
4076     printf("\t%10d osi_Read\n", cmp->callInfo.C_osi_Read);
4077     printf("\t%10d osi_Write\n", cmp->callInfo.C_osi_Write);
4078     printf("\t%10d osi_MapStrategy\n", cmp->callInfo.C_osi_MapStrategy);
4079     printf("\t%10d osi_AllocLargeSpace\n",
4080            cmp->callInfo.C_osi_AllocLargeSpace);
4081     printf("\t%10d osi_FreeLargeSpace\n", cmp->callInfo.C_osi_FreeLargeSpace);
4082     printf("\t%10d osi_AllocSmallSpace\n",
4083            cmp->callInfo.C_osi_AllocSmallSpace);
4084     printf("\t%10d osi_FreeSmallSpace\n", cmp->callInfo.C_osi_FreeSmallSpace);
4085     printf("\t%10d osi_CloseToTheEdge\n", cmp->callInfo.C_osi_CloseToTheEdge);
4086     printf("\t%10d osi_xgreedy\n", cmp->callInfo.C_osi_xgreedy);
4087     printf("\t%10d osi_FreeSocket\n", cmp->callInfo.C_osi_FreeSocket);
4088     printf("\t%10d osi_NewSocket\n", cmp->callInfo.C_osi_NewSocket);
4089     printf("\t%10d osi_NetSend\n", cmp->callInfo.C_osi_NetSend);
4090     printf("\t%10d WaitHack\n", cmp->callInfo.C_WaitHack);
4091     printf("\t%10d osi_CancelWait\n", cmp->callInfo.C_osi_CancelWait);
4092     printf("\t%10d osi_Wakeup\n", cmp->callInfo.C_osi_Wakeup);
4093     printf("\t%10d osi_Wait\n", cmp->callInfo.C_osi_Wait);
4094     printf("\t%10d dirp_Read\n", cmp->callInfo.C_dirp_Read);
4095     printf("\t%10d dirp_Cpy\n", cmp->callInfo.C_dirp_Cpy);
4096     printf("\t%10d dirp_Eq\n", cmp->callInfo.C_dirp_Eq);
4097     printf("\t%10d dirp_Write\n", cmp->callInfo.C_dirp_Write);
4098     printf("\t%10d dirp_Zap\n", cmp->callInfo.C_dirp_Zap);
4099     printf("\t%10d afs_ioctl\n", cmp->callInfo.C_afs_ioctl);
4100     printf("\t%10d handleIoctl\n", cmp->callInfo.C_HandleIoctl);
4101     printf("\t%10d afs_xioctl\n", cmp->callInfo.C_afs_xioctl);
4102     printf("\t%10d afs_pioctl\n", cmp->callInfo.C_afs_pioctl);
4103     printf("\t%10d HandlePioctl\n", cmp->callInfo.C_HandlePioctl);
4104     printf("\t%10d PGetVolumeStatus\n", cmp->callInfo.C_PGetVolumeStatus);
4105     printf("\t%10d PSetVolumeStatus\n", cmp->callInfo.C_PSetVolumeStatus);
4106     printf("\t%10d PFlush\n", cmp->callInfo.C_PFlush);
4107     printf("\t%10d PFlushVolumeData\n", cmp->callInfo.C_PFlushVolumeData);
4108     printf("\t%10d PNewStatMount\n", cmp->callInfo.C_PNewStatMount);
4109     printf("\t%10d PGetTokens\n", cmp->callInfo.C_PGetTokens);
4110     printf("\t%10d PSetTokens\n", cmp->callInfo.C_PSetTokens);
4111     printf("\t%10d PUnlog\n", cmp->callInfo.C_PUnlog);
4112     printf("\t%10d PCheckServers\n", cmp->callInfo.C_PCheckServers);
4113     printf("\t%10d PCheckAuth\n", cmp->callInfo.C_PCheckAuth);
4114     printf("\t%10d PCheckVolNames\n", cmp->callInfo.C_PCheckVolNames);
4115     printf("\t%10d PFindVolume\n", cmp->callInfo.C_PFindVolume);
4116     printf("\t%10d Prefetch\n", cmp->callInfo.C_Prefetch);
4117     printf("\t%10d PGetCacheSize\n", cmp->callInfo.C_PGetCacheSize);
4118     printf("\t%10d PSetCacheSize\n", cmp->callInfo.C_PSetCacheSize);
4119     printf("\t%10d PSetSysName\n", cmp->callInfo.C_PSetSysName);
4120     printf("\t%10d PExportAfs\n", cmp->callInfo.C_PExportAfs);
4121     printf("\t%10d HandleClientContext\n",
4122            cmp->callInfo.C_HandleClientContext);
4123     printf("\t%10d PViceAccess\n", cmp->callInfo.C_PViceAccess);
4124     printf("\t%10d PRemoveCallBack\n", cmp->callInfo.C_PRemoveCallBack);
4125     printf("\t%10d PRemoveMount\n", cmp->callInfo.C_PRemoveMount);
4126     printf("\t%10d PSetVolumeStatus\n", cmp->callInfo.C_PSetVolumeStatus);
4127     printf("\t%10d PListCells\n", cmp->callInfo.C_PListCells);
4128     printf("\t%10d PNewCell\n", cmp->callInfo.C_PNewCell);
4129     printf("\t%10d PGetUserCell\n", cmp->callInfo.C_PGetUserCell);
4130     printf("\t%10d PGetCellStatus\n", cmp->callInfo.C_PGetCellStatus);
4131     printf("\t%10d PSetCellStatus\n", cmp->callInfo.C_PSetCellStatus);
4132     printf("\t%10d PVenusLogging\n", cmp->callInfo.C_PVenusLogging);
4133     printf("\t%10d PGetAcl\n", cmp->callInfo.C_PGetAcl);
4134     printf("\t%10d PGetFID\n", cmp->callInfo.C_PGetFID);
4135     printf("\t%10d PSetAcl\n", cmp->callInfo.C_PSetAcl);
4136     printf("\t%10d PGetFileCell\n", cmp->callInfo.C_PGetFileCell);
4137     printf("\t%10d PGetWSCell\n", cmp->callInfo.C_PGetWSCell);
4138     printf("\t%10d PGetSPrefs\n", cmp->callInfo.C_PGetSPrefs);
4139     printf("\t%10d PSetSPrefs\n", cmp->callInfo.C_PSetSPrefs);
4140     printf("\t%10d afs_ResetAccessCache\n",
4141            cmp->callInfo.C_afs_ResetAccessCache);
4142     printf("\t%10d afs_FindUser\n", cmp->callInfo.C_afs_FindUser);
4143     printf("\t%10d afs_GetUser\n", cmp->callInfo.C_afs_GetUser);
4144     printf("\t%10d afs_GCUserData\n", cmp->callInfo.C_afs_GCUserData);
4145     printf("\t%10d afs_PutUser\n", cmp->callInfo.C_afs_PutUser);
4146     printf("\t%10d afs_SetPrimary\n", cmp->callInfo.C_afs_SetPrimary);
4147     printf("\t%10d afs_ResetUserConns\n", cmp->callInfo.C_afs_ResetUserConns);
4148     printf("\t%10d afs_RemoveUserConns\n", cmp->callInfo.C_RemoveUserConns);
4149     printf("\t%10d afs_ResourceInit\n", cmp->callInfo.C_afs_ResourceInit);
4150     printf("\t%10d afs_GetCell\n", cmp->callInfo.C_afs_GetCell);
4151     printf("\t%10d afs_GetCellByIndex\n", cmp->callInfo.C_afs_GetCellByIndex);
4152     printf("\t%10d afs_GetCellByName\n", cmp->callInfo.C_afs_GetCellByName);
4153     printf("\t%10d afs_GetRealCellByIndex\n",
4154            cmp->callInfo.C_afs_GetRealCellByIndex);
4155     printf("\t%10d afs_NewCell\n", cmp->callInfo.C_afs_NewCell);
4156     printf("\t%10d CheckVLDB\n", cmp->callInfo.C_CheckVLDB);
4157     printf("\t%10d afs_GetVolume\n", cmp->callInfo.C_afs_GetVolume);
4158     printf("\t%10d afs_PutVolume\n", cmp->callInfo.C_afs_PutVolume);
4159     printf("\t%10d afs_GetVolumeByName\n",
4160            cmp->callInfo.C_afs_GetVolumeByName);
4161     printf("\t%10d afs_random\n", cmp->callInfo.C_afs_random);
4162     printf("\t%10d InstallVolumeEntry\n", cmp->callInfo.C_InstallVolumeEntry);
4163     printf("\t%10d InstallVolumeInfo\n", cmp->callInfo.C_InstallVolumeInfo);
4164     printf("\t%10d afs_ResetVolumeInfo\n",
4165            cmp->callInfo.C_afs_ResetVolumeInfo);
4166     printf("\t%10d afs_FindServer\n", cmp->callInfo.C_afs_FindServer);
4167     printf("\t%10d afs_GetServer\n", cmp->callInfo.C_afs_GetServer);
4168     printf("\t%10d afs_SortServers\n", cmp->callInfo.C_afs_SortServers);
4169     printf("\t%10d afs_CheckServers\n", cmp->callInfo.C_afs_CheckServers);
4170     printf("\t%10d ServerDown\n", cmp->callInfo.C_ServerDown);
4171     printf("\t%10d afs_Conn\n", cmp->callInfo.C_afs_Conn);
4172     printf("\t%10d afs_PutConn\n", cmp->callInfo.C_afs_PutConn);
4173     printf("\t%10d afs_ConnByHost\n", cmp->callInfo.C_afs_ConnByHost);
4174     printf("\t%10d afs_ConnByMHosts\n", cmp->callInfo.C_afs_ConnByMHosts);
4175     printf("\t%10d afs_Analyze\n", cmp->callInfo.C_afs_Analyze);
4176     printf("\t%10d CheckVLServer\n", cmp->callInfo.C_CheckVLServer);
4177     printf("\t%10d afs_CheckCacheResets\n",
4178            cmp->callInfo.C_afs_CheckCacheResets);
4179     printf("\t%10d afs_CheckVolumeNames\n",
4180            cmp->callInfo.C_afs_CheckVolumeNames);
4181     printf("\t%10d afs_CheckCode\n", cmp->callInfo.C_afs_CheckCode);
4182     printf("\t%10d afs_CopyError\n", cmp->callInfo.C_afs_CopyError);
4183     printf("\t%10d afs_FinalizeReq\n", cmp->callInfo.C_afs_FinalizeReq);
4184     printf("\t%10d afs_GetVolCache\n", cmp->callInfo.C_afs_GetVolCache);
4185     printf("\t%10d afs_GetVolSlot\n", cmp->callInfo.C_afs_GetVolSlot);
4186     printf("\t%10d afs_UFSGetVolSlot\n", cmp->callInfo.C_afs_UFSGetVolSlot);
4187     printf("\t%10d afs_MemGetVolSlot\n", cmp->callInfo.C_afs_MemGetVolSlot);
4188     printf("\t%10d afs_WriteVolCache\n", cmp->callInfo.C_afs_WriteVolCache);
4189     printf("\t%10d haveCallbacksfrom\n", cmp->callInfo.C_HaveCallBacksFrom);
4190     printf("\t%10d afs_getpage\n", cmp->callInfo.C_afs_getpage);
4191     printf("\t%10d afs_putpage\n", cmp->callInfo.C_afs_putpage);
4192     printf("\t%10d afs_nfsrdwr\n", cmp->callInfo.C_afs_nfsrdwr);
4193     printf("\t%10d afs_map\n", cmp->callInfo.C_afs_map);
4194     printf("\t%10d afs_cmp\n", cmp->callInfo.C_afs_cmp);
4195     printf("\t%10d afs_PageLeft\n", cmp->callInfo.C_afs_PageLeft);
4196     printf("\t%10d afs_mount\n", cmp->callInfo.C_afs_mount);
4197     printf("\t%10d afs_unmount\n", cmp->callInfo.C_afs_unmount);
4198     printf("\t%10d afs_root\n", cmp->callInfo.C_afs_root);
4199     printf("\t%10d afs_statfs\n", cmp->callInfo.C_afs_statfs);
4200     printf("\t%10d afs_sync\n", cmp->callInfo.C_afs_sync);
4201     printf("\t%10d afs_vget\n", cmp->callInfo.C_afs_vget);
4202     printf("\t%10d afs_index\n", cmp->callInfo.C_afs_index);
4203     printf("\t%10d afs_setpag\n", cmp->callInfo.C_afs_setpag);
4204     printf("\t%10d genpag\n", cmp->callInfo.C_genpag);
4205     printf("\t%10d getpag\n", cmp->callInfo.C_getpag);
4206     printf("\t%10d genpag\n", cmp->callInfo.C_genpag);
4207     printf("\t%10d afs_GetMariner\n", cmp->callInfo.C_afs_GetMariner);
4208     printf("\t%10d afs_AddMarinerName\n", cmp->callInfo.C_afs_AddMarinerName);
4209     printf("\t%10d afs_open\n", cmp->callInfo.C_afs_open);
4210     printf("\t%10d afs_close\n", cmp->callInfo.C_afs_close);
4211     printf("\t%10d afs_closex\n", cmp->callInfo.C_afs_closex);
4212     printf("\t%10d afs_write\n", cmp->callInfo.C_afs_write);
4213     printf("\t%10d afs_UFSwrite\n", cmp->callInfo.C_afs_UFSWrite);
4214     printf("\t%10d afs_Memwrite\n", cmp->callInfo.C_afs_MemWrite);
4215     printf("\t%10d afs_rdwr\n", cmp->callInfo.C_afs_rdwr);
4216     printf("\t%10d afs_read\n", cmp->callInfo.C_afs_read);
4217     printf("\t%10d afs_UFSread\n", cmp->callInfo.C_afs_UFSRead);
4218     printf("\t%10d afs_Memread\n", cmp->callInfo.C_afs_MemRead);
4219     printf("\t%10d afs_CopyOutAttrs\n", cmp->callInfo.C_afs_CopyOutAttrs);
4220     printf("\t%10d afs_access\n", cmp->callInfo.C_afs_access);
4221     printf("\t%10d afs_getattr\n", cmp->callInfo.C_afs_getattr);
4222     printf("\t%10d afs_setattr\n", cmp->callInfo.C_afs_setattr);
4223     printf("\t%10d afs_VAttrToAS\n", cmp->callInfo.C_afs_VAttrToAS);
4224     printf("\t%10d EvalMountPoint\n", cmp->callInfo.C_EvalMountPoint);
4225     printf("\t%10d afs_lookup\n", cmp->callInfo.C_afs_lookup);
4226     printf("\t%10d afs_create\n", cmp->callInfo.C_afs_create);
4227     printf("\t%10d afs_LocalHero\n", cmp->callInfo.C_afs_LocalHero);
4228     printf("\t%10d afs_remove\n", cmp->callInfo.C_afs_remove);
4229     printf("\t%10d afs_link\n", cmp->callInfo.C_afs_link);
4230     printf("\t%10d afs_rename\n", cmp->callInfo.C_afs_rename);
4231     printf("\t%10d afs_InitReq\n", cmp->callInfo.C_afs_InitReq);
4232     printf("\t%10d afs_mkdir\n", cmp->callInfo.C_afs_mkdir);
4233     printf("\t%10d afs_rmdir\n", cmp->callInfo.C_afs_rmdir);
4234     printf("\t%10d afs_readdir\n", cmp->callInfo.C_afs_readdir);
4235     printf("\t%10d afs_read1dir\n", cmp->callInfo.C_afs_read1dir);
4236     printf("\t%10d afs_readdir_move\n", cmp->callInfo.C_afs_readdir_move);
4237     printf("\t%10d afs_readdir_iter\n", cmp->callInfo.C_afs_readdir_iter);
4238     printf("\t%10d afs_symlink\n", cmp->callInfo.C_afs_symlink);
4239     printf("\t%10d afs_HandleLink\n", cmp->callInfo.C_afs_HandleLink);
4240     printf("\t%10d afs_MemHandleLink\n", cmp->callInfo.C_afs_MemHandleLink);
4241     printf("\t%10d afs_UFSHandleLink\n", cmp->callInfo.C_afs_UFSHandleLink);
4242     printf("\t%10d HandleFlock\n", cmp->callInfo.C_HandleFlock);
4243     printf("\t%10d afs_readlink\n", cmp->callInfo.C_afs_readlink);
4244     printf("\t%10d afs_fsync\n", cmp->callInfo.C_afs_fsync);
4245     printf("\t%10d afs_inactive\n", cmp->callInfo.C_afs_inactive);
4246     printf("\t%10d afs_ustrategy\n", cmp->callInfo.C_afs_ustrategy);
4247     printf("\t%10d afs_strategy\n", cmp->callInfo.C_afs_strategy);
4248     printf("\t%10d afs_bread\n", cmp->callInfo.C_afs_bread);
4249     printf("\t%10d afs_brelse\n", cmp->callInfo.C_afs_brelse);
4250     printf("\t%10d afs_bmap\n", cmp->callInfo.C_afs_bmap);
4251     printf("\t%10d afs_fid\n", cmp->callInfo.C_afs_fid);
4252     printf("\t%10d afs_FakeOpen\n", cmp->callInfo.C_afs_FakeOpen);
4253     printf("\t%10d afs_FakeClose\n", cmp->callInfo.C_afs_FakeClose);
4254     printf("\t%10d afs_StoreOnLastReference\n",
4255            cmp->callInfo.C_afs_StoreOnLastReference);
4256     printf("\t%10d afs_AccessOK\n", cmp->callInfo.C_afs_AccessOK);
4257     printf("\t%10d afs_GetAccessBits\n", cmp->callInfo.C_afs_GetAccessBits);
4258     printf("\t%10d afsio_copy\n", cmp->callInfo.C_afsio_copy);
4259     printf("\t%10d afsio_trim\n", cmp->callInfo.C_afsio_trim);
4260     printf("\t%10d afsio_skip\n", cmp->callInfo.C_afsio_skip);
4261     printf("\t%10d afs_page_read\n", cmp->callInfo.C_afs_page_read);
4262     printf("\t%10d afs_page_write\n", cmp->callInfo.C_afs_page_write);
4263     printf("\t%10d afs_page_read\n", cmp->callInfo.C_afs_page_read);
4264     printf("\t%10d afs_get_groups_from_pag\n",
4265            cmp->callInfo.C_afs_get_groups_from_pag);
4266     printf("\t%10d afs_get_pag_from_groups\n",
4267            cmp->callInfo.C_afs_get_pag_from_groups);
4268     printf("\t%10d AddPag\n", cmp->callInfo.C_AddPag);
4269     printf("\t%10d PagInCred\n", cmp->callInfo.C_PagInCred);
4270     printf("\t%10d afs_getgroups\n", cmp->callInfo.C_afs_getgroups);
4271     printf("\t%10d afs_page_in\n", cmp->callInfo.C_afs_page_in);
4272     printf("\t%10d afs_page_out\n", cmp->callInfo.C_afs_page_out);
4273     printf("\t%10d afs_AdvanceFD\n", cmp->callInfo.C_afs_AdvanceFD);
4274     printf("\t%10d afs_lockf\n", cmp->callInfo.C_afs_lockf);
4275     printf("\t%10d afs_xsetgroups\n", cmp->callInfo.C_afs_xsetgroups);
4276     printf("\t%10d afs_nlinks\n", cmp->callInfo.C_afs_nlinks);
4277     printf("\t%10d afs_lockctl\n", cmp->callInfo.C_afs_lockctl);
4278     printf("\t%10d afs_xflock\n", cmp->callInfo.C_afs_xflock);
4279     printf("\t%10d PGetCPrefs\n", cmp->callInfo.C_PGetCPrefs);
4280     printf("\t%10d PSetCPrefs\n", cmp->callInfo.C_PSetCPrefs);
4281 #ifdef  AFS_HPUX_ENV
4282     printf("\t%10d afs_pagein\n", cmp->callInfo.C_afs_pagein);
4283     printf("\t%10d afs_pageout\n", cmp->callInfo.C_afs_pageout);
4284     printf("\t%10d afs_hp_strategy\n", cmp->callInfo.C_afs_hp_strategy);
4285 #endif
4286 }
4287
4288 #endif