diff options
| author | Eric Van Hensbergen <ericvh@opteron.homeip.net> | 2008-02-06 20:25:03 -0500 |
|---|---|---|
| committer | Eric Van Hensbergen <ericvh@opteron.homeip.net> | 2008-02-06 20:25:03 -0500 |
| commit | 8a0dc95fd976a052e5e799ef33e6c8e3141b5dff (patch) | |
| tree | 3275903539244acd76c716662c324833aa419377 /include | |
| parent | f39335453fe79f4e12e263e7c6387dc9fb86bfff (diff) | |
9p: transport API reorganization
This merges the mux.c (including the connection interface) with trans_fd
in preparation for transport API changes. Ultimately, trans_fd will need
to be rewritten to clean it up and simplify the implementation, but this
reorganization is viewed as the first step.
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/9p/client.h | 5 | ||||
| -rw-r--r-- | include/net/9p/conn.h | 57 | ||||
| -rw-r--r-- | include/net/9p/transport.h | 11 |
3 files changed, 8 insertions, 65 deletions
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index 9b9221a21392..e52f93d9ac5f 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * 9P Client Definitions | 4 | * 9P Client Definitions |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2008 by Eric Van Hensbergen <ericvh@gmail.com> | ||
| 6 | * Copyright (C) 2007 by Latchesar Ionkov <lucho@ionkov.net> | 7 | * Copyright (C) 2007 by Latchesar Ionkov <lucho@ionkov.net> |
| 7 | * | 8 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
| @@ -29,6 +30,7 @@ struct p9_client { | |||
| 29 | spinlock_t lock; /* protect client structure */ | 30 | spinlock_t lock; /* protect client structure */ |
| 30 | int msize; | 31 | int msize; |
| 31 | unsigned char dotu; | 32 | unsigned char dotu; |
| 33 | struct p9_trans_module *trans_mod; | ||
| 32 | struct p9_trans *trans; | 34 | struct p9_trans *trans; |
| 33 | struct p9_conn *conn; | 35 | struct p9_conn *conn; |
| 34 | 36 | ||
| @@ -52,8 +54,7 @@ struct p9_fid { | |||
| 52 | struct list_head dlist; /* list of all fids attached to a dentry */ | 54 | struct list_head dlist; /* list of all fids attached to a dentry */ |
| 53 | }; | 55 | }; |
| 54 | 56 | ||
| 55 | struct p9_client *p9_client_create(struct p9_trans *trans, int msize, | 57 | struct p9_client *p9_client_create(const char *dev_name, char *options); |
| 56 | int dotu); | ||
| 57 | void p9_client_destroy(struct p9_client *clnt); | 58 | void p9_client_destroy(struct p9_client *clnt); |
| 58 | void p9_client_disconnect(struct p9_client *clnt); | 59 | void p9_client_disconnect(struct p9_client *clnt); |
| 59 | struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, | 60 | struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, |
diff --git a/include/net/9p/conn.h b/include/net/9p/conn.h deleted file mode 100644 index 756d8784f953..000000000000 --- a/include/net/9p/conn.h +++ /dev/null | |||
| @@ -1,57 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * include/net/9p/conn.h | ||
| 3 | * | ||
| 4 | * Connection Definitions | ||
| 5 | * | ||
| 6 | * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> | ||
| 7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License version 2 | ||
| 11 | * as published by the Free Software Foundation. | ||
| 12 | * | ||
| 13 | * This program is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License | ||
| 19 | * along with this program; if not, write to: | ||
| 20 | * Free Software Foundation | ||
| 21 | * 51 Franklin Street, Fifth Floor | ||
| 22 | * Boston, MA 02111-1301 USA | ||
| 23 | * | ||
| 24 | */ | ||
| 25 | |||
| 26 | #ifndef NET_9P_CONN_H | ||
| 27 | #define NET_9P_CONN_H | ||
| 28 | |||
| 29 | #undef P9_NONBLOCK | ||
| 30 | |||
| 31 | struct p9_conn; | ||
| 32 | struct p9_req; | ||
| 33 | |||
| 34 | /** | ||
| 35 | * p9_mux_req_callback - callback function that is called when the | ||
| 36 | * response of a request is received. The callback is called from | ||
| 37 | * a workqueue and shouldn't block. | ||
| 38 | * | ||
| 39 | * @req - request | ||
| 40 | * @a - the pointer that was specified when the request was send to be | ||
| 41 | * passed to the callback | ||
| 42 | */ | ||
| 43 | typedef void (*p9_conn_req_callback)(struct p9_req *req, void *a); | ||
| 44 | |||
| 45 | struct p9_conn *p9_conn_create(struct p9_trans *trans, int msize, | ||
| 46 | unsigned char *dotu); | ||
| 47 | void p9_conn_destroy(struct p9_conn *); | ||
| 48 | int p9_conn_rpc(struct p9_conn *m, struct p9_fcall *tc, struct p9_fcall **rc); | ||
| 49 | |||
| 50 | #ifdef P9_NONBLOCK | ||
| 51 | int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc, | ||
| 52 | p9_conn_req_callback cb, void *a); | ||
| 53 | #endif /* P9_NONBLOCK */ | ||
| 54 | |||
| 55 | void p9_conn_cancel(struct p9_conn *m, int err); | ||
| 56 | |||
| 57 | #endif /* NET_9P_CONN_H */ | ||
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h index f9f362e934c9..d2209ae9d18b 100644 --- a/include/net/9p/transport.h +++ b/include/net/9p/transport.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Transport Definition | 4 | * Transport Definition |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> | 6 | * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> |
| 7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> | 7 | * Copyright (C) 2004-2008 by Eric Van Hensbergen <ericvh@gmail.com> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 | 10 | * it under the terms of the GNU General Public License version 2 |
| @@ -34,13 +34,12 @@ enum p9_trans_status { | |||
| 34 | 34 | ||
| 35 | struct p9_trans { | 35 | struct p9_trans { |
| 36 | enum p9_trans_status status; | 36 | enum p9_trans_status status; |
| 37 | int msize; | ||
| 38 | unsigned char extended; | ||
| 37 | void *priv; | 39 | void *priv; |
| 38 | int (*write) (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 *); | ||
| 42 | int (*rpc) (struct p9_trans *t, struct p9_fcall *tc, | 41 | int (*rpc) (struct p9_trans *t, struct p9_fcall *tc, |
| 43 | struct p9_fcall **rc, int msize, int dotu); | 42 | struct p9_fcall **rc); |
| 44 | }; | 43 | }; |
| 45 | 44 | ||
| 46 | struct p9_trans_module { | 45 | struct p9_trans_module { |
| @@ -48,7 +47,7 @@ struct p9_trans_module { | |||
| 48 | char *name; /* name of transport */ | 47 | char *name; /* name of transport */ |
| 49 | int maxsize; /* max message size of transport */ | 48 | int maxsize; /* max message size of transport */ |
| 50 | int def; /* this transport should be default */ | 49 | int def; /* this transport should be default */ |
| 51 | struct p9_trans * (*create)(const char *devname, char *options); | 50 | struct p9_trans * (*create)(const char *, char *, int, unsigned char); |
| 52 | }; | 51 | }; |
| 53 | 52 | ||
| 54 | void v9fs_register_trans(struct p9_trans_module *m); | 53 | void v9fs_register_trans(struct p9_trans_module *m); |
