diff options
Diffstat (limited to 'net/9p/mod.c')
-rw-r--r-- | net/9p/mod.c | 62 |
1 files changed, 62 insertions, 0 deletions
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 | * |