Merge 1.8.0~pre4 packaging into master
[pkg-k5-afs_openafs.git] / src / afs / IRIX / osi_idbg.c
blobdb7f64cdc0d42abb841c35c96665c6e1fbdb638c
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 */
11 * Implementation of Irix IDBG facility for AFS.
13 #include <afsconfig.h>
14 #include "afs/param.h"
17 #ifdef AFS_SGI62_ENV
18 #include "afs/sysincludes.h" /* Standard vendor system headers */
19 #include "afsincludes.h" /* Afs-based standard headers */
20 #include "afs/afs_stats.h" /* statistics */
24 * debugging routine - invoked by calling kp vnode xx
26 static void
27 printflags(unsigned int flags, char **strings)
29 int mask = 1;
31 while (flags != 0) {
32 if (mask & flags) {
33 qprintf("%s ", *strings);
34 flags &= ~mask;
36 mask <<= 1;
37 strings++;
41 char *tab_vcache[] = {
42 "CStatd", /* 1 */
43 "CBackup", /* 2 */
44 "CRO", /* 4 */
45 "CMValid", /* 8 */
46 "CCore", /* 0x10 */
47 "CDirty", /* 0x20 */
48 "CSafeStore", /* 0x40 */
49 "CMAPPED", /* 0x80 */
50 "CNSHARE", /* 0x100 */
53 int
54 idbg_prafsnode(OSI_VC_DECL(avc))
56 OSI_VC_CONVERT(avc);
58 AFS_GLOCK();
59 qprintf(" Len %d DV %d Date %d Own %d Grp %d Mode 0%o Lnk %d\n",
60 avc->f.m.Length, avc->f.m.DataVersion, avc->f.m.Date, avc->f.m.Owner,
61 avc->f.m.Group, avc->f.m.Mode, avc->f.m.LinkCount);
62 qprintf(" flushDV %d mapDV %d truncpos 0x%x cb 0x%x cbE 0x%x\n",
63 avc->flushDV, avc->mapDV, avc->f.truncPos, avc->callback,
64 avc->cbExpires);
65 qprintf(" opens %d ex/wr %d flckcnt %d state 0x%x ", avc->opens,
66 avc->execsOrWriters, avc->flockCount, avc->f.states);
67 printflags(avc->f.states, tab_vcache);
68 qprintf("\n");
69 #ifdef AFS_SGI64_ENV
70 qprintf(" mapcnt %llu, mvstat %d anyAcc 0x%x Access 0x%x\n",
71 avc->mapcnt, avc->mvstat, avc->f.anyAccess, avc->Access);
72 qprintf(" mvid 0x%x &lock 0x%x cred 0x%x\n", avc->mvid.target_root, &avc->lock,
73 avc->cred);
74 qprintf(" rwlock 0x%x (%d) id %llu trips %d\n", &avc->vc_rwlock,
75 valusema(&avc->vc_rwlock), avc->vc_rwlockid, avc->vc_locktrips);
76 #else
77 qprintf(" mapcnt %d mvstat %d anyAcc 0x%x Access 0x%x\n", avc->mapcnt,
78 avc->mvstat, avc->f.anyAccess, avc->Access);
79 qprintf(" mvid 0x%x &lock 0x%x cred 0x%x\n", avc->mvid.target_root, &avc->lock,
80 avc->cred);
81 qprintf(" rwlock 0x%x (%d) id %d trips %d\n", &avc->vc_rwlock,
82 valusema(&avc->vc_rwlock), avc->vc_rwlockid, avc->vc_locktrips);
83 #endif
84 AFS_GUNLOCK();
85 return 0;
88 extern struct afs_q VLRU; /*vcache LRU */
89 static char *tab_vtypes[] = {
90 "VNON",
91 "VREG",
92 "VDIR",
93 "VBLK",
94 "VCHR",
95 "VLNK",
96 "VFIFO",
97 "VXNAM",
98 "VBAD",
99 "VSOCK",
104 idbg_afsvfslist()
106 struct vcache *tvc;
107 struct afs_q *tq;
108 struct afs_q *uq;
109 afs_int32 nodeid; /* what ls prints as 'inode' */
111 AFS_GLOCK();
112 for (tq = VLRU.prev; tq != &VLRU; tq = uq) {
113 tvc = QTOV(tq);
114 uq = QPrev(tq);
115 nodeid = afs_calc_inum(tvc->f.fid.Cell, tvc->f.fid.Fid.Volume,
116 tvc->f.fid.Fid.Vnode);
117 qprintf("avp 0x%x type %s cnt %d pg %d map %d nodeid %lu(0x%lx)\n", tvc,
118 tab_vtypes[((vnode_t *) tvc)->v_type],
119 ((vnode_t *) tvc)->v_count,
120 (int)VN_GET_PGCNT((vnode_t *) tvc), (int)tvc->mapcnt,
121 (long unsigned)nodeid, (long unsigned)nodeid);
123 AFS_GUNLOCK();
124 return 0;
127 static char *tab_userstates[] = {
128 "UHasTokens",
129 "UTokensBad",
130 "UPrimary",
131 "UNeedsReset",
132 "UPAGcounted",
133 "UNK",
136 static void
137 idbg_pruser(struct unixuser *tu)
139 union tokenUnion *token;
141 token = afs_FindToken(tu->tokens, RX_SECIDX_KAD);
143 qprintf("@0x%x nxt 0x%x uid %d (0x%x) cell 0x%x vid 0x%x ref %d\n", tu,
144 tu->next, tu->uid, tu->uid, tu->cell, tu->viceId, tu->refCount);
145 qprintf("time %dRX_SECIDX_KADstLen %d stp 0x%x exp 0x%x ", tu->tokenTime,
146 (token != NULL)?token->rxkad.ticketLen:0,
147 (token != NULL)?token->rxkad.ticket:NULL,
148 tu->exporter);
149 printflags(tu->states, tab_userstates);
150 qprintf("\n");
151 qprintf("ClearToken: handle 0x%x ViceID 0x%x Btime %d Etime %d\n",
152 (token != NULL)?token->rxkad.clearToken.AuthHandle:0,
153 tu->viceId,
154 (token != NULL)?token->rxkad.clearToken.BeginTimestamp:0,
155 (token != NULL)?token->rxkad.clearToken.EndTimestamp:0);
158 extern struct unixuser *afs_users[NUSERS];
160 idbg_afsuser(void *x)
162 struct unixuser *tu;
163 int i;
164 AFS_GLOCK();
166 if (x == (void *)-1L) {
167 for (i = 0; i < NUSERS; i++)
168 for (tu = afs_users[i]; tu; tu = tu->next)
169 idbg_pruser(tu);
170 } else
171 idbg_pruser((struct unixuser *)x);
173 AFS_GUNLOCK();
174 return 0;
177 #endif /* AFS_SGI62_ENV */