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