From patchwork Tue Aug 17 17:27:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jvrao X-Patchwork-Id: 119985 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7HHJwb6010449 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 17 Aug 2010 17:20:34 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1OlPpK-00062j-5q; Tue, 17 Aug 2010 17:19:54 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1OlPpJ-00062X-9K for v9fs-developer@lists.sourceforge.net; Tue, 17 Aug 2010 17:19:53 +0000 X-ACL-Warn: Received: from e35.co.us.ibm.com ([32.97.110.153]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1OlPpI-0002sj-Au for v9fs-developer@lists.sourceforge.net; Tue, 17 Aug 2010 17:19:53 +0000 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e35.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o7HHAmv5012909 for ; Tue, 17 Aug 2010 11:10:48 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o7HHJb71133256 for ; Tue, 17 Aug 2010 11:19:37 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o7HHJZA0002193 for ; Tue, 17 Aug 2010 11:19:36 -0600 Received: from localhost.localdomain (elm9m80.beaverton.ibm.com [9.47.81.80]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o7HHJWRv001997; Tue, 17 Aug 2010 11:19:34 -0600 From: "Venkateswararao Jujjuri (JV)" To: v9fs-developer@lists.sourceforge.net Date: Tue, 17 Aug 2010 10:27:22 -0700 Message-Id: <1282066045-3945-3-git-send-email-jvrao@linux.vnet.ibm.com> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1282066045-3945-1-git-send-email-jvrao@linux.vnet.ibm.com> References: <1282066045-3945-1-git-send-email-jvrao@linux.vnet.ibm.com> X-Spam-Score: -0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1OlPpI-0002sj-Au Cc: linux-fsdevel@vger.kernel.org, Badari Pulavarty Subject: [V9fs-developer] [PATCH 2/5] [net/9p] Pass p9_client structure to pdu perpartion routines. X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 17 Aug 2010 17:20:34 +0000 (UTC) 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);