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