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/client.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/client.c')
-rw-r--r-- | net/9p/client.c | 76 |
1 files changed, 55 insertions, 21 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 2a166bfb95a3..bbac2f72b4d2 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -389,8 +389,8 @@ p9_parse_header(struct p9_fcall *pdu, int32_t *size, int8_t *type, int16_t *tag, | |||
389 | pdu->id = r_type; | 389 | pdu->id = r_type; |
390 | pdu->tag = r_tag; | 390 | pdu->tag = r_tag; |
391 | 391 | ||
392 | P9_DPRINTK(P9_DEBUG_MUX, "pdu: type: %d tag: %d size=%d offset=%d\n", | 392 | P9_DPRINTK(P9_DEBUG_9P, "<<< size=%d type: %d tag: %d\n", pdu->size, |
393 | pdu->id, pdu->tag, pdu->size, pdu->offset); | 393 | pdu->id, pdu->tag); |
394 | 394 | ||
395 | if (type) | 395 | if (type) |
396 | *type = r_type; | 396 | *type = r_type; |
@@ -672,6 +672,7 @@ int p9_client_version(struct p9_client *c) | |||
672 | err = p9pdu_readf(req->rc, c->dotu, "ds", &msize, &version); | 672 | err = p9pdu_readf(req->rc, c->dotu, "ds", &msize, &version); |
673 | if (err) { | 673 | if (err) { |
674 | P9_DPRINTK(P9_DEBUG_9P, "version error %d\n", err); | 674 | P9_DPRINTK(P9_DEBUG_9P, "version error %d\n", err); |
675 | p9pdu_dump(1, req->rc); | ||
675 | goto error; | 676 | goto error; |
676 | } | 677 | } |
677 | 678 | ||
@@ -810,6 +811,7 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, | |||
810 | 811 | ||
811 | err = p9pdu_readf(req->rc, clnt->dotu, "Q", &qid); | 812 | err = p9pdu_readf(req->rc, clnt->dotu, "Q", &qid); |
812 | if (err) { | 813 | if (err) { |
814 | p9pdu_dump(1, req->rc); | ||
813 | p9_free_req(clnt, req); | 815 | p9_free_req(clnt, req); |
814 | goto error; | 816 | goto error; |
815 | } | 817 | } |
@@ -856,6 +858,7 @@ p9_client_auth(struct p9_client *clnt, char *uname, u32 n_uname, char *aname) | |||
856 | 858 | ||
857 | err = p9pdu_readf(req->rc, clnt->dotu, "Q", &qid); | 859 | err = p9pdu_readf(req->rc, clnt->dotu, "Q", &qid); |
858 | if (err) { | 860 | if (err) { |
861 | p9pdu_dump(1, req->rc); | ||
859 | p9_free_req(clnt, req); | 862 | p9_free_req(clnt, req); |
860 | goto error; | 863 | goto error; |
861 | } | 864 | } |
@@ -910,9 +913,12 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, | |||
910 | } | 913 | } |
911 | 914 | ||
912 | err = p9pdu_readf(req->rc, clnt->dotu, "R", &nwqids, &wqids); | 915 | err = p9pdu_readf(req->rc, clnt->dotu, "R", &nwqids, &wqids); |
913 | p9_free_req(clnt, req); | 916 | if (err) { |
914 | if (err) | 917 | p9pdu_dump(1, req->rc); |
918 | p9_free_req(clnt, req); | ||
915 | goto clunk_fid; | 919 | goto clunk_fid; |
920 | } | ||
921 | p9_free_req(clnt, req); | ||
916 | 922 | ||
917 | P9_DPRINTK(P9_DEBUG_9P, "<<< RWALK nwqid %d:\n", nwqids); | 923 | P9_DPRINTK(P9_DEBUG_9P, "<<< RWALK nwqid %d:\n", nwqids); |
918 | 924 | ||
@@ -967,9 +973,10 @@ int p9_client_open(struct p9_fid *fid, int mode) | |||
967 | } | 973 | } |
968 | 974 | ||
969 | err = p9pdu_readf(req->rc, clnt->dotu, "Qd", &qid, &iounit); | 975 | err = p9pdu_readf(req->rc, clnt->dotu, "Qd", &qid, &iounit); |
970 | p9_free_req(clnt, req); | 976 | if (err) { |
971 | if (err) | 977 | p9pdu_dump(1, req->rc); |
972 | goto error; | 978 | goto free_and_error; |
979 | } | ||
973 | 980 | ||
974 | P9_DPRINTK(P9_DEBUG_9P, "<<< ROPEN qid %x.%llx.%x iounit %x\n", | 981 | P9_DPRINTK(P9_DEBUG_9P, "<<< ROPEN qid %x.%llx.%x iounit %x\n", |
975 | qid.type, qid.path, qid.version, iounit); | 982 | qid.type, qid.path, qid.version, iounit); |
@@ -977,6 +984,8 @@ int p9_client_open(struct p9_fid *fid, int mode) | |||
977 | fid->mode = mode; | 984 | fid->mode = mode; |
978 | fid->iounit = iounit; | 985 | fid->iounit = iounit; |
979 | 986 | ||
987 | free_and_error: | ||
988 | p9_free_req(clnt, req); | ||
980 | error: | 989 | error: |
981 | return err; | 990 | return err; |
982 | } | 991 | } |
@@ -1007,9 +1016,10 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, | |||
1007 | } | 1016 | } |
1008 | 1017 | ||
1009 | err = p9pdu_readf(req->rc, clnt->dotu, "Qd", &qid, &iounit); | 1018 | err = p9pdu_readf(req->rc, clnt->dotu, "Qd", &qid, &iounit); |
1010 | p9_free_req(clnt, req); | 1019 | if (err) { |
1011 | if (err) | 1020 | p9pdu_dump(1, req->rc); |
1012 | goto error; | 1021 | goto free_and_error; |
1022 | } | ||
1013 | 1023 | ||
1014 | P9_DPRINTK(P9_DEBUG_9P, "<<< RCREATE qid %x.%llx.%x iounit %x\n", | 1024 | P9_DPRINTK(P9_DEBUG_9P, "<<< RCREATE qid %x.%llx.%x iounit %x\n", |
1015 | qid.type, qid.path, qid.version, iounit); | 1025 | qid.type, qid.path, qid.version, iounit); |
@@ -1017,6 +1027,8 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, | |||
1017 | fid->mode = mode; | 1027 | fid->mode = mode; |
1018 | fid->iounit = iounit; | 1028 | fid->iounit = iounit; |
1019 | 1029 | ||
1030 | free_and_error: | ||
1031 | p9_free_req(clnt, req); | ||
1020 | error: | 1032 | error: |
1021 | return err; | 1033 | return err; |
1022 | } | 1034 | } |
@@ -1103,8 +1115,10 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset, | |||
1103 | } | 1115 | } |
1104 | 1116 | ||
1105 | err = p9pdu_readf(req->rc, clnt->dotu, "D", &count, &dataptr); | 1117 | err = p9pdu_readf(req->rc, clnt->dotu, "D", &count, &dataptr); |
1106 | if (err) | 1118 | if (err) { |
1119 | p9pdu_dump(1, req->rc); | ||
1107 | goto free_and_error; | 1120 | goto free_and_error; |
1121 | } | ||
1108 | 1122 | ||
1109 | P9_DPRINTK(P9_DEBUG_9P, "<<< RREAD count %d\n", count); | 1123 | P9_DPRINTK(P9_DEBUG_9P, "<<< RREAD count %d\n", count); |
1110 | 1124 | ||
@@ -1163,8 +1177,11 @@ p9_client_write(struct p9_fid *fid, char *data, const char __user *udata, | |||
1163 | } | 1177 | } |
1164 | 1178 | ||
1165 | err = p9pdu_readf(req->rc, clnt->dotu, "d", &count); | 1179 | err = p9pdu_readf(req->rc, clnt->dotu, "d", &count); |
1166 | if (err) | 1180 | if (err) { |
1181 | p9pdu_dump(1, req->rc); | ||
1167 | goto free_and_error; | 1182 | goto free_and_error; |
1183 | } | ||
1184 | |||
1168 | P9_DPRINTK(P9_DEBUG_9P, "<<< RWRITE count %d\n", count); | 1185 | P9_DPRINTK(P9_DEBUG_9P, "<<< RWRITE count %d\n", count); |
1169 | 1186 | ||
1170 | p9_free_req(clnt, req); | 1187 | p9_free_req(clnt, req); |
@@ -1200,20 +1217,27 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid) | |||
1200 | } | 1217 | } |
1201 | 1218 | ||
1202 | err = p9pdu_readf(req->rc, clnt->dotu, "wS", &ignored, ret); | 1219 | err = p9pdu_readf(req->rc, clnt->dotu, "wS", &ignored, ret); |
1203 | p9_free_req(clnt, req); | 1220 | if (err) { |
1204 | if (err) | 1221 | ret = ERR_PTR(err); |
1205 | goto error; | 1222 | p9pdu_dump(1, req->rc); |
1223 | goto free_and_error; | ||
1224 | } | ||
1206 | 1225 | ||
1207 | P9_DPRINTK(P9_DEBUG_9P, | 1226 | P9_DPRINTK(P9_DEBUG_9P, |
1208 | "<<< RSTAT sz=%x type=%x dev=%x qid=%2.2x %4.4x %8.8llx" | 1227 | "<<< RSTAT sz=%x type=%x dev=%x qid=%x.%llx.%x\n" |
1209 | " mode=%8.8x uid=%d gid=%d size=%lld %s\n", | 1228 | "<<< mode=%8.8x atime=%8.8x mtime=%8.8x length=%llx\n" |
1229 | "<<< name=%s uid=%s gid=%s muid=%s extension=(%s)\n" | ||
1230 | "<<< uid=%d gid=%d n_muid=%d\n", | ||
1210 | ret->size, ret->type, ret->dev, ret->qid.type, | 1231 | ret->size, ret->type, ret->dev, ret->qid.type, |
1211 | ret->qid.version, ret->qid.path, ret->mode, | 1232 | ret->qid.path, ret->qid.version, ret->mode, |
1212 | ret->n_uid, ret->n_gid, ret->length, ret->name); | 1233 | ret->atime, ret->mtime, ret->length, ret->name, |
1234 | ret->uid, ret->gid, ret->muid, ret->extension, | ||
1235 | ret->n_uid, ret->n_gid, ret->n_muid); | ||
1213 | 1236 | ||
1214 | return ret; | 1237 | free_and_error: |
1238 | p9_free_req(clnt, req); | ||
1215 | error: | 1239 | error: |
1216 | return ERR_PTR(err); | 1240 | return ret; |
1217 | } | 1241 | } |
1218 | EXPORT_SYMBOL(p9_client_stat); | 1242 | EXPORT_SYMBOL(p9_client_stat); |
1219 | 1243 | ||
@@ -1224,6 +1248,16 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst) | |||
1224 | struct p9_client *clnt; | 1248 | struct p9_client *clnt; |
1225 | 1249 | ||
1226 | P9_DPRINTK(P9_DEBUG_9P, ">>> TWSTAT fid %d\n", fid->fid); | 1250 | P9_DPRINTK(P9_DEBUG_9P, ">>> TWSTAT fid %d\n", fid->fid); |
1251 | P9_DPRINTK(P9_DEBUG_9P, | ||
1252 | " sz=%x type=%x dev=%x qid=%x.%llx.%x\n" | ||
1253 | " mode=%8.8x atime=%8.8x mtime=%8.8x length=%llx\n" | ||
1254 | " name=%s uid=%s gid=%s muid=%s extension=(%s)\n" | ||
1255 | " uid=%d gid=%d n_muid=%d\n", | ||
1256 | wst->size, wst->type, wst->dev, wst->qid.type, | ||
1257 | wst->qid.path, wst->qid.version, wst->mode, | ||
1258 | wst->atime, wst->mtime, wst->length, wst->name, | ||
1259 | wst->uid, wst->gid, wst->muid, wst->extension, | ||
1260 | wst->n_uid, wst->n_gid, wst->n_muid); | ||
1227 | err = 0; | 1261 | err = 0; |
1228 | clnt = fid->clnt; | 1262 | clnt = fid->clnt; |
1229 | 1263 | ||