diff options
-rw-r--r-- | fs/9p/v9fs.c | 47 | ||||
-rw-r--r-- | include/net/9p/transport.h | 2 | ||||
-rw-r--r-- | net/9p/client.c | 1 | ||||
-rw-r--r-- | net/9p/mod.c | 62 | ||||
-rw-r--r-- | net/9p/mux.c | 1 |
5 files changed, 67 insertions, 46 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 89ee0bace41d..873802de21cd 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -37,47 +37,6 @@ | |||
37 | #include "v9fs_vfs.h" | 37 | #include "v9fs_vfs.h" |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * Dynamic Transport Registration Routines | ||
41 | * | ||
42 | */ | ||
43 | |||
44 | static LIST_HEAD(v9fs_trans_list); | ||
45 | static struct p9_trans_module *v9fs_default_trans; | ||
46 | |||
47 | /** | ||
48 | * v9fs_register_trans - register a new transport with 9p | ||
49 | * @m - structure describing the transport module and entry points | ||
50 | * | ||
51 | */ | ||
52 | void v9fs_register_trans(struct p9_trans_module *m) | ||
53 | { | ||
54 | list_add_tail(&m->list, &v9fs_trans_list); | ||
55 | if (m->def) | ||
56 | v9fs_default_trans = m; | ||
57 | } | ||
58 | EXPORT_SYMBOL(v9fs_register_trans); | ||
59 | |||
60 | /** | ||
61 | * v9fs_match_trans - match transport versus registered transports | ||
62 | * @arg: string identifying transport | ||
63 | * | ||
64 | */ | ||
65 | static struct p9_trans_module *v9fs_match_trans(const substring_t *name) | ||
66 | { | ||
67 | struct list_head *p; | ||
68 | struct p9_trans_module *t = NULL; | ||
69 | |||
70 | list_for_each(p, &v9fs_trans_list) { | ||
71 | t = list_entry(p, struct p9_trans_module, list); | ||
72 | if (strncmp(t->name, name->from, name->to-name->from) == 0) { | ||
73 | P9_DPRINTK(P9_DEBUG_TRANS, "trans=%s\n", t->name); | ||
74 | break; | ||
75 | } | ||
76 | } | ||
77 | return t; | ||
78 | } | ||
79 | |||
80 | /* | ||
81 | * Option Parsing (code inspired by NFS code) | 40 | * Option Parsing (code inspired by NFS code) |
82 | * NOTE: each transport will parse its own options | 41 | * NOTE: each transport will parse its own options |
83 | */ | 42 | */ |
@@ -135,7 +94,7 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses) | |||
135 | v9ses->afid = ~0; | 94 | v9ses->afid = ~0; |
136 | v9ses->debug = 0; | 95 | v9ses->debug = 0; |
137 | v9ses->cache = 0; | 96 | v9ses->cache = 0; |
138 | v9ses->trans = v9fs_default_trans; | 97 | v9ses->trans = v9fs_default_trans(); |
139 | 98 | ||
140 | if (!options) | 99 | if (!options) |
141 | return; | 100 | return; |
@@ -245,10 +204,6 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
245 | v9ses->options = kstrdup(data, GFP_KERNEL); | 204 | v9ses->options = kstrdup(data, GFP_KERNEL); |
246 | v9fs_parse_options(v9ses); | 205 | v9fs_parse_options(v9ses); |
247 | 206 | ||
248 | if ((v9ses->trans == NULL) && !list_empty(&v9fs_trans_list)) | ||
249 | v9ses->trans = list_first_entry(&v9fs_trans_list, | ||
250 | struct p9_trans_module, list); | ||
251 | |||
252 | if (v9ses->trans == NULL) { | 207 | if (v9ses->trans == NULL) { |
253 | retval = -EPROTONOSUPPORT; | 208 | retval = -EPROTONOSUPPORT; |
254 | P9_DPRINTK(P9_DEBUG_ERROR, | 209 | P9_DPRINTK(P9_DEBUG_ERROR, |
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h index 7c68b3e8e78c..9dd4a05619a8 100644 --- a/include/net/9p/transport.h +++ b/include/net/9p/transport.h | |||
@@ -50,5 +50,7 @@ struct p9_trans_module { | |||
50 | }; | 50 | }; |
51 | 51 | ||
52 | void v9fs_register_trans(struct p9_trans_module *m); | 52 | void v9fs_register_trans(struct p9_trans_module *m); |
53 | struct p9_trans_module *v9fs_match_trans(const substring_t *name); | ||
54 | struct p9_trans_module *v9fs_default_trans(void); | ||
53 | 55 | ||
54 | #endif /* NET_9P_TRANSPORT_H */ | 56 | #endif /* NET_9P_TRANSPORT_H */ |
diff --git a/net/9p/client.c b/net/9p/client.c index d83cc1247f1e..af9199364049 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/sched.h> | 30 | #include <linux/sched.h> |
31 | #include <linux/uaccess.h> | 31 | #include <linux/uaccess.h> |
32 | #include <net/9p/9p.h> | 32 | #include <net/9p/9p.h> |
33 | #include <linux/parser.h> | ||
33 | #include <net/9p/transport.h> | 34 | #include <net/9p/transport.h> |
34 | #include <net/9p/conn.h> | 35 | #include <net/9p/conn.h> |
35 | #include <net/9p/client.h> | 36 | #include <net/9p/client.h> |
diff --git a/net/9p/mod.c b/net/9p/mod.c index 4f9e1d2ac257..b8ac0635ad83 100644 --- a/net/9p/mod.c +++ b/net/9p/mod.c | |||
@@ -27,6 +27,10 @@ | |||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
29 | #include <net/9p/9p.h> | 29 | #include <net/9p/9p.h> |
30 | #include <linux/fs.h> | ||
31 | #include <linux/parser.h> | ||
32 | #include <net/9p/transport.h> | ||
33 | #include <linux/list.h> | ||
30 | 34 | ||
31 | #ifdef CONFIG_NET_9P_DEBUG | 35 | #ifdef CONFIG_NET_9P_DEBUG |
32 | unsigned int p9_debug_level = 0; /* feature-rific global debug level */ | 36 | unsigned int p9_debug_level = 0; /* feature-rific global debug level */ |
@@ -40,6 +44,64 @@ extern void p9_mux_global_exit(void); | |||
40 | extern int p9_sysctl_register(void); | 44 | extern int p9_sysctl_register(void); |
41 | extern void p9_sysctl_unregister(void); | 45 | extern void p9_sysctl_unregister(void); |
42 | 46 | ||
47 | /* | ||
48 | * Dynamic Transport Registration Routines | ||
49 | * | ||
50 | */ | ||
51 | |||
52 | static LIST_HEAD(v9fs_trans_list); | ||
53 | static struct p9_trans_module *v9fs_default_transport; | ||
54 | |||
55 | /** | ||
56 | * v9fs_register_trans - register a new transport with 9p | ||
57 | * @m - structure describing the transport module and entry points | ||
58 | * | ||
59 | */ | ||
60 | void v9fs_register_trans(struct p9_trans_module *m) | ||
61 | { | ||
62 | list_add_tail(&m->list, &v9fs_trans_list); | ||
63 | if (m->def) | ||
64 | v9fs_default_transport = m; | ||
65 | } | ||
66 | EXPORT_SYMBOL(v9fs_register_trans); | ||
67 | |||
68 | /** | ||
69 | * v9fs_match_trans - match transport versus registered transports | ||
70 | * @arg: string identifying transport | ||
71 | * | ||
72 | */ | ||
73 | struct p9_trans_module *v9fs_match_trans(const substring_t *name) | ||
74 | { | ||
75 | struct list_head *p; | ||
76 | struct p9_trans_module *t = NULL; | ||
77 | |||
78 | list_for_each(p, &v9fs_trans_list) { | ||
79 | t = list_entry(p, struct p9_trans_module, list); | ||
80 | if (strncmp(t->name, name->from, name->to-name->from) == 0) | ||
81 | break; | ||
82 | } | ||
83 | return t; | ||
84 | } | ||
85 | EXPORT_SYMBOL(v9fs_match_trans); | ||
86 | |||
87 | /** | ||
88 | * v9fs_default_trans - returns pointer to default transport | ||
89 | * | ||
90 | */ | ||
91 | |||
92 | struct p9_trans_module *v9fs_default_trans(void) | ||
93 | { | ||
94 | if (v9fs_default_transport) | ||
95 | return v9fs_default_transport; | ||
96 | else if (!list_empty(&v9fs_trans_list)) | ||
97 | return list_first_entry(&v9fs_trans_list, | ||
98 | struct p9_trans_module, list); | ||
99 | else | ||
100 | return NULL; | ||
101 | } | ||
102 | EXPORT_SYMBOL(v9fs_default_trans); | ||
103 | |||
104 | |||
43 | /** | 105 | /** |
44 | * v9fs_init - Initialize module | 106 | * v9fs_init - Initialize module |
45 | * | 107 | * |
diff --git a/net/9p/mux.c b/net/9p/mux.c index 934e2ea86e2c..f14014793bed 100644 --- a/net/9p/mux.c +++ b/net/9p/mux.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/idr.h> | 31 | #include <linux/idr.h> |
32 | #include <linux/mutex.h> | 32 | #include <linux/mutex.h> |
33 | #include <net/9p/9p.h> | 33 | #include <net/9p/9p.h> |
34 | #include <linux/parser.h> | ||
34 | #include <net/9p/transport.h> | 35 | #include <net/9p/transport.h> |
35 | #include <net/9p/conn.h> | 36 | #include <net/9p/conn.h> |
36 | 37 | ||