#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header$");
+RCSID
+ ("$Header$");
#include <sys/types.h>
extern struct hostent *hostutil_GetHostByName();
-static PrintCacheConfig(aconn)
- struct rx_connection *aconn;
+static
+PrintCacheConfig(aconn)
+ struct rx_connection *aconn;
{
struct cacheConfig c;
afs_uint32 srv_ver, conflen;
return 0;
}
- c1 = (struct cm_initparams_v1 *) c.cacheConfig_val;
+ c1 = (struct cm_initparams_v1 *)c.cacheConfig_val;
printf("Chunk files: %d\n", c1->nChunkFiles);
printf("Stat caches: %d\n", c1->nStatCaches);
printf("Data caches: %d\n", c1->nDataCaches);
}
}
-static PrintInterfaces(aconn)
- struct rx_connection *aconn;
+static
+PrintInterfaces(aconn)
+ struct rx_connection *aconn;
{
struct interfaceAddr addr;
int i, code;
code = RXAFSCB_WhoAreYou(aconn, &addr);
if (code) {
- printf("cmdebug: error checking interfaces: %s\n", error_message(code));
+ printf("cmdebug: error checking interfaces: %s\n",
+ error_message(code));
return 0;
}
printf("Host interfaces:\n");
- for (i=0; i<addr.numberOfInterfaces; i++) {
+ for (i = 0; i < addr.numberOfInterfaces; i++) {
printf("%s", afs_inet_ntoa(htonl(addr.addr_in[i])));
if (addr.subnetmask[i])
printf(", netmask %s", afs_inet_ntoa(htonl(addr.subnetmask[i])));
return 0;
}
-static IsLocked(alock)
-register struct AFSDBLockDesc *alock; {
- if (alock->waitStates || alock->exclLocked
- || alock->numWaiting || alock->readersReading)
+static
+IsLocked(alock)
+ register struct AFSDBLockDesc *alock;
+{
+ if (alock->waitStates || alock->exclLocked || alock->numWaiting
+ || alock->readersReading)
return 1;
return 0;
}
-static PrintLock(alock)
-register struct AFSDBLockDesc *alock; {
+static
+PrintLock(alock)
+ register struct AFSDBLockDesc *alock;
+{
printf("(");
if (alock->waitStates) {
if (alock->waitStates & READ_LOCK)
printf("writer_waiting");
if (alock->waitStates & SHARED_LOCK)
printf("upgrade_waiting");
- }
- else
+ } else
printf("none_waiting");
if (alock->exclLocked) {
if (alock->exclLocked & WRITE_LOCK)
printf(", write_locked");
if (alock->exclLocked & SHARED_LOCK)
printf(", upgrade_locked");
- printf("(pid:%d at:%d)", alock->pid_writer, alock->src_indicator);
+ printf("(pid:%d at:%d)", alock->pid_writer, alock->src_indicator);
}
if (alock->readersReading)
- printf(", %d read_locks(pid:%d)", alock->readersReading,alock->pid_last_reader);
- if (alock->numWaiting) printf(", %d waiters", alock->numWaiting);
+ printf(", %d read_locks(pid:%d)", alock->readersReading,
+ alock->pid_last_reader);
+ if (alock->numWaiting)
+ printf(", %d waiters", alock->numWaiting);
printf(")");
return 0;
}
-static PrintLocks(aconn, aint32)
-int aint32;
-register struct rx_connection *aconn; {
+static
+PrintLocks(aconn, aint32)
+ int aint32;
+ register struct rx_connection *aconn;
+{
register int i;
struct AFSDBLock lock;
afs_int32 code;
- for(i=0;i<1000;i++) {
+ for (i = 0; i < 1000; i++) {
code = RXAFSCB_GetLock(aconn, i, &lock);
if (code) {
- if (code == 1) break;
+ if (code == 1)
+ break;
/* otherwise we have an unrecognized error */
- printf("cmdebug: error checking locks: %s\n", error_message(code));
+ printf("cmdebug: error checking locks: %s\n",
+ error_message(code));
return code;
}
/* here we have the lock information, so display it, perhaps */
struct cell_cache *next;
};
-static char *GetCellName(struct rx_connection *aconn, afs_int32 cellnum)
+static char *
+GetCellName(struct rx_connection *aconn, afs_int32 cellnum)
{
static int no_getcellbynum;
static struct cell_cache *cache;
}
if (sl.serverList_val)
- free (sl.serverList_val);
+ free(sl.serverList_val);
tcp = malloc(sizeof(struct cell_cache));
tcp->next = cache;
tcp->cellnum = cellnum;
return cellname;
}
-static int PrintCacheEntries32(struct rx_connection *aconn, int aint32)
+static int
+PrintCacheEntries32(struct rx_connection *aconn, int aint32)
{
register int i;
register afs_int32 code;
struct AFSDBCacheEntry centry;
char *cellname;
-
- for(i=0;i<10000;i++) {
+
+ for (i = 0; i < 10000; i++) {
code = RXAFSCB_GetCE(aconn, i, ¢ry);
if (code) {
- if (code == 1) break;
+ if (code == 1)
+ break;
printf("cmdebug: failed to get cache entry %d (%s)\n", i,
error_message(code));
return code;
if (centry.addr == 0) {
/* PS output */
printf("Proc %4d sleeping at %08x, pri %3d\n",
- centry.netFid.Vnode, centry.netFid.Volume, centry.netFid.Unique-25);
+ centry.netFid.Vnode, centry.netFid.Volume,
+ centry.netFid.Unique - 25);
continue;
}
- if (!aint32 && !IsLocked(¢ry.lock)) continue;
+ if (!aint32 && !IsLocked(¢ry.lock))
+ continue;
/* otherwise print this entry */
printf("** Cache entry @ 0x%08x for %d.%d.%d.%d", centry.addr,
PrintLock(¢ry.lock);
printf("\n");
}
- printf(" %d bytes\tDV %d refcnt %d\n", centry.Length, centry.DataVersion, centry.refCount);
- printf(" callback %08x\texpires %u\n", centry.callback, centry.cbExpires);
+ printf(" %d bytes\tDV %d refcnt %d\n", centry.Length,
+ centry.DataVersion, centry.refCount);
+ printf(" callback %08x\texpires %u\n", centry.callback,
+ centry.cbExpires);
printf(" %d opens\t%d writers\n", centry.opens, centry.writers);
/* now display states */
printf(" ");
- if (centry.mvstat == 0) printf("normal file");
- else if (centry.mvstat == 1) printf("mount point");
- else if (centry.mvstat == 2) printf("volume root");
- else printf("bogus mvstat %d", centry.mvstat);
+ if (centry.mvstat == 0)
+ printf("normal file");
+ else if (centry.mvstat == 1)
+ printf("mount point");
+ else if (centry.mvstat == 2)
+ printf("volume root");
+ else
+ printf("bogus mvstat %d", centry.mvstat);
printf("\n states (0x%x)", centry.states);
- if (centry.states & 1) printf(", stat'd");
- if (centry.states & 2) printf(", backup");
- if (centry.states & 4) printf(", read-only");
- if (centry.states & 8) printf(", mt pt valid");
- if (centry.states & 0x10) printf(", pending core");
- if (centry.states & 0x40) printf(", wait-for-store");
- if (centry.states & 0x80) printf(", mapped");
+ if (centry.states & 1)
+ printf(", stat'd");
+ if (centry.states & 2)
+ printf(", backup");
+ if (centry.states & 4)
+ printf(", read-only");
+ if (centry.states & 8)
+ printf(", mt pt valid");
+ if (centry.states & 0x10)
+ printf(", pending core");
+ if (centry.states & 0x40)
+ printf(", wait-for-store");
+ if (centry.states & 0x80)
+ printf(", mapped");
printf("\n");
}
return 0;
}
-static int PrintCacheEntries64(struct rx_connection *aconn, int aint32)
+static int
+PrintCacheEntries64(struct rx_connection *aconn, int aint32)
{
register int i;
register afs_int32 code;
struct AFSDBCacheEntry64 centry;
char *cellname;
int ce64 = 0;
-
- for(i=0;i<10000;i++) {
+
+ for (i = 0; i < 10000; i++) {
code = RXAFSCB_GetCE64(aconn, i, ¢ry);
if (code) {
- if (code == 1) break;
+ if (code == 1)
+ break;
printf("cmdebug: failed to get cache entry %d (%s)\n", i,
error_message(code));
return code;
if (centry.addr == 0) {
/* PS output */
printf("Proc %4d sleeping at %08x, pri %3d\n",
- centry.netFid.Vnode, centry.netFid.Volume, centry.netFid.Unique-25);
+ centry.netFid.Vnode, centry.netFid.Volume,
+ centry.netFid.Unique - 25);
continue;
}
- if (!aint32 && !IsLocked(¢ry.lock)) continue;
+ if (!aint32 && !IsLocked(¢ry.lock))
+ continue;
/* otherwise print this entry */
printf("** Cache entry @ 0x%08x for %d.%d.%d.%d", centry.addr,
printf("\n");
}
#ifdef AFS_64BIT_ENV
- printf(" %lld bytes\tDV %d refcnt %d\n", centry.Length, centry.DataVersion, centry.refCount);
+ printf(" %lld bytes\tDV %d refcnt %d\n", centry.Length,
+ centry.DataVersion, centry.refCount);
#else
- printf(" %d bytes\tDV %d refcnt %d\n", centry.Length, centry.DataVersion, centry.refCount);
+ printf(" %d bytes\tDV %d refcnt %d\n", centry.Length,
+ centry.DataVersion, centry.refCount);
#endif
- printf(" callback %08x\texpires %u\n", centry.callback, centry.cbExpires);
+ printf(" callback %08x\texpires %u\n", centry.callback,
+ centry.cbExpires);
printf(" %d opens\t%d writers\n", centry.opens, centry.writers);
/* now display states */
printf(" ");
- if (centry.mvstat == 0) printf("normal file");
- else if (centry.mvstat == 1) printf("mount point");
- else if (centry.mvstat == 2) printf("volume root");
- else printf("bogus mvstat %d", centry.mvstat);
+ if (centry.mvstat == 0)
+ printf("normal file");
+ else if (centry.mvstat == 1)
+ printf("mount point");
+ else if (centry.mvstat == 2)
+ printf("volume root");
+ else
+ printf("bogus mvstat %d", centry.mvstat);
printf("\n states (0x%x)", centry.states);
- if (centry.states & 1) printf(", stat'd");
- if (centry.states & 2) printf(", backup");
- if (centry.states & 4) printf(", read-only");
- if (centry.states & 8) printf(", mt pt valid");
- if (centry.states & 0x10) printf(", pending core");
- if (centry.states & 0x40) printf(", wait-for-store");
- if (centry.states & 0x80) printf(", mapped");
+ if (centry.states & 1)
+ printf(", stat'd");
+ if (centry.states & 2)
+ printf(", backup");
+ if (centry.states & 4)
+ printf(", read-only");
+ if (centry.states & 8)
+ printf(", mt pt valid");
+ if (centry.states & 0x10)
+ printf(", pending core");
+ if (centry.states & 0x40)
+ printf(", wait-for-store");
+ if (centry.states & 0x80)
+ printf(", mapped");
printf("\n");
}
return 0;
}
-static int PrintCacheEntries(struct rx_connection *aconn, int aint32)
+static int
+PrintCacheEntries(struct rx_connection *aconn, int aint32)
{
register afs_int32 code;
struct AFSDBCacheEntry64 centry64;
-
+
code = RXAFSCB_GetCE64(aconn, 0, ¢ry64);
- if (code != RXGEN_OPCODE)
+ if (code != RXGEN_OPCODE)
return PrintCacheEntries64(aconn, aint32);
else
return PrintCacheEntries32(aconn, aint32);
}
-static CommandProc(as)
-struct cmd_syndesc *as; {
+static
+CommandProc(as)
+ struct cmd_syndesc *as;
+{
struct rx_connection *conn;
register char *hostName;
register struct hostent *thp;
secobj = rxnull_NewServerSecurityObject();
conn = rx_NewConnection(addr, htons(port), 1, secobj, 0);
if (!conn) {
- printf("cmdebug: failed to create connection for host %s\n", hostName);
+ printf("cmdebug: failed to create connection for host %s\n",
+ hostName);
exit(1);
}
if (as->parms[3].items) {
PrintCacheConfig(conn);
return 0;
}
- if (as->parms[2].items) int32p = 1;
- else int32p = 0;
+ if (as->parms[2].items)
+ int32p = 1;
+ else
+ int32p = 0;
PrintLocks(conn, int32p);
PrintCacheEntries(conn, int32p);
return 0;
#include "AFS_component_version_number.c"
main(argc, argv)
-int argc;
-char **argv; {
+ int argc;
+ char **argv;
+{
register struct cmd_syndesc *ts;
#ifdef AFS_AIX32_ENV
* generated which, in many cases, isn't too useful.
*/
struct sigaction nsa;
-
+
sigemptyset(&nsa.sa_mask);
nsa.sa_handler = SIG_DFL;
nsa.sa_flags = SA_FULLDUMP;
cmd_AddParm(ts, "-servers", CMD_SINGLE, CMD_REQUIRED, "server machine");
cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "IP port");
cmd_AddParm(ts, "-long", CMD_FLAG, CMD_OPTIONAL, "print all info");
- cmd_AddParm(ts, "-addrs", CMD_FLAG, CMD_OPTIONAL, "print only host interfaces");
- cmd_AddParm(ts, "-cache", CMD_FLAG, CMD_OPTIONAL, "print only cache configuration");
+ cmd_AddParm(ts, "-addrs", CMD_FLAG, CMD_OPTIONAL,
+ "print only host interfaces");
+ cmd_AddParm(ts, "-cache", CMD_FLAG, CMD_OPTIONAL,
+ "print only cache configuration");
cmd_Dispatch(argc, argv);
exit(0);