Skip to contentSkip to conversation

v9fs: print 9p messages

PATCH In review Latchesar Ionkov 2 participants 3 messages Mar 4, 2006 – Mar 6, 2006 1 message not in the archive 9P file system

lore
Share & tools
lore

Latchesar Ionkov

author maintainer
#0 lore raw

PATCH 1/1 v9fs: print 9p messages

Print 9p messages.

---
commit 066de5e57e6c8c8a1e0a6c49a342118f474b21e9
tree 1bca71ec5ed8419ee5d5a24cc607fe069940761c
parent c499ec24c31edf270e777a868ffd0daddcfe7ebd
author Latchesar Ionkov <[email protected]> Sat, 04 Mar 2006 10:10:04 -0500 committer Latchesar Ionkov <[email protected]> Sat, 04 Mar 2006 10:10:04 -0500

 fs/9p/Makefile  |    3 
 fs/9p/debug.h   |    1 
 fs/9p/fcprint.c |  347 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/9p/mux.c     |   15 ++
 4 files changed, 365 insertions(+), 1 deletions(-)
fs/9p/Makefile +2 -1
index 2f4ce43..e24784f 100644
@@ -14,5 +14,6 @@ obj-$(CONFIG_9P_FS) := 9p2000.o
 	vfs_dentry.o \
 	error.o \
 	v9fs.o \
-	fid.o
+	fid.o \
+	fcprint.o
 
fs/9p/debug.h +1 -0
index fe55103..ff54a7b 100644
@@ -30,6 +30,7 @@
 #define DEBUG_MUX		(1<<5)
 #define DEBUG_TRANS		(1<<6)
 #define DEBUG_SLABS	      	(1<<7)
+#define DEBUG_FCALL		(1<<8)
 
 #define DEBUG_DUMP_PKT		0
 
fs/9p/fcprint.c new file +347 -0

347 lines not on this page · raw message

fs/9p/mux.c +15 -0
index ea1134e..b19d6a6 100644
@@ -634,6 +634,14 @@ static void v9fs_read_work(void *a)
 			goto error;
 		}
 
+		if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) {
+			char buf[150];
+
+			v9fs_printfcall(buf, sizeof(buf), m->rcall,
+				*m->extended);
+			printk(KERN_NOTICE ">>> %p %s\n", m, buf);
+		}
+
 		rcall = m->rcall;
 		rbuf = m->rbuf;
 		if (m->rpos > n) {
@@ -739,6 +747,13 @@ static struct v9fs_req *v9fs_send_reques
 
 	v9fs_set_tag(tc, n);
 
+	if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) {
+		char buf[150];
+
+		v9fs_printfcall(buf, sizeof(buf), tc, *m->extended);
+		printk(KERN_NOTICE "<<< %p %s\n", m, buf);
+	}
+
 	req->tag = n;
 	req->tcall = tc;
 	req->rcall = NULL;
#1 lore raw

fs/9p/debug.h

Quoted 10 lines · Latchesar Ionkov

Print 9p messages.

...

fs/9p/debug.h +2 -0
+#define DEBUG_FCALL		(1<<8)
 
..
 
+	if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) {

There's no point in the rhs of this comparison. Given that DEBUG_FCALL is a single bit and that won't be changing, one may as well do

	if (v9fs_debug_level & DEBUG_FCALL) {

Also, those macro names:

#define DEBUG_ERROR (1<<0)
#define DEBUG_CURRENT (1<<1)
#define DEBUG_9P (1<<2)
#define DEBUG_VFS (1<<3)
#define DEBUG_CONV (1<<4)
#define DEBUG_MUX (1<<5)
#define DEBUG_TRANS (1<<6)
#define DEBUG_SLABS (1<<7)
#define DEBUG_FCALL (1<<8)

are quite poorly chosen. If someone else were to make a similarly poor naming choice there would be collisions.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 18 lines · David Leimbach
Quoted 13 lines

Also, those macro names:

#define DEBUG_ERROR             (1<<0)
#define DEBUG_CURRENT           (1<<1)
#define DEBUG_9P                (1<<2)
#define DEBUG_VFS               (1<<3)
#define DEBUG_CONV              (1<<4)
#define DEBUG_MUX               (1<<5)
#define DEBUG_TRANS             (1<<6)
#define DEBUG_SLABS             (1<<7)
#define DEBUG_FCALL             (1<<8)
Quoted 2 lines

are quite poorly chosen. If someone else were to make a similarly poor naming choice there would be collisions.

Quoted 5 lines

Would
#define 9P_DEBUG_ERROR
...

be better? it seems they should be better "namespaced".

Well, "P9" would have a better chance of compiing ;)

But yes, that's how it should have been from the outset. Whether you want to do it now depends upon whether you want to put up with that much churn.

If you _are_ prepared to churn the code that much then it would be a good time to think about perhaps permitting all that debug code to be omitted for non-debug builds. Make the various tests evaluate to constant zero if !debug and don't include this newly-added file in non-debug builds at all.

It's all rather low-priority stuff though.