From: "Venkateswararao Jujjuri (JV)" <jvrao@linux.vnet.ibm.com>
To: v9fs-developer@lists.sourceforge.net
Cc: linux-fsdevel@vger.kernel.org,
"Venkateswararao Jujjuri (JV)" <jvrao@linux.vnet.ibm.com>,
Badari Pulavarty <pbadari@us.ibm.com>
Subject: [PATCH 2/5] [net/9p] Pass p9_client structure to pdu perpartion routines.
Date: Tue, 17 Aug 2010 10:27:22 -0700 [thread overview]
Message-ID: <1282066045-3945-3-git-send-email-jvrao@linux.vnet.ibm.com> (raw)
In-Reply-To: <1282066045-3945-1-git-send-email-jvrao@linux.vnet.ibm.com>
This patch passes struct p9_client to p9pdu_vwritef(), p9pdu_prepare()
p9pdu_finalize(), p9pdu_writef() in preparation for adding zero copy
support for virtio transport.
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
---
net/9p/client.c | 6 +++---
net/9p/protocol.c | 49 ++++++++++++++++++++++---------------------------
net/9p/protocol.h | 7 ++++---
3 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/net/9p/client.c b/net/9p/client.c
index dc6f2f2..29bbbbd 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -562,11 +562,11 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
return req;
/* marshall the data */
- p9pdu_prepare(req->tc, tag, type);
+ p9pdu_prepare(c, req->tc, tag, type);
va_start(ap, fmt);
- err = p9pdu_vwritef(req->tc, c->proto_version, fmt, ap);
+ err = p9pdu_vwritef(req->tc, c, fmt, ap);
va_end(ap);
- p9pdu_finalize(req->tc);
+ p9pdu_finalize(c, req->tc);
err = c->trans_mod->request(c, req);
if (err < 0) {
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index 3acd3af..ca63aff 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -53,7 +53,7 @@
#endif
static int
-p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...);
+p9pdu_writef(struct p9_fcall *pdu, struct p9_client *c, const char *fmt, ...);
#ifdef CONFIG_NET_9P_DEBUG
void
@@ -386,11 +386,12 @@ p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt,
}
int
-p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
+p9pdu_vwritef(struct p9_fcall *pdu, struct p9_client *c, const char *fmt,
va_list ap)
{
const char *ptr;
int errcode = 0;
+ int proto_version = c->proto_version;
for (ptr = fmt; *ptr; ptr++) {
switch (*ptr) {
@@ -424,8 +425,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
if (sptr)
len = MIN(strlen(sptr), USHRT_MAX);
- errcode = p9pdu_writef(pdu, proto_version,
- "w", len);
+ errcode = p9pdu_writef(pdu, c, "w", len);
if (!errcode && pdu_write(pdu, sptr, len))
errcode = -EFAULT;
}
@@ -434,7 +434,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
const struct p9_qid *qid =
va_arg(ap, const struct p9_qid *);
errcode =
- p9pdu_writef(pdu, proto_version, "bdq",
+ p9pdu_writef(pdu, c, "bdq",
qid->type, qid->version,
qid->path);
} break;
@@ -442,7 +442,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
const struct p9_wstat *stbuf =
va_arg(ap, const struct p9_wstat *);
errcode =
- p9pdu_writef(pdu, proto_version,
+ p9pdu_writef(pdu, c,
"wwdQdddqssss?sddd",
stbuf->size, stbuf->type,
stbuf->dev, &stbuf->qid,
@@ -457,8 +457,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
int32_t count = va_arg(ap, int32_t);
const void *data = va_arg(ap, const void *);
- errcode = p9pdu_writef(pdu, proto_version, "d",
- count);
+ errcode = p9pdu_writef(pdu, c, "d", count);
if (!errcode && pdu_write(pdu, data, count))
errcode = -EFAULT;
}
@@ -467,8 +466,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
int32_t count = va_arg(ap, int32_t);
const char __user *udata =
va_arg(ap, const void __user *);
- errcode = p9pdu_writef(pdu, proto_version, "d",
- count);
+ errcode = p9pdu_writef(pdu, c, "d", count);
if (!errcode && pdu_write_u(pdu, udata, count))
errcode = -EFAULT;
}
@@ -477,17 +475,15 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
int16_t nwname = va_arg(ap, int);
const char **wnames = va_arg(ap, const char **);
- errcode = p9pdu_writef(pdu, proto_version, "w",
- nwname);
+ errcode = p9pdu_writef(pdu, c, "w", nwname);
if (!errcode) {
int i;
for (i = 0; i < nwname; i++) {
errcode =
p9pdu_writef(pdu,
- proto_version,
- "s",
- wnames[i]);
+ c, "s",
+ wnames[i]);
if (errcode)
break;
}
@@ -499,17 +495,15 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
struct p9_qid *wqids =
va_arg(ap, struct p9_qid *);
- errcode = p9pdu_writef(pdu, proto_version, "w",
- nwqid);
+ errcode = p9pdu_writef(pdu, c, "w", nwqid);
if (!errcode) {
int i;
for (i = 0; i < nwqid; i++) {
errcode =
p9pdu_writef(pdu,
- proto_version,
- "Q",
- &wqids[i]);
+ c, "Q",
+ &wqids[i]);
if (errcode)
break;
}
@@ -520,7 +514,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
struct p9_iattr_dotl *p9attr = va_arg(ap,
struct p9_iattr_dotl *);
- errcode = p9pdu_writef(pdu, proto_version,
+ errcode = p9pdu_writef(pdu, c,
"ddddqqqqq",
p9attr->valid,
p9attr->mode,
@@ -563,13 +557,13 @@ int p9pdu_readf(struct p9_fcall *pdu, int proto_version, const char *fmt, ...)
}
static int
-p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...)
+p9pdu_writef(struct p9_fcall *pdu, struct p9_client *c, const char *fmt, ...)
{
va_list ap;
int ret;
va_start(ap, fmt);
- ret = p9pdu_vwritef(pdu, proto_version, fmt, ap);
+ ret = p9pdu_vwritef(pdu, c, fmt, ap);
va_end(ap);
return ret;
@@ -595,18 +589,19 @@ int p9stat_read(char *buf, int len, struct p9_wstat *st, int proto_version)
}
EXPORT_SYMBOL(p9stat_read);
-int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type)
+int p9pdu_prepare(struct p9_client *c, struct p9_fcall *pdu, int16_t tag,
+ int8_t type)
{
- return p9pdu_writef(pdu, 0, "dbw", 0, type, tag);
+ return p9pdu_writef(pdu, c, "dbw", 0, type, tag);
}
-int p9pdu_finalize(struct p9_fcall *pdu)
+int p9pdu_finalize(struct p9_client *c, struct p9_fcall *pdu)
{
int size = pdu->size;
int err;
pdu->size = 0;
- err = p9pdu_writef(pdu, 0, "d", size);
+ err = p9pdu_writef(pdu, c, "d", size);
pdu->size = size;
#ifdef CONFIG_NET_9P_DEBUG
diff --git a/net/9p/protocol.h b/net/9p/protocol.h
index 2431c0f..6d059a6 100644
--- a/net/9p/protocol.h
+++ b/net/9p/protocol.h
@@ -25,10 +25,11 @@
*
*/
-int p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
+int p9pdu_vwritef(struct p9_fcall *pdu, struct p9_client *c, const char *fmt,
va_list ap);
int p9pdu_readf(struct p9_fcall *pdu, int proto_version, const char *fmt, ...);
-int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type);
-int p9pdu_finalize(struct p9_fcall *pdu);
+int p9pdu_prepare(struct p9_client *c, struct p9_fcall *pdu, int16_t tag,
+ int8_t type);
+int p9pdu_finalize(struct p9_client *c, struct p9_fcall *pdu);
void p9pdu_dump(int, struct p9_fcall *);
void p9pdu_reset(struct p9_fcall *pdu);
--
1.6.5.2
next prev parent reply other threads:[~2010-08-17 17:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-17 17:27 [00/05] Add zero copy capability to virtio transport Venkateswararao Jujjuri (JV)
2010-08-17 17:27 ` [PATCH 1/5] [net/9p] Add capability() to p9_trans_module Venkateswararao Jujjuri (JV)
2010-08-17 20:43 ` [V9fs-developer] " Eric Van Hensbergen
2010-08-17 20:46 ` Latchesar Ionkov
2010-08-17 23:31 ` Venkateswararao Jujjuri (JV)
2010-08-18 15:16 ` Eric Van Hensbergen
2010-08-18 16:56 ` Venkateswararao Jujjuri (JV)
2010-08-18 18:26 ` Eric Van Hensbergen
2010-08-17 17:27 ` Venkateswararao Jujjuri (JV) [this message]
2010-08-17 17:27 ` [PATCH 3/5] [net/9p] Add support for placing page addresses directly on the sg list Venkateswararao Jujjuri (JV)
2010-08-18 20:50 ` [V9fs-developer] " Latchesar Ionkov
2010-08-19 18:28 ` Venkateswararao Jujjuri (JV)
2010-08-19 18:49 ` Latchesar Ionkov
2010-08-19 20:47 ` Venkateswararao Jujjuri (JV)
2010-08-19 21:07 ` Latchesar Ionkov
2010-08-19 21:26 ` Eric Van Hensbergen
2010-08-19 23:35 ` Venkateswararao Jujjuri (JV)
2010-08-20 0:27 ` Eric Van Hensbergen
2010-08-17 17:27 ` [PATCH 4/5] [net/9p] Achieve zero copy on write path Venkateswararao Jujjuri (JV)
2010-08-19 19:30 ` [V9fs-developer] " Latchesar Ionkov
2010-08-19 20:55 ` Venkateswararao Jujjuri (JV)
2010-08-17 17:27 ` [PATCH 5/5] [net/9p] Achieve zero copy on read path Venkateswararao Jujjuri (JV)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1282066045-3945-3-git-send-email-jvrao@linux.vnet.ibm.com \
--to=jvrao@linux.vnet.ibm.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=pbadari@us.ibm.com \
--cc=v9fs-developer@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).