summaryrefslogtreecommitdiff
path: root/net/9p/protocol.c
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2011-07-25 17:59:46 (GMT)
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-25 18:53:52 (GMT)
commit5f00bcb38ef9a980a33c6dbdc0044964b05f22dd (patch)
tree3175fb9375aecb50bde1be0bf4fa8aa8155131d6 /net/9p/protocol.c
parent34006cee28f7344f9557a4be3816c7891b1bbab1 (diff)
parentb6844e8f64920cdee620157252169ba63afb0c89 (diff)
downloadlinux-5f00bcb38ef9a980a33c6dbdc0044964b05f22dd.tar.xz
Merge branch 'master' into devel and apply fixup from Stephen Rothwell:
vfs/nfs: fixup for nfs_open_context change Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/9p/protocol.c')
-rw-r--r--net/9p/protocol.c44
1 files changed, 17 insertions, 27 deletions
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index a873277..df58375 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -44,30 +44,24 @@ p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...);
void
p9pdu_dump(int way, struct p9_fcall *pdu)
{
- int i, n;
- u8 *data = pdu->sdata;
- int datalen = pdu->size;
- char buf[255];
- int buflen = 255;
-
- i = n = 0;
- if (datalen > (buflen-16))
- datalen = buflen-16;
- while (i < datalen) {
- n += scnprintf(buf + n, buflen - n, "%02x ", data[i]);
- if (i%4 == 3)
- n += scnprintf(buf + n, buflen - n, " ");
- if (i%32 == 31)
- n += scnprintf(buf + n, buflen - n, "\n");
-
- i++;
+ int len = pdu->size;
+
+ if ((p9_debug_level & P9_DEBUG_VPKT) != P9_DEBUG_VPKT) {
+ if ((p9_debug_level & P9_DEBUG_PKT) == P9_DEBUG_PKT) {
+ if (len > 32)
+ len = 32;
+ } else {
+ /* shouldn't happen */
+ return;
+ }
}
- n += scnprintf(buf + n, buflen - n, "\n");
if (way)
- P9_DPRINTK(P9_DEBUG_PKT, "[[[(%d) %s\n", datalen, buf);
+ print_hex_dump_bytes("[9P] ", DUMP_PREFIX_OFFSET, pdu->sdata,
+ len);
else
- P9_DPRINTK(P9_DEBUG_PKT, "]]](%d) %s\n", datalen, buf);
+ print_hex_dump_bytes("]9P[ ", DUMP_PREFIX_OFFSET, pdu->sdata,
+ len);
}
#else
void
@@ -610,7 +604,7 @@ int p9stat_read(char *buf, int len, struct p9_wstat *st, int proto_version)
ret = p9pdu_readf(&fake_pdu, proto_version, "S", st);
if (ret) {
P9_DPRINTK(P9_DEBUG_9P, "<<< p9stat_read failed: %d\n", ret);
- p9pdu_dump(1, &fake_pdu);
+ P9_DUMP_PKT(0, &fake_pdu);
}
return ret;
@@ -632,11 +626,7 @@ int p9pdu_finalize(struct p9_fcall *pdu)
err = p9pdu_writef(pdu, 0, "d", size);
pdu->size = size;
-#ifdef CONFIG_NET_9P_DEBUG
- if ((p9_debug_level & P9_DEBUG_PKT) == P9_DEBUG_PKT)
- p9pdu_dump(0, pdu);
-#endif
-
+ P9_DUMP_PKT(0, pdu);
P9_DPRINTK(P9_DEBUG_9P, ">>> size=%d type: %d tag: %d\n", pdu->size,
pdu->id, pdu->tag);
@@ -669,7 +659,7 @@ int p9dirent_read(char *buf, int len, struct p9_dirent *dirent,
&dirent->d_off, &dirent->d_type, &nameptr);
if (ret) {
P9_DPRINTK(P9_DEBUG_9P, "<<< p9dirent_read failed: %d\n", ret);
- p9pdu_dump(1, &fake_pdu);
+ P9_DUMP_PKT(1, &fake_pdu);
goto out;
}