diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2011-08-06 15:16:59 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2011-10-24 12:13:12 -0400 |
commit | 348b59012e5c6402741d067cf6eeeb6271999d06 (patch) | |
tree | 38041cac7af6f020fa2756eded6a2d9f31132ffc /net | |
parent | ef6b0807e2c986d5f1cb878e1b32a7cf4c32b4c8 (diff) |
net/9p: Convert net/9p protocol dumps to tracepoints
This helps in more control over debugging.
root@qemu-img-64:~# ls /pass/123
ls: cannot access /pass/123: No such file or directory
root@qemu-img-64:~# cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
ls-1536 [001] 70.928584: 9p_protocol_dump: clnt 18446612132784021504 P9_TWALK(tag = 1)
000: 16 00 00 00 6e 01 00 01 00 00 00 02 00 00 00 01
010: 00 03 00 31 32 33 00 00 00 ff ff ff ff 00 00 00
ls-1536 [001] 70.928587: <stack trace>
=> trace_9p_protocol_dump
=> p9pdu_finalize
=> p9_client_rpc
=> p9_client_walk
=> v9fs_vfs_lookup
=> d_alloc_and_lookup
=> walk_component
=> path_lookupat
ls-1536 [000] 70.929696: 9p_protocol_dump: clnt 18446612132784021504 P9_RLERROR(tag = 1)
000: 0b 00 00 00 07 01 00 02 00 00 00 4e 03 00 02 00
010: 00 00 00 00 03 00 02 00 00 00 00 00 ff 43 00 00
ls-1536 [000] 70.929697: <stack trace>
=> trace_9p_protocol_dump
=> p9_client_rpc
=> p9_client_walk
=> v9fs_vfs_lookup
=> d_alloc_and_lookup
=> walk_component
=> path_lookupat
=> do_path_lookup
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/9p/client.c | 77 | ||||
-rw-r--r-- | net/9p/protocol.c | 53 | ||||
-rw-r--r-- | net/9p/protocol.h | 3 |
3 files changed, 54 insertions, 79 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index b1c02187f862..854ca7a911c4 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -38,6 +38,9 @@ | |||
38 | #include <net/9p/transport.h> | 38 | #include <net/9p/transport.h> |
39 | #include "protocol.h" | 39 | #include "protocol.h" |
40 | 40 | ||
41 | #define CREATE_TRACE_POINTS | ||
42 | #include <trace/events/9p.h> | ||
43 | |||
41 | /* | 44 | /* |
42 | * Client Option Parsing (code inspired by NFS code) | 45 | * Client Option Parsing (code inspired by NFS code) |
43 | * - a little lazy - parse all client options | 46 | * - a little lazy - parse all client options |
@@ -464,11 +467,15 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req) | |||
464 | int ecode; | 467 | int ecode; |
465 | 468 | ||
466 | err = p9_parse_header(req->rc, NULL, &type, NULL, 0); | 469 | err = p9_parse_header(req->rc, NULL, &type, NULL, 0); |
470 | /* | ||
471 | * dump the response from server | ||
472 | * This should be after check errors which poplulate pdu_fcall. | ||
473 | */ | ||
474 | trace_9p_protocol_dump(c, req->rc); | ||
467 | if (err) { | 475 | if (err) { |
468 | P9_DPRINTK(P9_DEBUG_ERROR, "couldn't parse header %d\n", err); | 476 | P9_DPRINTK(P9_DEBUG_ERROR, "couldn't parse header %d\n", err); |
469 | return err; | 477 | return err; |
470 | } | 478 | } |
471 | |||
472 | if (type != P9_RERROR && type != P9_RLERROR) | 479 | if (type != P9_RERROR && type != P9_RLERROR) |
473 | return 0; | 480 | return 0; |
474 | 481 | ||
@@ -525,6 +532,11 @@ static int p9_check_zc_errors(struct p9_client *c, struct p9_req_t *req, | |||
525 | char *ename = NULL; | 532 | char *ename = NULL; |
526 | 533 | ||
527 | err = p9_parse_header(req->rc, NULL, &type, NULL, 0); | 534 | err = p9_parse_header(req->rc, NULL, &type, NULL, 0); |
535 | /* | ||
536 | * dump the response from server | ||
537 | * This should be after parse_header which poplulate pdu_fcall. | ||
538 | */ | ||
539 | trace_9p_protocol_dump(c, req->rc); | ||
528 | if (err) { | 540 | if (err) { |
529 | P9_DPRINTK(P9_DEBUG_ERROR, "couldn't parse header %d\n", err); | 541 | P9_DPRINTK(P9_DEBUG_ERROR, "couldn't parse header %d\n", err); |
530 | return err; | 542 | return err; |
@@ -684,7 +696,8 @@ static struct p9_req_t *p9_client_prepare_req(struct p9_client *c, | |||
684 | err = p9pdu_vwritef(req->tc, c->proto_version, fmt, ap); | 696 | err = p9pdu_vwritef(req->tc, c->proto_version, fmt, ap); |
685 | if (err) | 697 | if (err) |
686 | goto reterr; | 698 | goto reterr; |
687 | p9pdu_finalize(req->tc); | 699 | p9pdu_finalize(c, req->tc); |
700 | trace_9p_client_req(c, type, tag); | ||
688 | return req; | 701 | return req; |
689 | reterr: | 702 | reterr: |
690 | p9_free_req(c, req); | 703 | p9_free_req(c, req); |
@@ -755,13 +768,10 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...) | |||
755 | goto reterr; | 768 | goto reterr; |
756 | 769 | ||
757 | err = p9_check_errors(c, req); | 770 | err = p9_check_errors(c, req); |
758 | if (!err) { | 771 | trace_9p_client_res(c, type, req->rc->tag, err); |
759 | P9_DPRINTK(P9_DEBUG_MUX, "exit: client %p op %d\n", c, type); | 772 | if (!err) |
760 | return req; | 773 | return req; |
761 | } | ||
762 | reterr: | 774 | reterr: |
763 | P9_DPRINTK(P9_DEBUG_MUX, | ||
764 | "exit: client %p op %d error: %d\n", c, type, err); | ||
765 | p9_free_req(c, req); | 775 | p9_free_req(c, req); |
766 | return ERR_PTR(err); | 776 | return ERR_PTR(err); |
767 | } | 777 | } |
@@ -841,13 +851,10 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_client *c, int8_t type, | |||
841 | goto reterr; | 851 | goto reterr; |
842 | 852 | ||
843 | err = p9_check_zc_errors(c, req, uidata, in_hdrlen, kern_buf); | 853 | err = p9_check_zc_errors(c, req, uidata, in_hdrlen, kern_buf); |
844 | if (!err) { | 854 | trace_9p_client_res(c, type, req->rc->tag, err); |
845 | P9_DPRINTK(P9_DEBUG_MUX, "exit: client %p op %d\n", c, type); | 855 | if (!err) |
846 | return req; | 856 | return req; |
847 | } | ||
848 | reterr: | 857 | reterr: |
849 | P9_DPRINTK(P9_DEBUG_MUX, "exit: client %p op %d error: %d\n", c, type, | ||
850 | err); | ||
851 | p9_free_req(c, req); | 858 | p9_free_req(c, req); |
852 | return ERR_PTR(err); | 859 | return ERR_PTR(err); |
853 | } | 860 | } |
@@ -935,7 +942,7 @@ static int p9_client_version(struct p9_client *c) | |||
935 | err = p9pdu_readf(req->rc, c->proto_version, "ds", &msize, &version); | 942 | err = p9pdu_readf(req->rc, c->proto_version, "ds", &msize, &version); |
936 | if (err) { | 943 | if (err) { |
937 | P9_DPRINTK(P9_DEBUG_9P, "version error %d\n", err); | 944 | P9_DPRINTK(P9_DEBUG_9P, "version error %d\n", err); |
938 | P9_DUMP_PKT(1, req->rc); | 945 | trace_9p_protocol_dump(c, req->rc); |
939 | goto error; | 946 | goto error; |
940 | } | 947 | } |
941 | 948 | ||
@@ -1072,15 +1079,14 @@ EXPORT_SYMBOL(p9_client_begin_disconnect); | |||
1072 | struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, | 1079 | struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, |
1073 | char *uname, u32 n_uname, char *aname) | 1080 | char *uname, u32 n_uname, char *aname) |
1074 | { | 1081 | { |
1075 | int err; | 1082 | int err = 0; |
1076 | struct p9_req_t *req; | 1083 | struct p9_req_t *req; |
1077 | struct p9_fid *fid; | 1084 | struct p9_fid *fid; |
1078 | struct p9_qid qid; | 1085 | struct p9_qid qid; |
1079 | 1086 | ||
1080 | P9_DPRINTK(P9_DEBUG_9P, ">>> TATTACH afid %d uname %s aname %s\n", | ||
1081 | afid ? afid->fid : -1, uname, aname); | ||
1082 | err = 0; | ||
1083 | 1087 | ||
1088 | P9_DPRINTK(P9_DEBUG_9P, ">>> TATTACH afid %d uname %s aname %s\n", | ||
1089 | afid ? afid->fid : -1, uname, aname); | ||
1084 | fid = p9_fid_create(clnt); | 1090 | fid = p9_fid_create(clnt); |
1085 | if (IS_ERR(fid)) { | 1091 | if (IS_ERR(fid)) { |
1086 | err = PTR_ERR(fid); | 1092 | err = PTR_ERR(fid); |
@@ -1097,7 +1103,7 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, | |||
1097 | 1103 | ||
1098 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", &qid); | 1104 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", &qid); |
1099 | if (err) { | 1105 | if (err) { |
1100 | P9_DUMP_PKT(1, req->rc); | 1106 | trace_9p_protocol_dump(clnt, req->rc); |
1101 | p9_free_req(clnt, req); | 1107 | p9_free_req(clnt, req); |
1102 | goto error; | 1108 | goto error; |
1103 | } | 1109 | } |
@@ -1157,7 +1163,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname, | |||
1157 | 1163 | ||
1158 | err = p9pdu_readf(req->rc, clnt->proto_version, "R", &nwqids, &wqids); | 1164 | err = p9pdu_readf(req->rc, clnt->proto_version, "R", &nwqids, &wqids); |
1159 | if (err) { | 1165 | if (err) { |
1160 | P9_DUMP_PKT(1, req->rc); | 1166 | trace_9p_protocol_dump(clnt, req->rc); |
1161 | p9_free_req(clnt, req); | 1167 | p9_free_req(clnt, req); |
1162 | goto clunk_fid; | 1168 | goto clunk_fid; |
1163 | } | 1169 | } |
@@ -1224,7 +1230,7 @@ int p9_client_open(struct p9_fid *fid, int mode) | |||
1224 | 1230 | ||
1225 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", &qid, &iounit); | 1231 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", &qid, &iounit); |
1226 | if (err) { | 1232 | if (err) { |
1227 | P9_DUMP_PKT(1, req->rc); | 1233 | trace_9p_protocol_dump(clnt, req->rc); |
1228 | goto free_and_error; | 1234 | goto free_and_error; |
1229 | } | 1235 | } |
1230 | 1236 | ||
@@ -1267,7 +1273,7 @@ int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode, | |||
1267 | 1273 | ||
1268 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", qid, &iounit); | 1274 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", qid, &iounit); |
1269 | if (err) { | 1275 | if (err) { |
1270 | P9_DUMP_PKT(1, req->rc); | 1276 | trace_9p_protocol_dump(clnt, req->rc); |
1271 | goto free_and_error; | 1277 | goto free_and_error; |
1272 | } | 1278 | } |
1273 | 1279 | ||
@@ -1312,7 +1318,7 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, | |||
1312 | 1318 | ||
1313 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", &qid, &iounit); | 1319 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", &qid, &iounit); |
1314 | if (err) { | 1320 | if (err) { |
1315 | P9_DUMP_PKT(1, req->rc); | 1321 | trace_9p_protocol_dump(clnt, req->rc); |
1316 | goto free_and_error; | 1322 | goto free_and_error; |
1317 | } | 1323 | } |
1318 | 1324 | ||
@@ -1351,7 +1357,7 @@ int p9_client_symlink(struct p9_fid *dfid, char *name, char *symtgt, gid_t gid, | |||
1351 | 1357 | ||
1352 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); | 1358 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); |
1353 | if (err) { | 1359 | if (err) { |
1354 | P9_DUMP_PKT(1, req->rc); | 1360 | trace_9p_protocol_dump(clnt, req->rc); |
1355 | goto free_and_error; | 1361 | goto free_and_error; |
1356 | } | 1362 | } |
1357 | 1363 | ||
@@ -1542,12 +1548,11 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset, | |||
1542 | 1548 | ||
1543 | err = p9pdu_readf(req->rc, clnt->proto_version, "D", &count, &dataptr); | 1549 | err = p9pdu_readf(req->rc, clnt->proto_version, "D", &count, &dataptr); |
1544 | if (err) { | 1550 | if (err) { |
1545 | P9_DUMP_PKT(1, req->rc); | 1551 | trace_9p_protocol_dump(clnt, req->rc); |
1546 | goto free_and_error; | 1552 | goto free_and_error; |
1547 | } | 1553 | } |
1548 | 1554 | ||
1549 | P9_DPRINTK(P9_DEBUG_9P, "<<< RREAD count %d\n", count); | 1555 | P9_DPRINTK(P9_DEBUG_9P, "<<< RREAD count %d\n", count); |
1550 | P9_DUMP_PKT(1, req->rc); | ||
1551 | 1556 | ||
1552 | if (non_zc) { | 1557 | if (non_zc) { |
1553 | if (data) { | 1558 | if (data) { |
@@ -1617,7 +1622,7 @@ p9_client_write(struct p9_fid *fid, char *data, const char __user *udata, | |||
1617 | 1622 | ||
1618 | err = p9pdu_readf(req->rc, clnt->proto_version, "d", &count); | 1623 | err = p9pdu_readf(req->rc, clnt->proto_version, "d", &count); |
1619 | if (err) { | 1624 | if (err) { |
1620 | P9_DUMP_PKT(1, req->rc); | 1625 | trace_9p_protocol_dump(clnt, req->rc); |
1621 | goto free_and_error; | 1626 | goto free_and_error; |
1622 | } | 1627 | } |
1623 | 1628 | ||
@@ -1657,7 +1662,7 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid) | |||
1657 | 1662 | ||
1658 | err = p9pdu_readf(req->rc, clnt->proto_version, "wS", &ignored, ret); | 1663 | err = p9pdu_readf(req->rc, clnt->proto_version, "wS", &ignored, ret); |
1659 | if (err) { | 1664 | if (err) { |
1660 | P9_DUMP_PKT(1, req->rc); | 1665 | trace_9p_protocol_dump(clnt, req->rc); |
1661 | p9_free_req(clnt, req); | 1666 | p9_free_req(clnt, req); |
1662 | goto error; | 1667 | goto error; |
1663 | } | 1668 | } |
@@ -1708,7 +1713,7 @@ struct p9_stat_dotl *p9_client_getattr_dotl(struct p9_fid *fid, | |||
1708 | 1713 | ||
1709 | err = p9pdu_readf(req->rc, clnt->proto_version, "A", ret); | 1714 | err = p9pdu_readf(req->rc, clnt->proto_version, "A", ret); |
1710 | if (err) { | 1715 | if (err) { |
1711 | P9_DUMP_PKT(1, req->rc); | 1716 | trace_9p_protocol_dump(clnt, req->rc); |
1712 | p9_free_req(clnt, req); | 1717 | p9_free_req(clnt, req); |
1713 | goto error; | 1718 | goto error; |
1714 | } | 1719 | } |
@@ -1856,7 +1861,7 @@ int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb) | |||
1856 | &sb->bsize, &sb->blocks, &sb->bfree, &sb->bavail, | 1861 | &sb->bsize, &sb->blocks, &sb->bfree, &sb->bavail, |
1857 | &sb->files, &sb->ffree, &sb->fsid, &sb->namelen); | 1862 | &sb->files, &sb->ffree, &sb->fsid, &sb->namelen); |
1858 | if (err) { | 1863 | if (err) { |
1859 | P9_DUMP_PKT(1, req->rc); | 1864 | trace_9p_protocol_dump(clnt, req->rc); |
1860 | p9_free_req(clnt, req); | 1865 | p9_free_req(clnt, req); |
1861 | goto error; | 1866 | goto error; |
1862 | } | 1867 | } |
@@ -1963,7 +1968,7 @@ struct p9_fid *p9_client_xattrwalk(struct p9_fid *file_fid, | |||
1963 | } | 1968 | } |
1964 | err = p9pdu_readf(req->rc, clnt->proto_version, "q", attr_size); | 1969 | err = p9pdu_readf(req->rc, clnt->proto_version, "q", attr_size); |
1965 | if (err) { | 1970 | if (err) { |
1966 | P9_DUMP_PKT(1, req->rc); | 1971 | trace_9p_protocol_dump(clnt, req->rc); |
1967 | p9_free_req(clnt, req); | 1972 | p9_free_req(clnt, req); |
1968 | goto clunk_fid; | 1973 | goto clunk_fid; |
1969 | } | 1974 | } |
@@ -2047,7 +2052,7 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset) | |||
2047 | 2052 | ||
2048 | err = p9pdu_readf(req->rc, clnt->proto_version, "D", &count, &dataptr); | 2053 | err = p9pdu_readf(req->rc, clnt->proto_version, "D", &count, &dataptr); |
2049 | if (err) { | 2054 | if (err) { |
2050 | P9_DUMP_PKT(1, req->rc); | 2055 | trace_9p_protocol_dump(clnt, req->rc); |
2051 | goto free_and_error; | 2056 | goto free_and_error; |
2052 | } | 2057 | } |
2053 | 2058 | ||
@@ -2084,7 +2089,7 @@ int p9_client_mknod_dotl(struct p9_fid *fid, char *name, int mode, | |||
2084 | 2089 | ||
2085 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); | 2090 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); |
2086 | if (err) { | 2091 | if (err) { |
2087 | P9_DUMP_PKT(1, req->rc); | 2092 | trace_9p_protocol_dump(clnt, req->rc); |
2088 | goto error; | 2093 | goto error; |
2089 | } | 2094 | } |
2090 | P9_DPRINTK(P9_DEBUG_9P, "<<< RMKNOD qid %x.%llx.%x\n", qid->type, | 2095 | P9_DPRINTK(P9_DEBUG_9P, "<<< RMKNOD qid %x.%llx.%x\n", qid->type, |
@@ -2115,7 +2120,7 @@ int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode, | |||
2115 | 2120 | ||
2116 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); | 2121 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); |
2117 | if (err) { | 2122 | if (err) { |
2118 | P9_DUMP_PKT(1, req->rc); | 2123 | trace_9p_protocol_dump(clnt, req->rc); |
2119 | goto error; | 2124 | goto error; |
2120 | } | 2125 | } |
2121 | P9_DPRINTK(P9_DEBUG_9P, "<<< RMKDIR qid %x.%llx.%x\n", qid->type, | 2126 | P9_DPRINTK(P9_DEBUG_9P, "<<< RMKDIR qid %x.%llx.%x\n", qid->type, |
@@ -2150,7 +2155,7 @@ int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status) | |||
2150 | 2155 | ||
2151 | err = p9pdu_readf(req->rc, clnt->proto_version, "b", status); | 2156 | err = p9pdu_readf(req->rc, clnt->proto_version, "b", status); |
2152 | if (err) { | 2157 | if (err) { |
2153 | P9_DUMP_PKT(1, req->rc); | 2158 | trace_9p_protocol_dump(clnt, req->rc); |
2154 | goto error; | 2159 | goto error; |
2155 | } | 2160 | } |
2156 | P9_DPRINTK(P9_DEBUG_9P, "<<< RLOCK status %i\n", *status); | 2161 | P9_DPRINTK(P9_DEBUG_9P, "<<< RLOCK status %i\n", *status); |
@@ -2183,7 +2188,7 @@ int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *glock) | |||
2183 | &glock->start, &glock->length, &glock->proc_id, | 2188 | &glock->start, &glock->length, &glock->proc_id, |
2184 | &glock->client_id); | 2189 | &glock->client_id); |
2185 | if (err) { | 2190 | if (err) { |
2186 | P9_DUMP_PKT(1, req->rc); | 2191 | trace_9p_protocol_dump(clnt, req->rc); |
2187 | goto error; | 2192 | goto error; |
2188 | } | 2193 | } |
2189 | P9_DPRINTK(P9_DEBUG_9P, "<<< RGETLOCK type %i start %lld length %lld " | 2194 | P9_DPRINTK(P9_DEBUG_9P, "<<< RGETLOCK type %i start %lld length %lld " |
@@ -2211,7 +2216,7 @@ int p9_client_readlink(struct p9_fid *fid, char **target) | |||
2211 | 2216 | ||
2212 | err = p9pdu_readf(req->rc, clnt->proto_version, "s", target); | 2217 | err = p9pdu_readf(req->rc, clnt->proto_version, "s", target); |
2213 | if (err) { | 2218 | if (err) { |
2214 | P9_DUMP_PKT(1, req->rc); | 2219 | trace_9p_protocol_dump(clnt, req->rc); |
2215 | goto error; | 2220 | goto error; |
2216 | } | 2221 | } |
2217 | P9_DPRINTK(P9_DEBUG_9P, "<<< RREADLINK target %s\n", *target); | 2222 | P9_DPRINTK(P9_DEBUG_9P, "<<< RREADLINK target %s\n", *target); |
diff --git a/net/9p/protocol.c b/net/9p/protocol.c index b7d4e8aa5383..55e10a96c902 100644 --- a/net/9p/protocol.c +++ b/net/9p/protocol.c | |||
@@ -37,40 +37,11 @@ | |||
37 | #include <net/9p/client.h> | 37 | #include <net/9p/client.h> |
38 | #include "protocol.h" | 38 | #include "protocol.h" |
39 | 39 | ||
40 | #include <trace/events/9p.h> | ||
41 | |||
40 | static int | 42 | static int |
41 | p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...); | 43 | p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...); |
42 | 44 | ||
43 | #ifdef CONFIG_NET_9P_DEBUG | ||
44 | void | ||
45 | p9pdu_dump(int way, struct p9_fcall *pdu) | ||
46 | { | ||
47 | int len = pdu->size; | ||
48 | |||
49 | if ((p9_debug_level & P9_DEBUG_VPKT) != P9_DEBUG_VPKT) { | ||
50 | if ((p9_debug_level & P9_DEBUG_PKT) == P9_DEBUG_PKT) { | ||
51 | if (len > 32) | ||
52 | len = 32; | ||
53 | } else { | ||
54 | /* shouldn't happen */ | ||
55 | return; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | if (way) | ||
60 | print_hex_dump_bytes("[9P] ", DUMP_PREFIX_OFFSET, pdu->sdata, | ||
61 | len); | ||
62 | else | ||
63 | print_hex_dump_bytes("]9P[ ", DUMP_PREFIX_OFFSET, pdu->sdata, | ||
64 | len); | ||
65 | } | ||
66 | #else | ||
67 | void | ||
68 | p9pdu_dump(int way, struct p9_fcall *pdu) | ||
69 | { | ||
70 | } | ||
71 | #endif | ||
72 | EXPORT_SYMBOL(p9pdu_dump); | ||
73 | |||
74 | void p9stat_free(struct p9_wstat *stbuf) | 45 | void p9stat_free(struct p9_wstat *stbuf) |
75 | { | 46 | { |
76 | kfree(stbuf->name); | 47 | kfree(stbuf->name); |
@@ -551,7 +522,7 @@ p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...) | |||
551 | return ret; | 522 | return ret; |
552 | } | 523 | } |
553 | 524 | ||
554 | int p9stat_read(char *buf, int len, struct p9_wstat *st, int proto_version) | 525 | int p9stat_read(struct p9_client *clnt, char *buf, int len, struct p9_wstat *st) |
555 | { | 526 | { |
556 | struct p9_fcall fake_pdu; | 527 | struct p9_fcall fake_pdu; |
557 | int ret; | 528 | int ret; |
@@ -561,10 +532,10 @@ int p9stat_read(char *buf, int len, struct p9_wstat *st, int proto_version) | |||
561 | fake_pdu.sdata = buf; | 532 | fake_pdu.sdata = buf; |
562 | fake_pdu.offset = 0; | 533 | fake_pdu.offset = 0; |
563 | 534 | ||
564 | ret = p9pdu_readf(&fake_pdu, proto_version, "S", st); | 535 | ret = p9pdu_readf(&fake_pdu, clnt->proto_version, "S", st); |
565 | if (ret) { | 536 | if (ret) { |
566 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9stat_read failed: %d\n", ret); | 537 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9stat_read failed: %d\n", ret); |
567 | P9_DUMP_PKT(0, &fake_pdu); | 538 | trace_9p_protocol_dump(clnt, &fake_pdu); |
568 | } | 539 | } |
569 | 540 | ||
570 | return ret; | 541 | return ret; |
@@ -577,7 +548,7 @@ int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type) | |||
577 | return p9pdu_writef(pdu, 0, "dbw", 0, type, tag); | 548 | return p9pdu_writef(pdu, 0, "dbw", 0, type, tag); |
578 | } | 549 | } |
579 | 550 | ||
580 | int p9pdu_finalize(struct p9_fcall *pdu) | 551 | int p9pdu_finalize(struct p9_client *clnt, struct p9_fcall *pdu) |
581 | { | 552 | { |
582 | int size = pdu->size; | 553 | int size = pdu->size; |
583 | int err; | 554 | int err; |
@@ -586,7 +557,7 @@ int p9pdu_finalize(struct p9_fcall *pdu) | |||
586 | err = p9pdu_writef(pdu, 0, "d", size); | 557 | err = p9pdu_writef(pdu, 0, "d", size); |
587 | pdu->size = size; | 558 | pdu->size = size; |
588 | 559 | ||
589 | P9_DUMP_PKT(0, pdu); | 560 | trace_9p_protocol_dump(clnt, pdu); |
590 | P9_DPRINTK(P9_DEBUG_9P, ">>> size=%d type: %d tag: %d\n", pdu->size, | 561 | P9_DPRINTK(P9_DEBUG_9P, ">>> size=%d type: %d tag: %d\n", pdu->size, |
591 | pdu->id, pdu->tag); | 562 | pdu->id, pdu->tag); |
592 | 563 | ||
@@ -599,8 +570,8 @@ void p9pdu_reset(struct p9_fcall *pdu) | |||
599 | pdu->size = 0; | 570 | pdu->size = 0; |
600 | } | 571 | } |
601 | 572 | ||
602 | int p9dirent_read(char *buf, int len, struct p9_dirent *dirent, | 573 | int p9dirent_read(struct p9_client *clnt, char *buf, int len, |
603 | int proto_version) | 574 | struct p9_dirent *dirent) |
604 | { | 575 | { |
605 | struct p9_fcall fake_pdu; | 576 | struct p9_fcall fake_pdu; |
606 | int ret; | 577 | int ret; |
@@ -611,11 +582,11 @@ int p9dirent_read(char *buf, int len, struct p9_dirent *dirent, | |||
611 | fake_pdu.sdata = buf; | 582 | fake_pdu.sdata = buf; |
612 | fake_pdu.offset = 0; | 583 | fake_pdu.offset = 0; |
613 | 584 | ||
614 | ret = p9pdu_readf(&fake_pdu, proto_version, "Qqbs", &dirent->qid, | 585 | ret = p9pdu_readf(&fake_pdu, clnt->proto_version, "Qqbs", &dirent->qid, |
615 | &dirent->d_off, &dirent->d_type, &nameptr); | 586 | &dirent->d_off, &dirent->d_type, &nameptr); |
616 | if (ret) { | 587 | if (ret) { |
617 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9dirent_read failed: %d\n", ret); | 588 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9dirent_read failed: %d\n", ret); |
618 | P9_DUMP_PKT(1, &fake_pdu); | 589 | trace_9p_protocol_dump(clnt, &fake_pdu); |
619 | goto out; | 590 | goto out; |
620 | } | 591 | } |
621 | 592 | ||
diff --git a/net/9p/protocol.h b/net/9p/protocol.h index a0eb8ff11f22..2cc525fa49fa 100644 --- a/net/9p/protocol.h +++ b/net/9p/protocol.h | |||
@@ -29,7 +29,6 @@ int p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt, | |||
29 | va_list ap); | 29 | va_list ap); |
30 | int p9pdu_readf(struct p9_fcall *pdu, int proto_version, const char *fmt, ...); | 30 | int p9pdu_readf(struct p9_fcall *pdu, int proto_version, const char *fmt, ...); |
31 | int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type); | 31 | int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type); |
32 | int p9pdu_finalize(struct p9_fcall *pdu); | 32 | int p9pdu_finalize(struct p9_client *clnt, struct p9_fcall *pdu); |
33 | void p9pdu_dump(int, struct p9_fcall *); | ||
34 | void p9pdu_reset(struct p9_fcall *pdu); | 33 | void p9pdu_reset(struct p9_fcall *pdu); |
35 | size_t pdu_read(struct p9_fcall *pdu, void *data, size_t size); | 34 | size_t pdu_read(struct p9_fcall *pdu, void *data, size_t size); |