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