Commit 043aba40 authored by Eric Van Hensbergen's avatar Eric Van Hensbergen Committed by Eric Van Hensbergen

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: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent afcf0c13
...@@ -39,6 +39,8 @@ struct p9_trans { ...@@ -39,6 +39,8 @@ struct p9_trans {
int (*read) (struct p9_trans *, void *, int); int (*read) (struct p9_trans *, void *, int);
void (*close) (struct p9_trans *); void (*close) (struct p9_trans *);
unsigned int (*poll)(struct p9_trans *, struct poll_table_struct *); unsigned int (*poll)(struct p9_trans *, struct poll_table_struct *);
int (*rpc) (struct p9_trans *t, struct p9_fcall *tc,
struct p9_fcall **rc);
}; };
struct p9_trans_module { struct p9_trans_module {
......
...@@ -39,6 +39,23 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt); ...@@ -39,6 +39,23 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt);
static void p9_fid_destroy(struct p9_fid *fid); static void p9_fid_destroy(struct p9_fid *fid);
static struct p9_stat *p9_clone_stat(struct p9_stat *st, int dotu); static struct p9_stat *p9_clone_stat(struct p9_stat *st, int dotu);
/**
* p9_client_rpc - sends 9P request and waits until a response is available.
* The function can be interrupted.
* @c: client data
* @tc: request to be sent
* @rc: pointer where a pointer to the response is stored
*/
int
p9_client_rpc(struct p9_client *c, struct p9_fcall *tc,
struct p9_fcall **rc)
{
if (c->trans->rpc)
return c->trans->rpc(c->trans, tc, rc);
else
return p9_conn_rpc(c->conn, tc, rc);
}
struct p9_client *p9_client_create(struct p9_trans *trans, int msize, struct p9_client *p9_client_create(struct p9_trans *trans, int msize,
int dotu) int dotu)
{ {
...@@ -82,7 +99,7 @@ struct p9_client *p9_client_create(struct p9_trans *trans, int msize, ...@@ -82,7 +99,7 @@ struct p9_client *p9_client_create(struct p9_trans *trans, int msize,
goto error; goto error;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto error; goto error;
...@@ -174,7 +191,7 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, ...@@ -174,7 +191,7 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
goto error; goto error;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto error; goto error;
...@@ -219,7 +236,7 @@ struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname, ...@@ -219,7 +236,7 @@ struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname,
goto error; goto error;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto error; goto error;
...@@ -270,7 +287,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, ...@@ -270,7 +287,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
goto error; goto error;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) { if (err) {
if (rc && rc->id == P9_RWALK) if (rc && rc->id == P9_RWALK)
goto clunk_fid; goto clunk_fid;
...@@ -305,7 +322,7 @@ clunk_fid: ...@@ -305,7 +322,7 @@ clunk_fid:
goto error; goto error;
} }
p9_conn_rpc(clnt->conn, tc, &rc); p9_client_rpc(clnt->conn, tc, &rc);
error: error:
kfree(tc); kfree(tc);
...@@ -339,7 +356,7 @@ int p9_client_open(struct p9_fid *fid, int mode) ...@@ -339,7 +356,7 @@ int p9_client_open(struct p9_fid *fid, int mode)
goto done; goto done;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto done; goto done;
...@@ -378,7 +395,7 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, ...@@ -378,7 +395,7 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
goto done; goto done;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto done; goto done;
...@@ -411,7 +428,7 @@ int p9_client_clunk(struct p9_fid *fid) ...@@ -411,7 +428,7 @@ int p9_client_clunk(struct p9_fid *fid)
goto done; goto done;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto done; goto done;
...@@ -443,7 +460,7 @@ int p9_client_remove(struct p9_fid *fid) ...@@ -443,7 +460,7 @@ int p9_client_remove(struct p9_fid *fid)
goto done; goto done;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto done; goto done;
...@@ -485,7 +502,7 @@ int p9_client_read(struct p9_fid *fid, char *data, u64 offset, u32 count) ...@@ -485,7 +502,7 @@ int p9_client_read(struct p9_fid *fid, char *data, u64 offset, u32 count)
goto error; goto error;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto error; goto error;
...@@ -542,7 +559,7 @@ int p9_client_write(struct p9_fid *fid, char *data, u64 offset, u32 count) ...@@ -542,7 +559,7 @@ int p9_client_write(struct p9_fid *fid, char *data, u64 offset, u32 count)
goto error; goto error;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto error; goto error;
...@@ -596,7 +613,7 @@ p9_client_uread(struct p9_fid *fid, char __user *data, u64 offset, u32 count) ...@@ -596,7 +613,7 @@ p9_client_uread(struct p9_fid *fid, char __user *data, u64 offset, u32 count)
goto error; goto error;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto error; goto error;
...@@ -660,7 +677,7 @@ p9_client_uwrite(struct p9_fid *fid, const char __user *data, u64 offset, ...@@ -660,7 +677,7 @@ p9_client_uwrite(struct p9_fid *fid, const char __user *data, u64 offset,
goto error; goto error;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto error; goto error;
...@@ -731,7 +748,7 @@ struct p9_stat *p9_client_stat(struct p9_fid *fid) ...@@ -731,7 +748,7 @@ struct p9_stat *p9_client_stat(struct p9_fid *fid)
goto error; goto error;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto error; goto error;
...@@ -773,7 +790,7 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst) ...@@ -773,7 +790,7 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst)
goto done; goto done;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
done: done:
kfree(tc); kfree(tc);
...@@ -830,7 +847,7 @@ struct p9_stat *p9_client_dirread(struct p9_fid *fid, u64 offset) ...@@ -830,7 +847,7 @@ struct p9_stat *p9_client_dirread(struct p9_fid *fid, u64 offset)
goto error; goto error;
} }
err = p9_conn_rpc(clnt->conn, tc, &rc); err = p9_client_rpc(clnt->conn, tc, &rc);
if (err) if (err)
goto error; goto error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment