aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Van Hensbergen <ericvh@gmail.com>2008-02-06 20:25:09 -0500
committerEric Van Hensbergen <ericvh@opteron.homeip.net>2008-02-06 20:25:09 -0500
commit043aba403e9958c6526c9279b63919273cb09c13 (patch)
treea8caca5d1d9691407588f2e8dc8a1200843c998f
parentafcf0c13aeac04a39fa4d1eafdb75604b81af860 (diff)
9p: create transport rpc cut-thru
Add a new transport function which allows a cut-thru directly to the transport instead of processing request through the mux if the cut-thru exists. Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
-rw-r--r--include/net/9p/transport.h2
-rw-r--r--net/9p/client.c49
2 files changed, 35 insertions, 16 deletions
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 9dd4a05619a8..adbcafe99177 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -39,6 +39,8 @@ struct p9_trans {
39 int (*read) (struct p9_trans *, void *, int); 39 int (*read) (struct p9_trans *, void *, int);
40 void (*close) (struct p9_trans *); 40 void (*close) (struct p9_trans *);
41 unsigned int (*poll)(struct p9_trans *, struct poll_table_struct *); 41 unsigned int (*poll)(struct p9_trans *, struct poll_table_struct *);
42 int (*rpc) (struct p9_trans *t, struct p9_fcall *tc,
43 struct p9_fcall **rc);
42}; 44};
43 45
44struct p9_trans_module { 46struct p9_trans_module {
diff --git a/net/9p/client.c b/net/9p/client.c
index 069d9aa14205..b0d08c2375d0 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -39,6 +39,23 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt);
39static void p9_fid_destroy(struct p9_fid *fid); 39static void p9_fid_destroy(struct p9_fid *fid);
40static struct p9_stat *p9_clone_stat(struct p9_stat *st, int dotu); 40static struct p9_stat *p9_clone_stat(struct p9_stat *st, int dotu);
41 41
42/**
43 * p9_client_rpc - sends 9P request and waits until a response is available.
44 * The function can be interrupted.
45 * @c: client data
46 * @tc: request to be sent
47 * @rc: pointer where a pointer to the response is stored
48 */
49int
50p9_client_rpc(struct p9_client *c, struct p9_fcall *tc,
51 struct p9_fcall **rc)
52{
53 if (c->trans->rpc)
54 return c->trans->rpc(c->trans, tc, rc);
55 else
56 return p9_conn_rpc(c->conn, tc, rc);
57}
58
42struct p9_client *p9_client_create(struct p9_trans *trans, int msize, 59struct p9_client *p9_client_create(struct p9_trans *trans, int msize,
43 int dotu) 60 int dotu)
44{ 61{
@@ -82,7 +99,7 @@ struct p9_client *p9_client_create(struct p9_trans *trans, int msize,
82 goto error; 99 goto error;
83 } 100 }
84 101
85 err = p9_conn_rpc(clnt->conn, tc, &rc); 102 err = p9_client_rpc(clnt->conn, tc, &rc);
86 if (err) 103 if (err)
87 goto error; 104 goto error;
88 105
@@ -174,7 +191,7 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
174 goto error; 191 goto error;
175 } 192 }
176 193
177 err = p9_conn_rpc(clnt->conn, tc, &rc); 194 err = p9_client_rpc(clnt->conn, tc, &rc);
178 if (err) 195 if (err)
179 goto error; 196 goto error;
180 197
@@ -219,7 +236,7 @@ struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname,
219 goto error; 236 goto error;
220 } 237 }
221 238
222 err = p9_conn_rpc(clnt->conn, tc, &rc); 239 err = p9_client_rpc(clnt->conn, tc, &rc);
223 if (err) 240 if (err)
224 goto error; 241 goto error;
225 242
@@ -270,7 +287,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
270 goto error; 287 goto error;
271 } 288 }
272 289
273 err = p9_conn_rpc(clnt->conn, tc, &rc); 290 err = p9_client_rpc(clnt->conn, tc, &rc);
274 if (err) { 291 if (err) {
275 if (rc && rc->id == P9_RWALK) 292 if (rc && rc->id == P9_RWALK)
276 goto clunk_fid; 293 goto clunk_fid;
@@ -305,7 +322,7 @@ clunk_fid:
305 goto error; 322 goto error;
306 } 323 }
307 324
308 p9_conn_rpc(clnt->conn, tc, &rc); 325 p9_client_rpc(clnt->conn, tc, &rc);
309 326
310error: 327error:
311 kfree(tc); 328 kfree(tc);
@@ -339,7 +356,7 @@ int p9_client_open(struct p9_fid *fid, int mode)
339 goto done; 356 goto done;
340 } 357 }
341 358
342 err = p9_conn_rpc(clnt->conn, tc, &rc); 359 err = p9_client_rpc(clnt->conn, tc, &rc);
343 if (err) 360 if (err)
344 goto done; 361 goto done;
345 362
@@ -378,7 +395,7 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
378 goto done; 395 goto done;
379 } 396 }
380 397
381 err = p9_conn_rpc(clnt->conn, tc, &rc); 398 err = p9_client_rpc(clnt->conn, tc, &rc);
382 if (err) 399 if (err)
383 goto done; 400 goto done;
384 401
@@ -411,7 +428,7 @@ int p9_client_clunk(struct p9_fid *fid)
411 goto done; 428 goto done;
412 } 429 }
413 430
414 err = p9_conn_rpc(clnt->conn, tc, &rc); 431 err = p9_client_rpc(clnt->conn, tc, &rc);
415 if (err) 432 if (err)
416 goto done; 433 goto done;
417 434
@@ -443,7 +460,7 @@ int p9_client_remove(struct p9_fid *fid)
443 goto done; 460 goto done;
444 } 461 }
445 462
446 err = p9_conn_rpc(clnt->conn, tc, &rc); 463 err = p9_client_rpc(clnt->conn, tc, &rc);
447 if (err) 464 if (err)
448 goto done; 465 goto done;
449 466
@@ -485,7 +502,7 @@ int p9_client_read(struct p9_fid *fid, char *data, u64 offset, u32 count)
485 goto error; 502 goto error;
486 } 503 }
487 504
488 err = p9_conn_rpc(clnt->conn, tc, &rc); 505 err = p9_client_rpc(clnt->conn, tc, &rc);
489 if (err) 506 if (err)
490 goto error; 507 goto error;
491 508
@@ -542,7 +559,7 @@ int p9_client_write(struct p9_fid *fid, char *data, u64 offset, u32 count)
542 goto error; 559 goto error;
543 } 560 }
544 561
545 err = p9_conn_rpc(clnt->conn, tc, &rc); 562 err = p9_client_rpc(clnt->conn, tc, &rc);
546 if (err) 563 if (err)
547 goto error; 564 goto error;
548 565
@@ -596,7 +613,7 @@ p9_client_uread(struct p9_fid *fid, char __user *data, u64 offset, u32 count)
596 goto error; 613 goto error;
597 } 614 }
598 615
599 err = p9_conn_rpc(clnt->conn, tc, &rc); 616 err = p9_client_rpc(clnt->conn, tc, &rc);
600 if (err) 617 if (err)
601 goto error; 618 goto error;
602 619
@@ -660,7 +677,7 @@ p9_client_uwrite(struct p9_fid *fid, const char __user *data, u64 offset,
660 goto error; 677 goto error;
661 } 678 }
662 679
663 err = p9_conn_rpc(clnt->conn, tc, &rc); 680 err = p9_client_rpc(clnt->conn, tc, &rc);
664 if (err) 681 if (err)
665 goto error; 682 goto error;
666 683
@@ -731,7 +748,7 @@ struct p9_stat *p9_client_stat(struct p9_fid *fid)
731 goto error; 748 goto error;
732 } 749 }
733 750
734 err = p9_conn_rpc(clnt->conn, tc, &rc); 751 err = p9_client_rpc(clnt->conn, tc, &rc);
735 if (err) 752 if (err)
736 goto error; 753 goto error;
737 754
@@ -773,7 +790,7 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst)
773 goto done; 790 goto done;
774 } 791 }
775 792
776 err = p9_conn_rpc(clnt->conn, tc, &rc); 793 err = p9_client_rpc(clnt->conn, tc, &rc);
777 794
778done: 795done:
779 kfree(tc); 796 kfree(tc);
@@ -830,7 +847,7 @@ struct p9_stat *p9_client_dirread(struct p9_fid *fid, u64 offset)
830 goto error; 847 goto error;
831 } 848 }
832 849
833 err = p9_conn_rpc(clnt->conn, tc, &rc); 850 err = p9_client_rpc(clnt->conn, tc, &rc);
834 if (err) 851 if (err)
835 goto error; 852 goto error;
836 853