Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116259
b: refs/heads/master
c: e7f4b8f
h: refs/heads/master
i:
  116257: 2af09c9
  116255: f7f8ea8
v: v3
  • Loading branch information
Eric Van Hensbergen committed Oct 17, 2008
1 parent 01f3642 commit 707ffc1
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 02da398b950c5d079c20afaa23f322383e96070a
refs/heads/master: e7f4b8f1a5893ff8296b5b581e16a0b96f60a3b5
4 changes: 2 additions & 2 deletions trunk/include/net/9p/9p.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#ifndef NET_9P_H
#define NET_9P_H

#ifdef CONFIG_NET_9P_DEBUG

/**
* enum p9_debug_flags - bits for mount time debug parameter
* @P9_DEBUG_ERROR: more verbose error messages including original error string
Expand All @@ -55,10 +53,12 @@ enum p9_debug_flags {
P9_DEBUG_SLABS = (1<<7),
P9_DEBUG_FCALL = (1<<8),
P9_DEBUG_FID = (1<<9),
P9_DEBUG_PKT = (1<<10),
};

extern unsigned int p9_debug_level;

#ifdef CONFIG_NET_9P_DEBUG
#define P9_DPRINTK(level, format, arg...) \
do { \
if ((p9_debug_level & level) == level) {\
Expand Down
76 changes: 55 additions & 21 deletions trunk/net/9p/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ p9_parse_header(struct p9_fcall *pdu, int32_t *size, int8_t *type, int16_t *tag,
pdu->id = r_type;
pdu->tag = r_tag;

P9_DPRINTK(P9_DEBUG_MUX, "pdu: type: %d tag: %d size=%d offset=%d\n",
pdu->id, pdu->tag, pdu->size, pdu->offset);
P9_DPRINTK(P9_DEBUG_9P, "<<< size=%d type: %d tag: %d\n", pdu->size,
pdu->id, pdu->tag);

if (type)
*type = r_type;
Expand Down Expand Up @@ -672,6 +672,7 @@ int p9_client_version(struct p9_client *c)
err = p9pdu_readf(req->rc, c->dotu, "ds", &msize, &version);
if (err) {
P9_DPRINTK(P9_DEBUG_9P, "version error %d\n", err);
p9pdu_dump(1, req->rc);
goto error;
}

Expand Down Expand Up @@ -810,6 +811,7 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,

err = p9pdu_readf(req->rc, clnt->dotu, "Q", &qid);
if (err) {
p9pdu_dump(1, req->rc);
p9_free_req(clnt, req);
goto error;
}
Expand Down Expand Up @@ -856,6 +858,7 @@ p9_client_auth(struct p9_client *clnt, char *uname, u32 n_uname, char *aname)

err = p9pdu_readf(req->rc, clnt->dotu, "Q", &qid);
if (err) {
p9pdu_dump(1, req->rc);
p9_free_req(clnt, req);
goto error;
}
Expand Down Expand Up @@ -910,9 +913,12 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
}

err = p9pdu_readf(req->rc, clnt->dotu, "R", &nwqids, &wqids);
p9_free_req(clnt, req);
if (err)
if (err) {
p9pdu_dump(1, req->rc);
p9_free_req(clnt, req);
goto clunk_fid;
}
p9_free_req(clnt, req);

P9_DPRINTK(P9_DEBUG_9P, "<<< RWALK nwqid %d:\n", nwqids);

Expand Down Expand Up @@ -967,16 +973,19 @@ int p9_client_open(struct p9_fid *fid, int mode)
}

err = p9pdu_readf(req->rc, clnt->dotu, "Qd", &qid, &iounit);
p9_free_req(clnt, req);
if (err)
goto error;
if (err) {
p9pdu_dump(1, req->rc);
goto free_and_error;
}

P9_DPRINTK(P9_DEBUG_9P, "<<< ROPEN qid %x.%llx.%x iounit %x\n",
qid.type, qid.path, qid.version, iounit);

fid->mode = mode;
fid->iounit = iounit;

free_and_error:
p9_free_req(clnt, req);
error:
return err;
}
Expand Down Expand Up @@ -1007,16 +1016,19 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
}

err = p9pdu_readf(req->rc, clnt->dotu, "Qd", &qid, &iounit);
p9_free_req(clnt, req);
if (err)
goto error;
if (err) {
p9pdu_dump(1, req->rc);
goto free_and_error;
}

P9_DPRINTK(P9_DEBUG_9P, "<<< RCREATE qid %x.%llx.%x iounit %x\n",
qid.type, qid.path, qid.version, iounit);

fid->mode = mode;
fid->iounit = iounit;

free_and_error:
p9_free_req(clnt, req);
error:
return err;
}
Expand Down Expand Up @@ -1103,8 +1115,10 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset,
}

err = p9pdu_readf(req->rc, clnt->dotu, "D", &count, &dataptr);
if (err)
if (err) {
p9pdu_dump(1, req->rc);
goto free_and_error;
}

P9_DPRINTK(P9_DEBUG_9P, "<<< RREAD count %d\n", count);

Expand Down Expand Up @@ -1163,8 +1177,11 @@ p9_client_write(struct p9_fid *fid, char *data, const char __user *udata,
}

err = p9pdu_readf(req->rc, clnt->dotu, "d", &count);
if (err)
if (err) {
p9pdu_dump(1, req->rc);
goto free_and_error;
}

P9_DPRINTK(P9_DEBUG_9P, "<<< RWRITE count %d\n", count);

p9_free_req(clnt, req);
Expand Down Expand Up @@ -1200,20 +1217,27 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid)
}

err = p9pdu_readf(req->rc, clnt->dotu, "wS", &ignored, ret);
p9_free_req(clnt, req);
if (err)
goto error;
if (err) {
ret = ERR_PTR(err);
p9pdu_dump(1, req->rc);
goto free_and_error;
}

P9_DPRINTK(P9_DEBUG_9P,
"<<< RSTAT sz=%x type=%x dev=%x qid=%2.2x %4.4x %8.8llx"
" mode=%8.8x uid=%d gid=%d size=%lld %s\n",
"<<< RSTAT sz=%x type=%x dev=%x qid=%x.%llx.%x\n"
"<<< mode=%8.8x atime=%8.8x mtime=%8.8x length=%llx\n"
"<<< name=%s uid=%s gid=%s muid=%s extension=(%s)\n"
"<<< uid=%d gid=%d n_muid=%d\n",
ret->size, ret->type, ret->dev, ret->qid.type,
ret->qid.version, ret->qid.path, ret->mode,
ret->n_uid, ret->n_gid, ret->length, ret->name);
ret->qid.path, ret->qid.version, ret->mode,
ret->atime, ret->mtime, ret->length, ret->name,
ret->uid, ret->gid, ret->muid, ret->extension,
ret->n_uid, ret->n_gid, ret->n_muid);

return ret;
free_and_error:
p9_free_req(clnt, req);
error:
return ERR_PTR(err);
return ret;
}
EXPORT_SYMBOL(p9_client_stat);

Expand All @@ -1224,6 +1248,16 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst)
struct p9_client *clnt;

P9_DPRINTK(P9_DEBUG_9P, ">>> TWSTAT fid %d\n", fid->fid);
P9_DPRINTK(P9_DEBUG_9P,
" sz=%x type=%x dev=%x qid=%x.%llx.%x\n"
" mode=%8.8x atime=%8.8x mtime=%8.8x length=%llx\n"
" name=%s uid=%s gid=%s muid=%s extension=(%s)\n"
" uid=%d gid=%d n_muid=%d\n",
wst->size, wst->type, wst->dev, wst->qid.type,
wst->qid.path, wst->qid.version, wst->mode,
wst->atime, wst->mtime, wst->length, wst->name,
wst->uid, wst->gid, wst->muid, wst->extension,
wst->n_uid, wst->n_gid, wst->n_muid);
err = 0;
clnt = fid->clnt;

Expand Down
21 changes: 15 additions & 6 deletions trunk/net/9p/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/uaccess.h>
#include <linux/sched.h>
#include <net/9p/9p.h>
#include <net/9p/client.h>
#include "protocol.h"
Expand All @@ -52,8 +53,6 @@
static int
p9pdu_writef(struct p9_fcall *pdu, int optional, const char *fmt, ...);

#define PACKET_DEBUG 0

void
p9pdu_dump(int way, struct p9_fcall *pdu)
{
Expand All @@ -78,9 +77,9 @@ p9pdu_dump(int way, struct p9_fcall *pdu)
n += scnprintf(buf + n, buflen - n, "\n");

if (way)
printk(KERN_NOTICE "[[(%d)[ %s\n", datalen, buf);
P9_DPRINTK(P9_DEBUG_PKT, "[[[(%d) %s\n", datalen, buf);
else
printk(KERN_NOTICE "]](%d)] %s\n", datalen, buf);
P9_DPRINTK(P9_DEBUG_PKT, "]]](%d) %s\n", datalen, buf);
}
EXPORT_SYMBOL(p9pdu_dump);

Expand Down Expand Up @@ -512,13 +511,20 @@ p9pdu_writef(struct p9_fcall *pdu, int optional, const char *fmt, ...)
int p9stat_read(char *buf, int len, struct p9_wstat *st, int dotu)
{
struct p9_fcall fake_pdu;
int ret;

fake_pdu.size = len;
fake_pdu.capacity = len;
fake_pdu.sdata = buf;
fake_pdu.offset = 0;

return p9pdu_readf(&fake_pdu, dotu, "S", st);
ret = p9pdu_readf(&fake_pdu, dotu, "S", st);
if (ret) {
P9_DPRINTK(P9_DEBUG_9P, "<<< p9stat_read failed: %d\n", ret);
p9pdu_dump(1, &fake_pdu);
}

return ret;
}
EXPORT_SYMBOL(p9stat_read);

Expand All @@ -536,9 +542,12 @@ int p9pdu_finalize(struct p9_fcall *pdu)
err = p9pdu_writef(pdu, 0, "d", size);
pdu->size = size;

if (PACKET_DEBUG)
if ((p9_debug_level & P9_DEBUG_PKT) == P9_DEBUG_PKT)
p9pdu_dump(0, pdu);

P9_DPRINTK(P9_DEBUG_9P, ">>> size=%d type: %d tag: %d\n", pdu->size,
pdu->id, pdu->tag);

return err;
}

Expand Down

0 comments on commit 707ffc1

Please sign in to comment.