aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2011-12-10 06:45:53 -0500
committerMarek Lindner <lindner_marek@yahoo.de>2012-02-16 13:50:20 -0500
commitd419be1fd1e4417adc833365a3b69d0968c27c3f (patch)
treeb52c9fe94e4ba947f320525b6fbe8dc4051e31c6 /net/batman-adv
parent01c4224b51feba2ba64d070ab9f4aa32c9d0bb29 (diff)
batman-adv: allowing changing the routing algorithm via module parameter
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/main.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index bcc2bddd893a..8ae497b26bd8 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -256,6 +256,30 @@ int bat_algo_seq_print_text(struct seq_file *seq, void *offset)
256 return 0; 256 return 0;
257} 257}
258 258
259static int param_set_ra(const char *val, const struct kernel_param *kp)
260{
261 struct bat_algo_ops *bat_algo_ops;
262
263 bat_algo_ops = bat_algo_get((char *)val);
264 if (!bat_algo_ops) {
265 pr_err("Routing algorithm '%s' is not supported\n", val);
266 return -EINVAL;
267 }
268
269 return param_set_copystring(val, kp);
270}
271
272static const struct kernel_param_ops param_ops_ra = {
273 .set = param_set_ra,
274 .get = param_get_string,
275};
276
277static struct kparam_string __param_string_ra = {
278 .maxlen = sizeof(bat_routing_algo),
279 .string = bat_routing_algo,
280};
281
282module_param_cb(routing_algo, &param_ops_ra, &__param_string_ra, 0644);
259module_init(batman_init); 283module_init(batman_init);
260module_exit(batman_exit); 284module_exit(batman_exit);
261 285