aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-12 12:33:57 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-25 02:21:40 -0400
commit18a1cb6ee08e6ea62e0f3c2643435cd444fc0790 (patch)
treef66c69bf3881b5a85117f7ba24537e0fa1fe271b /net
parent8e714a5ded231abb853941b67845d25a022daa89 (diff)
batman-adv: Prefix hard-interface 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')
-rw-r--r--net/batman-adv/hard-interface.c64
1 files changed, 33 insertions, 31 deletions
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 6131d932b638..c22c145d8224 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -57,7 +57,7 @@ out:
57 return hard_iface; 57 return hard_iface;
58} 58}
59 59
60static int is_valid_iface(const struct net_device *net_dev) 60static int batadv_is_valid_iface(const struct net_device *net_dev)
61{ 61{
62 if (net_dev->flags & IFF_LOOPBACK) 62 if (net_dev->flags & IFF_LOOPBACK)
63 return 0; 63 return 0;
@@ -75,7 +75,8 @@ static int is_valid_iface(const struct net_device *net_dev)
75 return 1; 75 return 1;
76} 76}
77 77
78static struct hard_iface *hardif_get_active(const struct net_device *soft_iface) 78static struct hard_iface *
79batadv_hardif_get_active(const struct net_device *soft_iface)
79{ 80{
80 struct hard_iface *hard_iface; 81 struct hard_iface *hard_iface;
81 82
@@ -96,8 +97,8 @@ out:
96 return hard_iface; 97 return hard_iface;
97} 98}
98 99
99static void primary_if_update_addr(struct bat_priv *bat_priv, 100static void batadv_primary_if_update_addr(struct bat_priv *bat_priv,
100 struct hard_iface *oldif) 101 struct hard_iface *oldif)
101{ 102{
102 struct vis_packet *vis_packet; 103 struct vis_packet *vis_packet;
103 struct hard_iface *primary_if; 104 struct hard_iface *primary_if;
@@ -118,8 +119,8 @@ out:
118 batadv_hardif_free_ref(primary_if); 119 batadv_hardif_free_ref(primary_if);
119} 120}
120 121
121static void primary_if_select(struct bat_priv *bat_priv, 122static void batadv_primary_if_select(struct bat_priv *bat_priv,
122 struct hard_iface *new_hard_iface) 123 struct hard_iface *new_hard_iface)
123{ 124{
124 struct hard_iface *curr_hard_iface; 125 struct hard_iface *curr_hard_iface;
125 126
@@ -135,14 +136,14 @@ static void primary_if_select(struct bat_priv *bat_priv,
135 goto out; 136 goto out;
136 137
137 bat_priv->bat_algo_ops->bat_primary_iface_set(new_hard_iface); 138 bat_priv->bat_algo_ops->bat_primary_iface_set(new_hard_iface);
138 primary_if_update_addr(bat_priv, curr_hard_iface); 139 batadv_primary_if_update_addr(bat_priv, curr_hard_iface);
139 140
140out: 141out:
141 if (curr_hard_iface) 142 if (curr_hard_iface)
142 batadv_hardif_free_ref(curr_hard_iface); 143 batadv_hardif_free_ref(curr_hard_iface);
143} 144}
144 145
145static bool hardif_is_iface_up(const struct hard_iface *hard_iface) 146static bool batadv_hardif_is_iface_up(const struct hard_iface *hard_iface)
146{ 147{
147 if (hard_iface->net_dev->flags & IFF_UP) 148 if (hard_iface->net_dev->flags & IFF_UP)
148 return true; 149 return true;
@@ -150,7 +151,7 @@ static bool hardif_is_iface_up(const struct hard_iface *hard_iface)
150 return false; 151 return false;
151} 152}
152 153
153static void check_known_mac_addr(const struct net_device *net_dev) 154static void batadv_check_known_mac_addr(const struct net_device *net_dev)
154{ 155{
155 const struct hard_iface *hard_iface; 156 const struct hard_iface *hard_iface;
156 157
@@ -213,7 +214,7 @@ void batadv_update_min_mtu(struct net_device *soft_iface)
213 soft_iface->mtu = min_mtu; 214 soft_iface->mtu = min_mtu;
214} 215}
215 216
216static void hardif_activate_interface(struct hard_iface *hard_iface) 217static void batadv_hardif_activate_interface(struct hard_iface *hard_iface)
217{ 218{
218 struct bat_priv *bat_priv; 219 struct bat_priv *bat_priv;
219 struct hard_iface *primary_if = NULL; 220 struct hard_iface *primary_if = NULL;
@@ -231,7 +232,7 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)
231 */ 232 */
232 primary_if = batadv_primary_if_get_selected(bat_priv); 233 primary_if = batadv_primary_if_get_selected(bat_priv);
233 if (!primary_if) 234 if (!primary_if)
234 primary_if_select(bat_priv, hard_iface); 235 batadv_primary_if_select(bat_priv, hard_iface);
235 236
236 bat_info(hard_iface->soft_iface, "Interface activated: %s\n", 237 bat_info(hard_iface->soft_iface, "Interface activated: %s\n",
237 hard_iface->net_dev->name); 238 hard_iface->net_dev->name);
@@ -243,7 +244,7 @@ out:
243 batadv_hardif_free_ref(primary_if); 244 batadv_hardif_free_ref(primary_if);
244} 245}
245 246
246static void hardif_deactivate_interface(struct hard_iface *hard_iface) 247static void batadv_hardif_deactivate_interface(struct hard_iface *hard_iface)
247{ 248{
248 if ((hard_iface->if_status != IF_ACTIVE) && 249 if ((hard_iface->if_status != IF_ACTIVE) &&
249 (hard_iface->if_status != IF_TO_BE_ACTIVATED)) 250 (hard_iface->if_status != IF_TO_BE_ACTIVATED))
@@ -331,8 +332,8 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
331 hard_iface->net_dev->name, hard_iface->net_dev->mtu, 332 hard_iface->net_dev->name, hard_iface->net_dev->mtu,
332 ETH_DATA_LEN + BAT_HEADER_LEN); 333 ETH_DATA_LEN + BAT_HEADER_LEN);
333 334
334 if (hardif_is_iface_up(hard_iface)) 335 if (batadv_hardif_is_iface_up(hard_iface))
335 hardif_activate_interface(hard_iface); 336 batadv_hardif_activate_interface(hard_iface);
336 else 337 else
337 bat_err(hard_iface->soft_iface, 338 bat_err(hard_iface->soft_iface,
338 "Not using interface %s (retrying later): interface not active\n", 339 "Not using interface %s (retrying later): interface not active\n",
@@ -357,7 +358,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
357 struct hard_iface *primary_if = NULL; 358 struct hard_iface *primary_if = NULL;
358 359
359 if (hard_iface->if_status == IF_ACTIVE) 360 if (hard_iface->if_status == IF_ACTIVE)
360 hardif_deactivate_interface(hard_iface); 361 batadv_hardif_deactivate_interface(hard_iface);
361 362
362 if (hard_iface->if_status != IF_INACTIVE) 363 if (hard_iface->if_status != IF_INACTIVE)
363 goto out; 364 goto out;
@@ -373,8 +374,8 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
373 if (hard_iface == primary_if) { 374 if (hard_iface == primary_if) {
374 struct hard_iface *new_if; 375 struct hard_iface *new_if;
375 376
376 new_if = hardif_get_active(hard_iface->soft_iface); 377 new_if = batadv_hardif_get_active(hard_iface->soft_iface);
377 primary_if_select(bat_priv, new_if); 378 batadv_primary_if_select(bat_priv, new_if);
378 379
379 if (new_if) 380 if (new_if)
380 batadv_hardif_free_ref(new_if); 381 batadv_hardif_free_ref(new_if);
@@ -400,14 +401,15 @@ out:
400 batadv_hardif_free_ref(primary_if); 401 batadv_hardif_free_ref(primary_if);
401} 402}
402 403
403static struct hard_iface *hardif_add_interface(struct net_device *net_dev) 404static struct hard_iface *
405batadv_hardif_add_interface(struct net_device *net_dev)
404{ 406{
405 struct hard_iface *hard_iface; 407 struct hard_iface *hard_iface;
406 int ret; 408 int ret;
407 409
408 ASSERT_RTNL(); 410 ASSERT_RTNL();
409 411
410 ret = is_valid_iface(net_dev); 412 ret = batadv_is_valid_iface(net_dev);
411 if (ret != 1) 413 if (ret != 1)
412 goto out; 414 goto out;
413 415
@@ -429,7 +431,7 @@ static struct hard_iface *hardif_add_interface(struct net_device *net_dev)
429 /* extra reference for return */ 431 /* extra reference for return */
430 atomic_set(&hard_iface->refcount, 2); 432 atomic_set(&hard_iface->refcount, 2);
431 433
432 check_known_mac_addr(hard_iface->net_dev); 434 batadv_check_known_mac_addr(hard_iface->net_dev);
433 list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list); 435 list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list);
434 436
435 /* This can't be called via a bat_priv callback because 437 /* This can't be called via a bat_priv callback because
@@ -448,7 +450,7 @@ out:
448 return NULL; 450 return NULL;
449} 451}
450 452
451static void hardif_remove_interface(struct hard_iface *hard_iface) 453static void batadv_hardif_remove_interface(struct hard_iface *hard_iface)
452{ 454{
453 ASSERT_RTNL(); 455 ASSERT_RTNL();
454 456
@@ -472,13 +474,13 @@ void batadv_hardif_remove_interfaces(void)
472 list_for_each_entry_safe(hard_iface, hard_iface_tmp, 474 list_for_each_entry_safe(hard_iface, hard_iface_tmp,
473 &batadv_hardif_list, list) { 475 &batadv_hardif_list, list) {
474 list_del_rcu(&hard_iface->list); 476 list_del_rcu(&hard_iface->list);
475 hardif_remove_interface(hard_iface); 477 batadv_hardif_remove_interface(hard_iface);
476 } 478 }
477 rtnl_unlock(); 479 rtnl_unlock();
478} 480}
479 481
480static int hard_if_event(struct notifier_block *this, 482static int batadv_hard_if_event(struct notifier_block *this,
481 unsigned long event, void *ptr) 483 unsigned long event, void *ptr)
482{ 484{
483 struct net_device *net_dev = ptr; 485 struct net_device *net_dev = ptr;
484 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev); 486 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev);
@@ -486,23 +488,23 @@ static int hard_if_event(struct notifier_block *this,
486 struct bat_priv *bat_priv; 488 struct bat_priv *bat_priv;
487 489
488 if (!hard_iface && event == NETDEV_REGISTER) 490 if (!hard_iface && event == NETDEV_REGISTER)
489 hard_iface = hardif_add_interface(net_dev); 491 hard_iface = batadv_hardif_add_interface(net_dev);
490 492
491 if (!hard_iface) 493 if (!hard_iface)
492 goto out; 494 goto out;
493 495
494 switch (event) { 496 switch (event) {
495 case NETDEV_UP: 497 case NETDEV_UP:
496 hardif_activate_interface(hard_iface); 498 batadv_hardif_activate_interface(hard_iface);
497 break; 499 break;
498 case NETDEV_GOING_DOWN: 500 case NETDEV_GOING_DOWN:
499 case NETDEV_DOWN: 501 case NETDEV_DOWN:
500 hardif_deactivate_interface(hard_iface); 502 batadv_hardif_deactivate_interface(hard_iface);
501 break; 503 break;
502 case NETDEV_UNREGISTER: 504 case NETDEV_UNREGISTER:
503 list_del_rcu(&hard_iface->list); 505 list_del_rcu(&hard_iface->list);
504 506
505 hardif_remove_interface(hard_iface); 507 batadv_hardif_remove_interface(hard_iface);
506 break; 508 break;
507 case NETDEV_CHANGEMTU: 509 case NETDEV_CHANGEMTU:
508 if (hard_iface->soft_iface) 510 if (hard_iface->soft_iface)
@@ -512,7 +514,7 @@ static int hard_if_event(struct notifier_block *this,
512 if (hard_iface->if_status == IF_NOT_IN_USE) 514 if (hard_iface->if_status == IF_NOT_IN_USE)
513 goto hardif_put; 515 goto hardif_put;
514 516
515 check_known_mac_addr(hard_iface->net_dev); 517 batadv_check_known_mac_addr(hard_iface->net_dev);
516 518
517 bat_priv = netdev_priv(hard_iface->soft_iface); 519 bat_priv = netdev_priv(hard_iface->soft_iface);
518 bat_priv->bat_algo_ops->bat_iface_update_mac(hard_iface); 520 bat_priv->bat_algo_ops->bat_iface_update_mac(hard_iface);
@@ -522,7 +524,7 @@ static int hard_if_event(struct notifier_block *this,
522 goto hardif_put; 524 goto hardif_put;
523 525
524 if (hard_iface == primary_if) 526 if (hard_iface == primary_if)
525 primary_if_update_addr(bat_priv, NULL); 527 batadv_primary_if_update_addr(bat_priv, NULL);
526 break; 528 break;
527 default: 529 default:
528 break; 530 break;
@@ -569,5 +571,5 @@ out:
569} 571}
570 572
571struct notifier_block batadv_hard_if_notifier = { 573struct notifier_block batadv_hard_if_notifier = {
572 .notifier_call = hard_if_event, 574 .notifier_call = batadv_hard_if_event,
573}; 575};