diff options
author | Eric Van Hensbergen <ericvh@ericvh-laptop.(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 | fb0466c3ae7f1c73f70072af8fd27ac166908a2f (patch) | |
tree | 24af82c397d1f155bded80f3fcb49849da28bcc9 /net | |
parent | 50fd8010673b770f6489c9ee96680c204aefa84a (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 'net')
-rw-r--r-- | net/9p/client.c | 1 | ||||
-rw-r--r-- | net/9p/mod.c | 62 | ||||
-rw-r--r-- | net/9p/mux.c | 1 |
3 files changed, 64 insertions, 0 deletions
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 | ||