Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpuffs Export the opid -> opstr tables (for outside de...



details:   https://anonhg.NetBSD.org/src/rev/1d243e1f42a9
branches:  trunk
changeset: 756306:1d243e1f42a9
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun Jul 11 12:29:08 2010 +0000

description:
Export the opid -> opstr tables (for outside debugging use).

diffstat:

 lib/libpuffs/opdump.c    |  46 +++++++++++++++++++++++++---------------------
 lib/libpuffs/puffsdump.h |  12 +++++++++++-
 2 files changed, 36 insertions(+), 22 deletions(-)

diffs (137 lines):

diff -r 9d3bc30456d3 -r 1d243e1f42a9 lib/libpuffs/opdump.c
--- a/lib/libpuffs/opdump.c     Sun Jul 11 12:26:19 2010 +0000
+++ b/lib/libpuffs/opdump.c     Sun Jul 11 12:29:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: opdump.c,v 1.33 2010/05/21 10:43:07 pooka Exp $        */
+/*     $NetBSD: opdump.c,v 1.34 2010/07/11 12:29:08 pooka Exp $        */
 
 /*
  * Copyright (c) 2005, 2006  Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: opdump.c,v 1.33 2010/05/21 10:43:07 pooka Exp $");
+__RCSID("$NetBSD: opdump.c,v 1.34 2010/07/11 12:29:08 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -49,8 +49,7 @@
 
 #define DINT "    "
 
-/* XXX! */
-const char *vfsop_revmap[] = {
+const char *puffsdump_vfsop_revmap[] = {
        "PUFFS_VFS_MOUNT",
        "PUFFS_VFS_START",
        "PUFFS_VFS_UNMOUNT",
@@ -67,8 +66,9 @@
        "PUFFS_VFS_EXTATTRCTL",
        "PUFFS_VFS_SUSPEND"
 };
-/* XXX! */
-const char *vnop_revmap[] = {
+size_t puffsdump_vfsop_count = __arraycount(puffsdump_vfsop_revmap);
+
+const char *puffsdump_vnop_revmap[] = {
        "PUFFS_VN_LOOKUP",
        "PUFFS_VN_CREATE",
        "PUFFS_VN_MKNOD",
@@ -117,12 +117,14 @@
        "PUFFS_VN_SETEXTATTR",
        "PUFFS_VN_CLOSEEXTATTR",
 };
+size_t puffsdump_vnop_count = __arraycount(puffsdump_vnop_revmap);
+
 /* XXX! */
-const char *cacheop_revmap[] = {
+const char *puffsdump_cacheop_revmap[] = {
        "PUFFS_CACHE_WRITE"
 };
-/* XXX! */
-const char *errnot_revmap[] = {
+
+const char *puffsdump_errnot_revmap[] = {
        "PUFFS_ERR_ERROR",
        "PUFFS_ERR_MAKENODE",
        "PUFFS_ERR_LOOKUP",
@@ -134,14 +136,16 @@
        "PUFFS_ERR_GETEXTATTR",
        "PUFFS_ERR_LISTEXTATTR",
 };
-/* XXX! */
-const char *flush_revmap[] = {
+size_t puffsdump_errnot_count = __arraycount(puffsdump_errnot_revmap);
+
+const char *puffsdump_flush_revmap[] = {
        "PUFFS_INVAL_NAMECACHE_NODE",
        "PUFFS_INVAL_NAMECACHE_DIR",
        "PUFFS_INVAL_NAMECACHE_ALL",
        "PUFFS_INVAL_PAGECACHE_NODE_RANGE",
        "PUFFS_FLUSH_PAGECACHE_NODE_RANGE",
 };
+size_t puffsdump_flush_count = __arraycount(puffsdump_flush_revmap);
 
 void
 puffsdump_req(struct puffs_req *preq)
@@ -158,25 +162,25 @@
        opclass = PUFFSOP_OPCLASS(preq->preq_opclass);
        switch (opclass) {
        case PUFFSOP_VFS:
-               map = vfsop_revmap;
-               maxhandle = __arraycount(vfsop_revmap);
+               map = puffsdump_vfsop_revmap;
+               maxhandle = puffsdump_vfsop_count;
                break;
        case PUFFSOP_VN:
-               map = vnop_revmap;
-               maxhandle = __arraycount(vnop_revmap);
+               map = puffsdump_vnop_revmap;
+               maxhandle = puffsdump_vnop_count;
                isvn = 1;
                break;
        case PUFFSOP_CACHE:
-               map = cacheop_revmap;
-               maxhandle = __arraycount(cacheop_revmap);
+               map = puffsdump_cacheop_revmap;
+               maxhandle = __arraycount(puffsdump_cacheop_revmap);
                break;
        case PUFFSOP_ERROR:
-               map = errnot_revmap;
-               maxhandle = __arraycount(errnot_revmap);
+               map = puffsdump_errnot_revmap;
+               maxhandle = puffsdump_errnot_count;
                break;
        case PUFFSOP_FLUSH:
-               map = flush_revmap;
-               maxhandle = __arraycount(flush_revmap);
+               map = puffsdump_flush_revmap;
+               maxhandle = puffsdump_flush_count;
                break;
        default:
                printf("unhandled opclass %d\n", opclass);
diff -r 9d3bc30456d3 -r 1d243e1f42a9 lib/libpuffs/puffsdump.h
--- a/lib/libpuffs/puffsdump.h  Sun Jul 11 12:26:19 2010 +0000
+++ b/lib/libpuffs/puffsdump.h  Sun Jul 11 12:29:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffsdump.h,v 1.14 2010/01/07 20:47:47 pooka Exp $     */
+/*     $NetBSD: puffsdump.h,v 1.15 2010/07/11 12:29:08 pooka Exp $     */
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -55,4 +55,14 @@
 void puffsdump_attr(struct puffs_req *);
 void puffsdump_targ(struct puffs_req *);
 
+extern const char *puffsdump_vfsop_revmap[];
+extern const char *puffsdump_vnop_revmap[];
+extern const char *puffsdump_errnot_revmap[];
+extern const char *puffsdump_flush_revmap[];
+
+extern size_t puffsdump_vfsop_count;
+extern size_t puffsdump_vnop_count;
+extern size_t puffsdump_errnot_count;
+extern size_t puffsdump_flush_count;
+
 #endif /* _PUFFSDUMP_H_ */



Home | Main Index | Thread Index | Old Index