diff options
Diffstat (limited to 'net/9p/mod.c')
-rw-r--r-- | net/9p/mod.c | 71 |
1 files changed, 62 insertions, 9 deletions
diff --git a/net/9p/mod.c b/net/9p/mod.c index 4f9e1d2ac257..41d70f47375d 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 */ |
@@ -37,8 +41,64 @@ MODULE_PARM_DESC(debug, "9P debugging level"); | |||
37 | 41 | ||
38 | extern int p9_mux_global_init(void); | 42 | extern int p9_mux_global_init(void); |
39 | extern void p9_mux_global_exit(void); | 43 | extern void p9_mux_global_exit(void); |
40 | extern int p9_sysctl_register(void); | 44 | |
41 | extern void p9_sysctl_unregister(void); | 45 | /* |
46 | * Dynamic Transport Registration Routines | ||
47 | * | ||
48 | */ | ||
49 | |||
50 | static LIST_HEAD(v9fs_trans_list); | ||
51 | static struct p9_trans_module *v9fs_default_transport; | ||
52 | |||
53 | /** | ||
54 | * v9fs_register_trans - register a new transport with 9p | ||
55 | * @m - structure describing the transport module and entry points | ||
56 | * | ||
57 | */ | ||
58 | void v9fs_register_trans(struct p9_trans_module *m) | ||
59 | { | ||
60 | list_add_tail(&m->list, &v9fs_trans_list); | ||
61 | if (m->def) | ||
62 | v9fs_default_transport = m; | ||
63 | } | ||
64 | EXPORT_SYMBOL(v9fs_register_trans); | ||
65 | |||
66 | /** | ||
67 | * v9fs_match_trans - match transport versus registered transports | ||
68 | * @arg: string identifying transport | ||
69 | * | ||
70 | */ | ||
71 | struct p9_trans_module *v9fs_match_trans(const substring_t *name) | ||
72 | { | ||
73 | struct list_head *p; | ||
74 | struct p9_trans_module *t = NULL; | ||
75 | |||
76 | list_for_each(p, &v9fs_trans_list) { | ||
77 | t = list_entry(p, struct p9_trans_module, list); | ||
78 | if (strncmp(t->name, name->from, name->to-name->from) == 0) | ||
79 | break; | ||
80 | } | ||
81 | return t; | ||
82 | } | ||
83 | EXPORT_SYMBOL(v9fs_match_trans); | ||
84 | |||
85 | /** | ||
86 | * v9fs_default_trans - returns pointer to default transport | ||
87 | * | ||
88 | */ | ||
89 | |||
90 | struct p9_trans_module *v9fs_default_trans(void) | ||
91 | { | ||
92 | if (v9fs_default_transport) | ||
93 | return v9fs_default_transport; | ||
94 | else if (!list_empty(&v9fs_trans_list)) | ||
95 | return list_first_entry(&v9fs_trans_list, | ||
96 | struct p9_trans_module, list); | ||
97 | else | ||
98 | return NULL; | ||
99 | } | ||
100 | EXPORT_SYMBOL(v9fs_default_trans); | ||
101 | |||
42 | 102 | ||
43 | /** | 103 | /** |
44 | * v9fs_init - Initialize module | 104 | * v9fs_init - Initialize module |
@@ -56,12 +116,6 @@ static int __init init_p9(void) | |||
56 | return ret; | 116 | return ret; |
57 | } | 117 | } |
58 | 118 | ||
59 | ret = p9_sysctl_register(); | ||
60 | if (ret) { | ||
61 | printk(KERN_WARNING "9p: registering sysctl failed\n"); | ||
62 | return ret; | ||
63 | } | ||
64 | |||
65 | return ret; | 119 | return ret; |
66 | } | 120 | } |
67 | 121 | ||
@@ -72,7 +126,6 @@ static int __init init_p9(void) | |||
72 | 126 | ||
73 | static void __exit exit_p9(void) | 127 | static void __exit exit_p9(void) |
74 | { | 128 | { |
75 | p9_sysctl_unregister(); | ||
76 | p9_mux_global_exit(); | 129 | p9_mux_global_exit(); |
77 | } | 130 | } |
78 | 131 | ||