diff options
author | Eric Van Hensbergen <ericvh@gmail.com> | 2008-10-17 17:20:07 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2008-10-17 17:20:07 -0400 |
commit | e7f4b8f1a5893ff8296b5b581e16a0b96f60a3b5 (patch) | |
tree | dcf52d5919d2ba1a5f7af7449839c4ada85e11cd /net/9p/protocol.c | |
parent | 02da398b950c5d079c20afaa23f322383e96070a (diff) |
9p: Improve debug support
The new debug support lacks some of the information that the previous fcprint
code provided -- this patch focuses on better presentation of debug data along
with more helpful debug along error paths.
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p/protocol.c')
-rw-r--r-- | net/9p/protocol.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/net/9p/protocol.c b/net/9p/protocol.c index 92cb60bb191b..84fa21271876 100644 --- a/net/9p/protocol.c +++ b/net/9p/protocol.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
30 | #include <linux/uaccess.h> | 30 | #include <linux/uaccess.h> |
31 | #include <linux/sched.h> | ||
31 | #include <net/9p/9p.h> | 32 | #include <net/9p/9p.h> |
32 | #include <net/9p/client.h> | 33 | #include <net/9p/client.h> |
33 | #include "protocol.h" | 34 | #include "protocol.h" |
@@ -52,8 +53,6 @@ | |||
52 | static int | 53 | static int |
53 | p9pdu_writef(struct p9_fcall *pdu, int optional, const char *fmt, ...); | 54 | p9pdu_writef(struct p9_fcall *pdu, int optional, const char *fmt, ...); |
54 | 55 | ||
55 | #define PACKET_DEBUG 0 | ||
56 | |||
57 | void | 56 | void |
58 | p9pdu_dump(int way, struct p9_fcall *pdu) | 57 | p9pdu_dump(int way, struct p9_fcall *pdu) |
59 | { | 58 | { |
@@ -78,9 +77,9 @@ p9pdu_dump(int way, struct p9_fcall *pdu) | |||
78 | n += scnprintf(buf + n, buflen - n, "\n"); | 77 | n += scnprintf(buf + n, buflen - n, "\n"); |
79 | 78 | ||
80 | if (way) | 79 | if (way) |
81 | printk(KERN_NOTICE "[[(%d)[ %s\n", datalen, buf); | 80 | P9_DPRINTK(P9_DEBUG_PKT, "[[[(%d) %s\n", datalen, buf); |
82 | else | 81 | else |
83 | printk(KERN_NOTICE "]](%d)] %s\n", datalen, buf); | 82 | P9_DPRINTK(P9_DEBUG_PKT, "]]](%d) %s\n", datalen, buf); |
84 | } | 83 | } |
85 | EXPORT_SYMBOL(p9pdu_dump); | 84 | EXPORT_SYMBOL(p9pdu_dump); |
86 | 85 | ||
@@ -512,13 +511,20 @@ p9pdu_writef(struct p9_fcall *pdu, int optional, const char *fmt, ...) | |||
512 | int p9stat_read(char *buf, int len, struct p9_wstat *st, int dotu) | 511 | int p9stat_read(char *buf, int len, struct p9_wstat *st, int dotu) |
513 | { | 512 | { |
514 | struct p9_fcall fake_pdu; | 513 | struct p9_fcall fake_pdu; |
514 | int ret; | ||
515 | 515 | ||
516 | fake_pdu.size = len; | 516 | fake_pdu.size = len; |
517 | fake_pdu.capacity = len; | 517 | fake_pdu.capacity = len; |
518 | fake_pdu.sdata = buf; | 518 | fake_pdu.sdata = buf; |
519 | fake_pdu.offset = 0; | 519 | fake_pdu.offset = 0; |
520 | 520 | ||
521 | return p9pdu_readf(&fake_pdu, dotu, "S", st); | 521 | ret = p9pdu_readf(&fake_pdu, dotu, "S", st); |
522 | if (ret) { | ||
523 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9stat_read failed: %d\n", ret); | ||
524 | p9pdu_dump(1, &fake_pdu); | ||
525 | } | ||
526 | |||
527 | return ret; | ||
522 | } | 528 | } |
523 | EXPORT_SYMBOL(p9stat_read); | 529 | EXPORT_SYMBOL(p9stat_read); |
524 | 530 | ||
@@ -536,9 +542,12 @@ int p9pdu_finalize(struct p9_fcall *pdu) | |||
536 | err = p9pdu_writef(pdu, 0, "d", size); | 542 | err = p9pdu_writef(pdu, 0, "d", size); |
537 | pdu->size = size; | 543 | pdu->size = size; |
538 | 544 | ||
539 | if (PACKET_DEBUG) | 545 | if ((p9_debug_level & P9_DEBUG_PKT) == P9_DEBUG_PKT) |
540 | p9pdu_dump(0, pdu); | 546 | p9pdu_dump(0, pdu); |
541 | 547 | ||
548 | P9_DPRINTK(P9_DEBUG_9P, ">>> size=%d type: %d tag: %d\n", pdu->size, | ||
549 | pdu->id, pdu->tag); | ||
550 | |||
542 | return err; | 551 | return err; |
543 | } | 552 | } |
544 | 553 | ||