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