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