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