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