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