diff options
author | Eric Van Hensbergen <ericvh@opteron.(none)> | 2007-10-17 15:31:07 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@ericvh-desktop.austin.ibm.com> | 2007-10-17 15:31:07 -0400 |
commit | a80d923e1321a7ed69a0918de37e39871bb536a0 (patch) | |
tree | 8294e5f14a0e938ae4675ef912a32fbade0f832b /include | |
parent | 0eafaae84e21ac033815cc9f33c3ae889cd7ccfe (diff) |
9p: Make transports dynamic
This patch abstracts out the interfaces to underlying transports so that
new transports can be added as modules. This should also allow kernel
configuration of transports without ifdef-hell.
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/9p/client.h | 4 | ||||
-rw-r--r-- | include/net/9p/conn.h | 4 | ||||
-rw-r--r-- | include/net/9p/transport.h | 25 |
3 files changed, 19 insertions, 14 deletions
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index d65ed7c69063..0adafdb273f0 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
@@ -29,7 +29,7 @@ struct p9_client { | |||
29 | spinlock_t lock; /* protect client structure */ | 29 | spinlock_t lock; /* protect client structure */ |
30 | int msize; | 30 | int msize; |
31 | unsigned char dotu; | 31 | unsigned char dotu; |
32 | struct p9_transport *trans; | 32 | struct p9_trans *trans; |
33 | struct p9_conn *conn; | 33 | struct p9_conn *conn; |
34 | 34 | ||
35 | struct p9_idpool *fidpool; | 35 | struct p9_idpool *fidpool; |
@@ -52,7 +52,7 @@ struct p9_fid { | |||
52 | struct list_head dlist; /* list of all fids attached to a dentry */ | 52 | struct list_head dlist; /* list of all fids attached to a dentry */ |
53 | }; | 53 | }; |
54 | 54 | ||
55 | struct p9_client *p9_client_create(struct p9_transport *trans, int msize, | 55 | struct p9_client *p9_client_create(struct p9_trans *trans, int msize, |
56 | int dotu); | 56 | int dotu); |
57 | void p9_client_destroy(struct p9_client *clnt); | 57 | void p9_client_destroy(struct p9_client *clnt); |
58 | void p9_client_disconnect(struct p9_client *clnt); | 58 | void p9_client_disconnect(struct p9_client *clnt); |
diff --git a/include/net/9p/conn.h b/include/net/9p/conn.h index 583b6a2cb3df..756d8784f953 100644 --- a/include/net/9p/conn.h +++ b/include/net/9p/conn.h | |||
@@ -42,8 +42,8 @@ struct p9_req; | |||
42 | */ | 42 | */ |
43 | typedef void (*p9_conn_req_callback)(struct p9_req *req, void *a); | 43 | typedef void (*p9_conn_req_callback)(struct p9_req *req, void *a); |
44 | 44 | ||
45 | struct p9_conn *p9_conn_create(struct p9_transport *trans, int msize, | 45 | struct p9_conn *p9_conn_create(struct p9_trans *trans, int msize, |
46 | unsigned char *dotu); | 46 | unsigned char *dotu); |
47 | void p9_conn_destroy(struct p9_conn *); | 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); | 48 | int p9_conn_rpc(struct p9_conn *m, struct p9_fcall *tc, struct p9_fcall **rc); |
49 | 49 | ||
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h index 462d42279fb0..7c68b3e8e78c 100644 --- a/include/net/9p/transport.h +++ b/include/net/9p/transport.h | |||
@@ -26,24 +26,29 @@ | |||
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 | enum p9_transport_status { | 29 | enum p9_trans_status { |
30 | Connected, | 30 | Connected, |
31 | Disconnected, | 31 | Disconnected, |
32 | Hung, | 32 | Hung, |
33 | }; | 33 | }; |
34 | 34 | ||
35 | struct p9_transport { | 35 | struct p9_trans { |
36 | enum p9_transport_status status; | 36 | enum p9_trans_status status; |
37 | void *priv; | 37 | void *priv; |
38 | int (*write) (struct p9_trans *, void *, int); | ||
39 | int (*read) (struct p9_trans *, void *, int); | ||
40 | void (*close) (struct p9_trans *); | ||
41 | unsigned int (*poll)(struct p9_trans *, struct poll_table_struct *); | ||
42 | }; | ||
38 | 43 | ||
39 | int (*write) (struct p9_transport *, void *, int); | 44 | struct p9_trans_module { |
40 | int (*read) (struct p9_transport *, void *, int); | 45 | struct list_head list; |
41 | void (*close) (struct p9_transport *); | 46 | char *name; /* name of transport */ |
42 | unsigned int (*poll)(struct p9_transport *, struct poll_table_struct *); | 47 | int maxsize; /* max message size of transport */ |
48 | int def; /* this transport should be default */ | ||
49 | struct p9_trans * (*create)(const char *devname, char *options); | ||
43 | }; | 50 | }; |
44 | 51 | ||
45 | struct p9_transport *p9_trans_create_tcp(const char *addr, int port); | 52 | void v9fs_register_trans(struct p9_trans_module *m); |
46 | struct p9_transport *p9_trans_create_unix(const char *addr); | ||
47 | struct p9_transport *p9_trans_create_fd(int rfd, int wfd); | ||
48 | 53 | ||
49 | #endif /* NET_9P_TRANSPORT_H */ | 54 | #endif /* NET_9P_TRANSPORT_H */ |