aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/v9fs.c
diff options
context:
space:
mode:
authorEric Van Hensbergen <ericvh@ericvh-laptop.(none)>2007-10-17 15:31:07 -0400
committerEric Van Hensbergen <ericvh@ericvh-desktop.austin.ibm.com>2007-10-17 15:31:07 -0400
commitfb0466c3ae7f1c73f70072af8fd27ac166908a2f (patch)
tree24af82c397d1f155bded80f3fcb49849da28bcc9 /fs/9p/v9fs.c
parent50fd8010673b770f6489c9ee96680c204aefa84a (diff)
9p: fix bad kconfig cross-dependency
This patch moves transport dynamic registration and matching to the net module to prevent a bad Kconfig dependency between the net and fs 9p modules. Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/v9fs.c')
-rw-r--r--fs/9p/v9fs.c47
1 files changed, 1 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
44static LIST_HEAD(v9fs_trans_list);
45static 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 */
52void 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}
58EXPORT_SYMBOL(v9fs_register_trans);
59
60/**
61 * v9fs_match_trans - match transport versus registered transports
62 * @arg: string identifying transport
63 *
64 */
65static 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,