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