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