perhaps this should never be pulled up.
anyway, implement dentry cache status dumping for linux.\7f and provide a tool to dump it
disabled (tool, not rpc) by default
====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================
perhaps this should never be pulled up.
anyway, implement dentry cache status dumping for linux.^? and provide a tool to
dump it
disabled (tool, not rpc) by default
====================
perhaps this should never be pulled up.
anyway, implement dentry cache status dumping for linux.^? and provide a tool to
dump it
disabled (tool, not rpc) by default
return code;
}
+
+
+#ifdef AFS_LINUX24_ENV
+extern struct vcache *afs_globalVp;
+
+int recurse_dcache_parent(parent, a_index, addr, inode, flags, time, fileName)
+ struct dentry * parent;
+ afs_int32 a_index;
+ afs_int32 *addr;
+ afs_int32 *inode;
+ afs_int32 *flags;
+ afs_int32 *time;
+ char ** fileName;
+{
+ struct dentry *this_parent = parent;
+ struct list_head *next;
+ int found = 0;
+ struct dentry *dentry;
+
+repeat:
+ next = this_parent->d_subdirs.next;
+resume:
+ while (next != &this_parent->d_subdirs) {
+ struct list_head *tmp = next;
+ dentry = list_entry(tmp, struct dentry, d_child);
+ if (a_index == 0)
+ goto searchdone3;
+ a_index--;
+ next = tmp->next;
+ /*
+ * Descend a level if the d_subdirs list is non-empty.
+ */
+ if (!list_empty(&dentry->d_subdirs)) {
+ this_parent = dentry;
+ goto repeat;
+ }
+ }
+ /*
+ * All done at this level ... ascend and resume the search.
+ */
+ if (this_parent != parent) {
+ next = this_parent->d_child.next;
+ this_parent = this_parent->d_parent;
+ goto resume;
+ }
+ goto ret;
+
+ searchdone3:
+ if (d_unhashed(dentry))
+ *flags = 1;
+ else
+ *flags = 0;
+
+ *fileName = afs_strdup(dentry->d_name.name?dentry->d_name.name:"");
+ *inode = ITOAFS(dentry->d_inode);
+ *addr = atomic_read(&(dentry)->d_count);
+ *time = dentry->d_time;
+
+ return 0;
+ ret:
+ return 1;
+}
+#endif
+
+int SRXAFSCB_GetDE(a_call, a_index, addr, inode, flags, time, fileName)
+ struct rx_call *a_call;
+ afs_int32 a_index;
+ afs_int32 *addr;
+ afs_int32 *inode;
+ afs_int32 *flags;
+ afs_int32 *time;
+ char ** fileName;
+{ /*SRXAFSCB_GetDE*/
+ int code = 0; /*Return code*/
+#ifdef AFS_LINUX24_ENV
+ register int i; /*Loop variable*/
+ register struct vcache *tvc = afs_globalVp;
+ struct dentry *dentry;
+ struct list_head *cur, *head = &(AFSTOI(tvc))->i_dentry;
+
+#ifdef RX_ENABLE_LOCKS
+ AFS_GLOCK();
+#endif /* RX_ENABLE_LOCKS */
+
+#if defined(AFS_LINUX24_ENV)
+ spin_lock(&dcache_lock);
+#endif
+
+ cur = head;
+ while ((cur = cur->next) != head) {
+ dentry = list_entry(cur, struct dentry, d_alias);
+
+ dget_locked(dentry);
+
+#if defined(AFS_LINUX24_ENV)
+ spin_unlock(&dcache_lock);
+#endif
+ if (a_index == 0)
+ goto searchdone2;
+ a_index--;
+
+ if (recurse_dcache_parent(dentry, a_index, addr, inode, flags, time, fileName) == 0) {
+ dput(dentry);
+ code = 0;
+ goto fcnDone;
+ }
+ dput(dentry);
+ }
+ searchdone2:
+ if (cur == head) {
+ /*Past EOF*/
+ code = 1;
+ *fileName = afs_strdup("");
+ goto fcnDone;
+ }
+
+ if (d_unhashed(dentry))
+ *flags = 1;
+ else
+ *flags = 0;
+
+ *fileName = afs_strdup(dentry->d_name.name?dentry->d_name.name:"");
+ *inode = ITOAFS(dentry->d_inode);
+ *addr = atomic_read(&(dentry)->d_count);
+ *time = dentry->d_time;
+
+ dput(dentry);
+ code = 0;
+
+fcnDone:
+
+#ifdef RX_ENABLE_LOCKS
+ AFS_GUNLOCK();
+#endif /* RX_ENABLE_LOCKS */
+#endif
+ return(code);
+
+} /*SRXAFSCB_GetDE*/
OUT struct interfaceAddr *addr,
OUT Capabilities *capabilities
) = 65538;
+
+proc GetDE(
+ IN afs_int32 index,
+ OUT afs_int32 addr,
+ OUT afs_int32 inode,
+ OUT afs_int32 flags,
+ OUT afs_int32 time,
+ OUT string fileName<AFSNAMEMAX>
+) = 65539;
+
struct AFSDBLockDesc lock;
};
+struct AFSDEntry {
+ afs_int32 addr;
+ afs_int32 cell; /*Cell part of the fid*/
+ AFSFid netFid; /*Network part of the fid*/
+ afs_int32 Length;
+ afs_int32 DataVersion;
+ struct AFSDBLockDesc lock;
+ afs_int32 callback;
+ afs_int32 cbExpires;
+ short refCount;
+ short opens;
+ short writers;
+ char mvstat;
+ char states;
+};
+
/*
* Callback types.
*/
*/
return (0);
}
+
+int SRXAFSCB_GetDE(a_call, a_index, addr, inode, flags, time, fileName)
+ struct rx_call *a_call;
+ afs_int32 a_index;
+ afs_int32 addr;
+ afs_int32 inode;
+ afs_int32 flags;
+ afs_int32 time;
+ char ** fileName;
+{
+ return RXGEN_OPCODE;
+}
${DEST}/bin/cmdebug: cmdebug
${INSTALL} -s $? $@
+${DEST}/bin/dedebug: dedebug
+ ${INSTALL} -s $? $@
up.o: up.c AFS_component_version_number.c
cmdebug: cmdebug.o ${CMLIBS}
$(CC) -o cmdebug cmdebug.o ${CFLAGS} ${CMLIBS} ${XLIBS}
+dedebug.o: dedebug.c ${INCLS} AFS_component_version_number.c
+
+dedebug: dedebug.o ${CMLIBS}
+ $(CC) -o dedebug dedebug.o ${CFLAGS} ${CMLIBS} ${XLIBS}
+
#
#
clean:
- $(RM) -f *.o *.a up fs kdump-* kdump kdump64 core cmdebug AFS_component_version_number.c fstrace gcpags livesys
+ $(RM) -f *.o *.a up fs kdump-* kdump kdump64 core cmdebug AFS_component_version_number.c fstrace gcpags livesys dedebug
test:
cd test; $(MAKE)
${DESTDIR}${bindir}/cmdebug: cmdebug
${INSTALL} -s $? $@
+${DESTDIR}${bindir}/dedebug: dedebug
+ ${INSTALL} -s $? $@
+
${DESTDIR}${sbindir}/kdump: kdump-build
-set -x; \
case ${SYS_NAME} in \
--- /dev/null
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License. For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+
+RCSID("$Header$");
+
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <stdio.h>
+#ifdef AFS_AIX32_ENV
+#include <signal.h>
+#endif
+#include <afs/afscbint.h>
+#include <afs/cmd.h>
+#include <rx/rx.h>
+#include <lock.h>
+
+extern struct rx_securityClass *rxnull_NewServerSecurityObject();
+extern struct hostent *hostutil_GetHostByName();
+
+static PrintCacheEntries(struct rx_connection *aconn, int aint32)
+{
+ register int i;
+ register afs_int32 code, addr, inode, flags, time;
+ char *fileName;
+
+ for(i=0;i<100000;i++) {
+ code = RXAFSCB_GetDE(aconn, i, &addr, &inode, &flags, &time, &fileName);
+ if (code) {
+ if (code == 1) break;
+ printf("cmdebug: failed to get cache entry %d (%s)\n", i,
+ error_message(code));
+ return code;
+ }
+
+ /* otherwise print this entry */
+ printf("%d: ** dentry %d %08x %d %d %s\n",
+ i, addr, inode, flags, time, fileName);
+
+ printf("\n");
+ }
+ printf("Returned %d entries.\n", i);
+ return 0;
+}
+
+static CommandProc(as)
+struct cmd_syndesc *as; {
+ struct rx_connection *conn;
+ register char *hostName;
+ register struct hostent *thp;
+ afs_int32 port;
+ struct rx_securityClass *secobj;
+ int int32p;
+ afs_int32 addr;
+
+ hostName = as->parms[0].items->data;
+ if (as->parms[1].items)
+ port = atoi(as->parms[1].items->data);
+ else
+ port = 7001;
+ thp = hostutil_GetHostByName(hostName);
+ if (!thp) {
+ printf("cmdebug: can't resolve address for host %s.\n", hostName);
+ exit(1);
+ }
+ memcpy(&addr, thp->h_addr, sizeof(afs_int32));
+ 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);
+ exit(1);
+ }
+ if (as->parms[2].items) int32p = 1;
+ else int32p = 0;
+ PrintCacheEntries(conn, int32p);
+ return 0;
+}
+
+#include "AFS_component_version_number.c"
+
+main(argc, argv)
+int argc;
+char **argv; {
+ register struct cmd_syndesc *ts;
+
+#ifdef AFS_AIX32_ENV
+ /*
+ * The following signal action for AIX is necessary so that in case of a
+ * crash (i.e. core is generated) we can include the user's data section
+ * in the core dump. Unfortunately, by default, only a partial core is
+ * 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;
+ sigaction(SIGSEGV, &nsa, NULL);
+#endif
+ rx_Init(0);
+
+ ts = cmd_CreateSyntax((char *) 0, CommandProc, 0, "probe unik server");
+ 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_Dispatch(argc, argv);
+ exit(0);
+}
*/
return (0);
}
+
+int SRXAFSCB_GetDE(a_call, a_index, addr, inode, flags, time, fileName)
+ struct rx_call *a_call;
+ afs_int32 a_index;
+ afs_int32 addr;
+ afs_int32 inode;
+ afs_int32 flags;
+ afs_int32 time;
+ char ** fileName;
+{
+ return RXGEN_OPCODE;
+}