aboutsummaryrefslogtreecommitdiffstats
path: root/net/9p/protocol.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/9p/protocol.c')
-rw-r--r--net/9p/protocol.c21
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 @@
52static int 53static int
53p9pdu_writef(struct p9_fcall *pdu, int optional, const char *fmt, ...); 54p9pdu_writef(struct p9_fcall *pdu, int optional, const char *fmt, ...);
54 55
55#define PACKET_DEBUG 0
56
57void 56void
58p9pdu_dump(int way, struct p9_fcall *pdu) 57p9pdu_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}
85EXPORT_SYMBOL(p9pdu_dump); 84EXPORT_SYMBOL(p9pdu_dump);
86 85
@@ -512,13 +511,20 @@ p9pdu_writef(struct p9_fcall *pdu, int optional, const char *fmt, ...)
512int p9stat_read(char *buf, int len, struct p9_wstat *st, int dotu) 511int 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}
523EXPORT_SYMBOL(p9stat_read); 529EXPORT_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