aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorEric Van Hensbergen <ericvh@ericvh-desktop.austin.ibm.com>2008-10-13 19:45:25 -0400
committerEric Van Hensbergen <ericvh@gmail.com>2008-10-17 12:04:41 -0400
commit8b81ef589ad1483dd977ef47fe00d4ce4d91a0ab (patch)
tree380a19ca0f55fefc60c4a45771f5273c80539c07 /include/net
parent992b3f1dbeec401e19a80bdb8c81e5df5381f4c5 (diff)
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.h19
-rw-r--r--include/net/9p/transport.h55
2 files changed, 25 insertions, 49 deletions
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index c936dd14de41..c35fb548e7cf 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -27,6 +27,22 @@
27#define NET_9P_CLIENT_H 27#define NET_9P_CLIENT_H
28 28
29/** 29/**
30 * enum p9_trans_status - different states of underlying transports
31 * @Connected: transport is connected and healthy
32 * @Disconnected: transport has been disconnected
33 * @Hung: transport is connected by wedged
34 *
35 * This enumeration details the various states a transport
36 * instatiation can be in.
37 */
38
39enum p9_trans_status {
40 Connected,
41 Disconnected,
42 Hung,
43};
44
45/**
30 * struct p9_client - per client instance state 46 * struct p9_client - per client instance state
31 * @lock: protect @fidlist 47 * @lock: protect @fidlist
32 * @msize: maximum data size negotiated by protocol 48 * @msize: maximum data size negotiated by protocol
@@ -48,7 +64,8 @@ struct p9_client {
48 int msize; 64 int msize;
49 unsigned char dotu; 65 unsigned char dotu;
50 struct p9_trans_module *trans_mod; 66 struct p9_trans_module *trans_mod;
51 struct p9_trans *trans; 67 enum p9_trans_status status;
68 void *trans;
52 struct p9_conn *conn; 69 struct p9_conn *conn;
53 70
54 struct p9_idpool *fidpool; 71 struct p9_idpool *fidpool;
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 3ca737120a90..3e0f2f6beba2 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -26,52 +26,6 @@
26#ifndef NET_9P_TRANSPORT_H 26#ifndef NET_9P_TRANSPORT_H
27#define NET_9P_TRANSPORT_H 27#define NET_9P_TRANSPORT_H
28 28
29#include <linux/module.h>
30
31/**
32 * enum p9_trans_status - different states of underlying transports
33 * @Connected: transport is connected and healthy
34 * @Disconnected: transport has been disconnected
35 * @Hung: transport is connected by wedged
36 *
37 * This enumeration details the various states a transport
38 * instatiation can be in.
39 */
40
41enum p9_trans_status {
42 Connected,
43 Disconnected,
44 Hung,
45};
46
47/**
48 * struct p9_trans - per-transport state and API
49 * @status: transport &p9_trans_status
50 * @msize: negotiated maximum packet size (duplicate from client)
51 * @extended: negotiated protocol extensions (duplicate from client)
52 * @priv: transport private data
53 * @close: member function to disconnect and close the transport
54 * @rpc: member function to issue a request to the transport
55 *
56 * This is the basic API for a transport instance. It is used as
57 * a handle by the client to issue requests. This interface is currently
58 * in flux during reorganization.
59 *
60 * Bugs: there is lots of duplicated data here and its not clear that
61 * the member functions need to be per-instance versus per transport
62 * module.
63 */
64
65struct p9_trans {
66 enum p9_trans_status status;
67 int msize;
68 unsigned char extended;
69 void *priv;
70 void (*close) (struct p9_trans *);
71 int (*rpc) (struct p9_trans *t, struct p9_fcall *tc,
72 struct p9_fcall **rc);
73};
74
75/** 29/**
76 * struct p9_trans_module - transport module interface 30 * struct p9_trans_module - transport module interface
77 * @list: used to maintain a list of currently available transports 31 * @list: used to maintain a list of currently available transports
@@ -79,12 +33,14 @@ struct p9_trans {
79 * @maxsize: transport provided maximum packet size 33 * @maxsize: transport provided maximum packet size
80 * @def: set if this transport should be considered the default 34 * @def: set if this transport should be considered the default
81 * @create: member function to create a new connection on this transport 35 * @create: member function to create a new connection on this transport
36 * @close: member function to disconnect and close the transport
37 * @rpc: member function to issue a request to the transport
82 * 38 *
83 * This is the basic API for a transport module which is registered by the 39 * This is the basic API for a transport module which is registered by the
84 * transport module with the 9P core network module and used by the client 40 * transport module with the 9P core network module and used by the client
85 * to instantiate a new connection on a transport. 41 * to instantiate a new connection on a transport.
86 * 42 *
87 * Bugs: the transport module list isn't protected. 43 * BUGS: the transport module list isn't protected.
88 */ 44 */
89 45
90struct p9_trans_module { 46struct p9_trans_module {
@@ -92,8 +48,11 @@ struct p9_trans_module {
92 char *name; /* name of transport */ 48 char *name; /* name of transport */
93 int maxsize; /* max message size of transport */ 49 int maxsize; /* max message size of transport */
94 int def; /* this transport should be default */ 50 int def; /* this transport should be default */
95 struct p9_trans * (*create)(const char *, char *, int, unsigned char);
96 struct module *owner; 51 struct module *owner;
52 int (*create)(struct p9_client *, const char *, char *);
53 void (*close) (struct p9_client *);
54 int (*rpc) (struct p9_client *t, struct p9_fcall *tc,
55 struct p9_fcall **rc);
97}; 56};
98 57
99void v9fs_register_trans(struct p9_trans_module *m); 58void v9fs_register_trans(struct p9_trans_module *m);