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