diff options
author | Eric Van Hensbergen <ericvh@ericvh-desktop.austin.ibm.com> | 2008-10-13 18:45:25 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2008-10-17 11:04:41 -0500 |
commit | 8b81ef589ad1483dd977ef47fe00d4ce4d91a0ab (patch) | |
tree | 380a19ca0f55fefc60c4a45771f5273c80539c07 /include/net | |
parent | 992b3f1dbeec401e19a80bdb8c81e5df5381f4c5 (diff) | |
download | op-kernel-dev-8b81ef589ad1483dd977ef47fe00d4ce4d91a0ab.zip op-kernel-dev-8b81ef589ad1483dd977ef47fe00d4ce4d91a0ab.tar.gz |
9p: consolidate transport structure
Right now there is a transport module structure which provides per-transport
type functions and data and a transport structure which contains per-instance
public data as well as function pointers to instance specific functions.
This patch moves public transport visible instance data to the client
structure (which in some cases had duplicate data) and consolidates the
functions into the transport module structure.
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/9p/client.h | 19 | ||||
-rw-r--r-- | include/net/9p/transport.h | 55 |
2 files changed, 25 insertions, 49 deletions
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index c936dd1..c35fb54 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h @@ -27,6 +27,22 @@ #define NET_9P_CLIENT_H /** + * enum p9_trans_status - different states of underlying transports + * @Connected: transport is connected and healthy + * @Disconnected: transport has been disconnected + * @Hung: transport is connected by wedged + * + * This enumeration details the various states a transport + * instatiation can be in. + */ + +enum p9_trans_status { + Connected, + Disconnected, + Hung, +}; + +/** * struct p9_client - per client instance state * @lock: protect @fidlist * @msize: maximum data size negotiated by protocol @@ -48,7 +64,8 @@ struct p9_client { int msize; unsigned char dotu; struct p9_trans_module *trans_mod; - struct p9_trans *trans; + enum p9_trans_status status; + void *trans; struct p9_conn *conn; struct p9_idpool *fidpool; diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h index 3ca7371..3e0f2f6 100644 --- a/include/net/9p/transport.h +++ b/include/net/9p/transport.h @@ -26,52 +26,6 @@ #ifndef NET_9P_TRANSPORT_H #define NET_9P_TRANSPORT_H -#include <linux/module.h> - -/** - * enum p9_trans_status - different states of underlying transports - * @Connected: transport is connected and healthy - * @Disconnected: transport has been disconnected - * @Hung: transport is connected by wedged - * - * This enumeration details the various states a transport - * instatiation can be in. - */ - -enum p9_trans_status { - Connected, - Disconnected, - Hung, -}; - -/** - * struct p9_trans - per-transport state and API - * @status: transport &p9_trans_status - * @msize: negotiated maximum packet size (duplicate from client) - * @extended: negotiated protocol extensions (duplicate from client) - * @priv: transport private data - * @close: member function to disconnect and close the transport - * @rpc: member function to issue a request to the transport - * - * This is the basic API for a transport instance. It is used as - * a handle by the client to issue requests. This interface is currently - * in flux during reorganization. - * - * Bugs: there is lots of duplicated data here and its not clear that - * the member functions need to be per-instance versus per transport - * module. - */ - -struct p9_trans { - enum p9_trans_status status; - int msize; - unsigned char extended; - void *priv; - void (*close) (struct p9_trans *); - int (*rpc) (struct p9_trans *t, struct p9_fcall *tc, - struct p9_fcall **rc); -}; - /** * struct p9_trans_module - transport module interface * @list: used to maintain a list of currently available transports @@ -79,12 +33,14 @@ struct p9_trans { * @maxsize: transport provided maximum packet size * @def: set if this transport should be considered the default * @create: member function to create a new connection on this transport + * @close: member function to disconnect and close the transport + * @rpc: member function to issue a request to the transport * * This is the basic API for a transport module which is registered by the * transport module with the 9P core network module and used by the client * to instantiate a new connection on a transport. * - * Bugs: the transport module list isn't protected. + * BUGS: the transport module list isn't protected. */ struct p9_trans_module { @@ -92,8 +48,11 @@ struct p9_trans_module { char *name; /* name of transport */ int maxsize; /* max message size of transport */ int def; /* this transport should be default */ - struct p9_trans * (*create)(const char *, char *, int, unsigned char); struct module *owner; + int (*create)(struct p9_client *, const char *, char *); + void (*close) (struct p9_client *); + int (*rpc) (struct p9_client *t, struct p9_fcall *tc, + struct p9_fcall **rc); }; void v9fs_register_trans(struct p9_trans_module *m); |