diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-05-12 12:33:55 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-06-25 02:21:38 -0400 |
commit | 1409a8349f978abec556748bcac00541a46a56b5 (patch) | |
tree | db40dfdc276402eb43469dd9f0685af70170b429 /net/batman-adv/gateway_client.c | |
parent | 3b300de322014f529b2e0a72a92c414686b85671 (diff) |
batman-adv: Prefix gateway_client local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/gateway_client.c')
-rw-r--r-- | net/batman-adv/gateway_client.c | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index 318c112aa98c..efe7519f1491 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -36,13 +36,13 @@ | |||
36 | #define DHCP_OPTIONS_OFFSET 240 | 36 | #define DHCP_OPTIONS_OFFSET 240 |
37 | #define DHCP_REQUEST 3 | 37 | #define DHCP_REQUEST 3 |
38 | 38 | ||
39 | static void gw_node_free_ref(struct gw_node *gw_node) | 39 | static void batadv_gw_node_free_ref(struct gw_node *gw_node) |
40 | { | 40 | { |
41 | if (atomic_dec_and_test(&gw_node->refcount)) | 41 | if (atomic_dec_and_test(&gw_node->refcount)) |
42 | kfree_rcu(gw_node, rcu); | 42 | kfree_rcu(gw_node, rcu); |
43 | } | 43 | } |
44 | 44 | ||
45 | static struct gw_node *gw_get_selected_gw_node(struct bat_priv *bat_priv) | 45 | static struct gw_node *batadv_gw_get_selected_gw_node(struct bat_priv *bat_priv) |
46 | { | 46 | { |
47 | struct gw_node *gw_node; | 47 | struct gw_node *gw_node; |
48 | 48 | ||
@@ -64,7 +64,7 @@ struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv) | |||
64 | struct gw_node *gw_node; | 64 | struct gw_node *gw_node; |
65 | struct orig_node *orig_node = NULL; | 65 | struct orig_node *orig_node = NULL; |
66 | 66 | ||
67 | gw_node = gw_get_selected_gw_node(bat_priv); | 67 | gw_node = batadv_gw_get_selected_gw_node(bat_priv); |
68 | if (!gw_node) | 68 | if (!gw_node) |
69 | goto out; | 69 | goto out; |
70 | 70 | ||
@@ -80,11 +80,12 @@ unlock: | |||
80 | rcu_read_unlock(); | 80 | rcu_read_unlock(); |
81 | out: | 81 | out: |
82 | if (gw_node) | 82 | if (gw_node) |
83 | gw_node_free_ref(gw_node); | 83 | batadv_gw_node_free_ref(gw_node); |
84 | return orig_node; | 84 | return orig_node; |
85 | } | 85 | } |
86 | 86 | ||
87 | static void gw_select(struct bat_priv *bat_priv, struct gw_node *new_gw_node) | 87 | static void batadv_gw_select(struct bat_priv *bat_priv, |
88 | struct gw_node *new_gw_node) | ||
88 | { | 89 | { |
89 | struct gw_node *curr_gw_node; | 90 | struct gw_node *curr_gw_node; |
90 | 91 | ||
@@ -97,7 +98,7 @@ static void gw_select(struct bat_priv *bat_priv, struct gw_node *new_gw_node) | |||
97 | rcu_assign_pointer(bat_priv->curr_gw, new_gw_node); | 98 | rcu_assign_pointer(bat_priv->curr_gw, new_gw_node); |
98 | 99 | ||
99 | if (curr_gw_node) | 100 | if (curr_gw_node) |
100 | gw_node_free_ref(curr_gw_node); | 101 | batadv_gw_node_free_ref(curr_gw_node); |
101 | 102 | ||
102 | spin_unlock_bh(&bat_priv->gw_list_lock); | 103 | spin_unlock_bh(&bat_priv->gw_list_lock); |
103 | } | 104 | } |
@@ -107,7 +108,7 @@ void batadv_gw_deselect(struct bat_priv *bat_priv) | |||
107 | atomic_set(&bat_priv->gw_reselect, 1); | 108 | atomic_set(&bat_priv->gw_reselect, 1); |
108 | } | 109 | } |
109 | 110 | ||
110 | static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv) | 111 | static struct gw_node *batadv_gw_get_best_gw_node(struct bat_priv *bat_priv) |
111 | { | 112 | { |
112 | struct neigh_node *router; | 113 | struct neigh_node *router; |
113 | struct hlist_node *node; | 114 | struct hlist_node *node; |
@@ -144,7 +145,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv) | |||
144 | ((tmp_gw_factor == max_gw_factor) && | 145 | ((tmp_gw_factor == max_gw_factor) && |
145 | (router->tq_avg > max_tq))) { | 146 | (router->tq_avg > max_tq))) { |
146 | if (curr_gw) | 147 | if (curr_gw) |
147 | gw_node_free_ref(curr_gw); | 148 | batadv_gw_node_free_ref(curr_gw); |
148 | curr_gw = gw_node; | 149 | curr_gw = gw_node; |
149 | atomic_inc(&curr_gw->refcount); | 150 | atomic_inc(&curr_gw->refcount); |
150 | } | 151 | } |
@@ -159,7 +160,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv) | |||
159 | */ | 160 | */ |
160 | if (router->tq_avg > max_tq) { | 161 | if (router->tq_avg > max_tq) { |
161 | if (curr_gw) | 162 | if (curr_gw) |
162 | gw_node_free_ref(curr_gw); | 163 | batadv_gw_node_free_ref(curr_gw); |
163 | curr_gw = gw_node; | 164 | curr_gw = gw_node; |
164 | atomic_inc(&curr_gw->refcount); | 165 | atomic_inc(&curr_gw->refcount); |
165 | } | 166 | } |
@@ -172,7 +173,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv) | |||
172 | if (tmp_gw_factor > max_gw_factor) | 173 | if (tmp_gw_factor > max_gw_factor) |
173 | max_gw_factor = tmp_gw_factor; | 174 | max_gw_factor = tmp_gw_factor; |
174 | 175 | ||
175 | gw_node_free_ref(gw_node); | 176 | batadv_gw_node_free_ref(gw_node); |
176 | 177 | ||
177 | next: | 178 | next: |
178 | batadv_neigh_node_free_ref(router); | 179 | batadv_neigh_node_free_ref(router); |
@@ -199,9 +200,9 @@ void batadv_gw_election(struct bat_priv *bat_priv) | |||
199 | if (!atomic_dec_not_zero(&bat_priv->gw_reselect)) | 200 | if (!atomic_dec_not_zero(&bat_priv->gw_reselect)) |
200 | goto out; | 201 | goto out; |
201 | 202 | ||
202 | curr_gw = gw_get_selected_gw_node(bat_priv); | 203 | curr_gw = batadv_gw_get_selected_gw_node(bat_priv); |
203 | 204 | ||
204 | next_gw = gw_get_best_gw_node(bat_priv); | 205 | next_gw = batadv_gw_get_best_gw_node(bat_priv); |
205 | 206 | ||
206 | if (curr_gw == next_gw) | 207 | if (curr_gw == next_gw) |
207 | goto out; | 208 | goto out; |
@@ -234,13 +235,13 @@ void batadv_gw_election(struct bat_priv *bat_priv) | |||
234 | batadv_throw_uevent(bat_priv, UEV_GW, UEV_CHANGE, gw_addr); | 235 | batadv_throw_uevent(bat_priv, UEV_GW, UEV_CHANGE, gw_addr); |
235 | } | 236 | } |
236 | 237 | ||
237 | gw_select(bat_priv, next_gw); | 238 | batadv_gw_select(bat_priv, next_gw); |
238 | 239 | ||
239 | out: | 240 | out: |
240 | if (curr_gw) | 241 | if (curr_gw) |
241 | gw_node_free_ref(curr_gw); | 242 | batadv_gw_node_free_ref(curr_gw); |
242 | if (next_gw) | 243 | if (next_gw) |
243 | gw_node_free_ref(next_gw); | 244 | batadv_gw_node_free_ref(next_gw); |
244 | if (router) | 245 | if (router) |
245 | batadv_neigh_node_free_ref(router); | 246 | batadv_neigh_node_free_ref(router); |
246 | } | 247 | } |
@@ -299,8 +300,9 @@ out: | |||
299 | return; | 300 | return; |
300 | } | 301 | } |
301 | 302 | ||
302 | static void gw_node_add(struct bat_priv *bat_priv, | 303 | static void batadv_gw_node_add(struct bat_priv *bat_priv, |
303 | struct orig_node *orig_node, uint8_t new_gwflags) | 304 | struct orig_node *orig_node, |
305 | uint8_t new_gwflags) | ||
304 | { | 306 | { |
305 | struct gw_node *gw_node; | 307 | struct gw_node *gw_node; |
306 | int down, up; | 308 | int down, up; |
@@ -338,7 +340,7 @@ void batadv_gw_node_update(struct bat_priv *bat_priv, | |||
338 | * have this gateway in our list (duplication check!) even though we | 340 | * have this gateway in our list (duplication check!) even though we |
339 | * have no currently selected gateway. | 341 | * have no currently selected gateway. |
340 | */ | 342 | */ |
341 | curr_gw = gw_get_selected_gw_node(bat_priv); | 343 | curr_gw = batadv_gw_get_selected_gw_node(bat_priv); |
342 | 344 | ||
343 | rcu_read_lock(); | 345 | rcu_read_lock(); |
344 | hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) { | 346 | hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) { |
@@ -368,7 +370,7 @@ void batadv_gw_node_update(struct bat_priv *bat_priv, | |||
368 | if (new_gwflags == NO_FLAGS) | 370 | if (new_gwflags == NO_FLAGS) |
369 | goto unlock; | 371 | goto unlock; |
370 | 372 | ||
371 | gw_node_add(bat_priv, orig_node, new_gwflags); | 373 | batadv_gw_node_add(bat_priv, orig_node, new_gwflags); |
372 | goto unlock; | 374 | goto unlock; |
373 | 375 | ||
374 | deselect: | 376 | deselect: |
@@ -377,7 +379,7 @@ unlock: | |||
377 | rcu_read_unlock(); | 379 | rcu_read_unlock(); |
378 | 380 | ||
379 | if (curr_gw) | 381 | if (curr_gw) |
380 | gw_node_free_ref(curr_gw); | 382 | batadv_gw_node_free_ref(curr_gw); |
381 | } | 383 | } |
382 | 384 | ||
383 | void batadv_gw_node_delete(struct bat_priv *bat_priv, | 385 | void batadv_gw_node_delete(struct bat_priv *bat_priv, |
@@ -393,7 +395,7 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv) | |||
393 | unsigned long timeout = msecs_to_jiffies(2 * PURGE_TIMEOUT); | 395 | unsigned long timeout = msecs_to_jiffies(2 * PURGE_TIMEOUT); |
394 | int do_deselect = 0; | 396 | int do_deselect = 0; |
395 | 397 | ||
396 | curr_gw = gw_get_selected_gw_node(bat_priv); | 398 | curr_gw = batadv_gw_get_selected_gw_node(bat_priv); |
397 | 399 | ||
398 | spin_lock_bh(&bat_priv->gw_list_lock); | 400 | spin_lock_bh(&bat_priv->gw_list_lock); |
399 | 401 | ||
@@ -408,7 +410,7 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv) | |||
408 | do_deselect = 1; | 410 | do_deselect = 1; |
409 | 411 | ||
410 | hlist_del_rcu(&gw_node->list); | 412 | hlist_del_rcu(&gw_node->list); |
411 | gw_node_free_ref(gw_node); | 413 | batadv_gw_node_free_ref(gw_node); |
412 | } | 414 | } |
413 | 415 | ||
414 | spin_unlock_bh(&bat_priv->gw_list_lock); | 416 | spin_unlock_bh(&bat_priv->gw_list_lock); |
@@ -418,12 +420,13 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv) | |||
418 | batadv_gw_deselect(bat_priv); | 420 | batadv_gw_deselect(bat_priv); |
419 | 421 | ||
420 | if (curr_gw) | 422 | if (curr_gw) |
421 | gw_node_free_ref(curr_gw); | 423 | batadv_gw_node_free_ref(curr_gw); |
422 | } | 424 | } |
423 | 425 | ||
424 | /* fails if orig_node has no router */ | 426 | /* fails if orig_node has no router */ |
425 | static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq, | 427 | static int batadv_write_buffer_text(struct bat_priv *bat_priv, |
426 | const struct gw_node *gw_node) | 428 | struct seq_file *seq, |
429 | const struct gw_node *gw_node) | ||
427 | { | 430 | { |
428 | struct gw_node *curr_gw; | 431 | struct gw_node *curr_gw; |
429 | struct neigh_node *router; | 432 | struct neigh_node *router; |
@@ -435,7 +438,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq, | |||
435 | if (!router) | 438 | if (!router) |
436 | goto out; | 439 | goto out; |
437 | 440 | ||
438 | curr_gw = gw_get_selected_gw_node(bat_priv); | 441 | curr_gw = batadv_gw_get_selected_gw_node(bat_priv); |
439 | 442 | ||
440 | ret = seq_printf(seq, "%s %pM (%3i) %pM [%10s]: %3i - %i%s/%i%s\n", | 443 | ret = seq_printf(seq, "%s %pM (%3i) %pM [%10s]: %3i - %i%s/%i%s\n", |
441 | (curr_gw == gw_node ? "=>" : " "), | 444 | (curr_gw == gw_node ? "=>" : " "), |
@@ -450,7 +453,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq, | |||
450 | 453 | ||
451 | batadv_neigh_node_free_ref(router); | 454 | batadv_neigh_node_free_ref(router); |
452 | if (curr_gw) | 455 | if (curr_gw) |
453 | gw_node_free_ref(curr_gw); | 456 | batadv_gw_node_free_ref(curr_gw); |
454 | out: | 457 | out: |
455 | return ret; | 458 | return ret; |
456 | } | 459 | } |
@@ -491,7 +494,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) | |||
491 | continue; | 494 | continue; |
492 | 495 | ||
493 | /* fails if orig_node has no router */ | 496 | /* fails if orig_node has no router */ |
494 | if (_write_buffer_text(bat_priv, seq, gw_node) < 0) | 497 | if (batadv_write_buffer_text(bat_priv, seq, gw_node) < 0) |
495 | continue; | 498 | continue; |
496 | 499 | ||
497 | gw_count++; | 500 | gw_count++; |
@@ -507,7 +510,7 @@ out: | |||
507 | return ret; | 510 | return ret; |
508 | } | 511 | } |
509 | 512 | ||
510 | static bool is_type_dhcprequest(struct sk_buff *skb, int header_len) | 513 | static bool batadv_is_type_dhcprequest(struct sk_buff *skb, int header_len) |
511 | { | 514 | { |
512 | int ret = false; | 515 | int ret = false; |
513 | unsigned char *p; | 516 | unsigned char *p; |
@@ -655,7 +658,7 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv, | |||
655 | if (!orig_dst_node->gw_flags) | 658 | if (!orig_dst_node->gw_flags) |
656 | goto out; | 659 | goto out; |
657 | 660 | ||
658 | ret = is_type_dhcprequest(skb, header_len); | 661 | ret = batadv_is_type_dhcprequest(skb, header_len); |
659 | if (!ret) | 662 | if (!ret) |
660 | goto out; | 663 | goto out; |
661 | 664 | ||
@@ -667,7 +670,7 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv, | |||
667 | curr_tq_avg = TQ_MAX_VALUE; | 670 | curr_tq_avg = TQ_MAX_VALUE; |
668 | break; | 671 | break; |
669 | case GW_MODE_CLIENT: | 672 | case GW_MODE_CLIENT: |
670 | curr_gw = gw_get_selected_gw_node(bat_priv); | 673 | curr_gw = batadv_gw_get_selected_gw_node(bat_priv); |
671 | if (!curr_gw) | 674 | if (!curr_gw) |
672 | goto out; | 675 | goto out; |
673 | 676 | ||
@@ -702,7 +705,7 @@ out: | |||
702 | if (orig_dst_node) | 705 | if (orig_dst_node) |
703 | batadv_orig_node_free_ref(orig_dst_node); | 706 | batadv_orig_node_free_ref(orig_dst_node); |
704 | if (curr_gw) | 707 | if (curr_gw) |
705 | gw_node_free_ref(curr_gw); | 708 | batadv_gw_node_free_ref(curr_gw); |
706 | if (neigh_old) | 709 | if (neigh_old) |
707 | batadv_neigh_node_free_ref(neigh_old); | 710 | batadv_neigh_node_free_ref(neigh_old); |
708 | if (neigh_curr) | 711 | if (neigh_curr) |