aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/main.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-11 20:09:42 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-20 16:15:32 -0400
commit3193e8fdfa355289892661d206d1954114a7be95 (patch)
tree4fce7c85cd572389433a128db0ed180a3928e968 /net/batman-adv/main.c
parentd0f714f472967577067853acc8dabe0abc75ae8f (diff)
batman-adv: Prefix main non-static functions with batadv_
batman-adv can be compiled as part of the kernel instead of an module. In that case the linker will see all non-static symbols of batman-adv and all other non-static symbols of the kernel. This could lead to symbol collisions. A prefix for the batman-adv symbols that defines their private namespace avoids such a problem. Reported-by: David Miller <davem@davemloft.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/main.c')
-rw-r--r--net/batman-adv/main.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index ffea3609ea41..5e1d906628f5 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -38,20 +38,20 @@
38 38
39/* List manipulations on hardif_list have to be rtnl_lock()'ed, 39/* List manipulations on hardif_list have to be rtnl_lock()'ed,
40 * list traversals just rcu-locked */ 40 * list traversals just rcu-locked */
41struct list_head hardif_list; 41struct list_head batadv_hardif_list;
42static int (*recv_packet_handler[256])(struct sk_buff *, struct hard_iface *); 42static int (*recv_packet_handler[256])(struct sk_buff *, struct hard_iface *);
43char bat_routing_algo[20] = "BATMAN_IV"; 43char batadv_routing_algo[20] = "BATMAN_IV";
44static struct hlist_head bat_algo_list; 44static struct hlist_head bat_algo_list;
45 45
46unsigned char broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 46unsigned char batadv_broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
47 47
48struct workqueue_struct *bat_event_workqueue; 48struct workqueue_struct *batadv_event_workqueue;
49 49
50static void recv_handler_init(void); 50static void recv_handler_init(void);
51 51
52static int __init batman_init(void) 52static int __init batman_init(void)
53{ 53{
54 INIT_LIST_HEAD(&hardif_list); 54 INIT_LIST_HEAD(&batadv_hardif_list);
55 INIT_HLIST_HEAD(&bat_algo_list); 55 INIT_HLIST_HEAD(&bat_algo_list);
56 56
57 recv_handler_init(); 57 recv_handler_init();
@@ -60,9 +60,9 @@ static int __init batman_init(void)
60 60
61 /* the name should not be longer than 10 chars - see 61 /* the name should not be longer than 10 chars - see
62 * http://lwn.net/Articles/23634/ */ 62 * http://lwn.net/Articles/23634/ */
63 bat_event_workqueue = create_singlethread_workqueue("bat_events"); 63 batadv_event_workqueue = create_singlethread_workqueue("bat_events");
64 64
65 if (!bat_event_workqueue) 65 if (!batadv_event_workqueue)
66 return -ENOMEM; 66 return -ENOMEM;
67 67
68 batadv_socket_init(); 68 batadv_socket_init();
@@ -82,14 +82,14 @@ static void __exit batman_exit(void)
82 unregister_netdevice_notifier(&batadv_hard_if_notifier); 82 unregister_netdevice_notifier(&batadv_hard_if_notifier);
83 batadv_hardif_remove_interfaces(); 83 batadv_hardif_remove_interfaces();
84 84
85 flush_workqueue(bat_event_workqueue); 85 flush_workqueue(batadv_event_workqueue);
86 destroy_workqueue(bat_event_workqueue); 86 destroy_workqueue(batadv_event_workqueue);
87 bat_event_workqueue = NULL; 87 batadv_event_workqueue = NULL;
88 88
89 rcu_barrier(); 89 rcu_barrier();
90} 90}
91 91
92int mesh_init(struct net_device *soft_iface) 92int batadv_mesh_init(struct net_device *soft_iface)
93{ 93{
94 struct bat_priv *bat_priv = netdev_priv(soft_iface); 94 struct bat_priv *bat_priv = netdev_priv(soft_iface);
95 int ret; 95 int ret;
@@ -135,11 +135,11 @@ int mesh_init(struct net_device *soft_iface)
135 return 0; 135 return 0;
136 136
137err: 137err:
138 mesh_free(soft_iface); 138 batadv_mesh_free(soft_iface);
139 return ret; 139 return ret;
140} 140}
141 141
142void mesh_free(struct net_device *soft_iface) 142void batadv_mesh_free(struct net_device *soft_iface)
143{ 143{
144 struct bat_priv *bat_priv = netdev_priv(soft_iface); 144 struct bat_priv *bat_priv = netdev_priv(soft_iface);
145 145
@@ -161,22 +161,22 @@ void mesh_free(struct net_device *soft_iface)
161 atomic_set(&bat_priv->mesh_state, MESH_INACTIVE); 161 atomic_set(&bat_priv->mesh_state, MESH_INACTIVE);
162} 162}
163 163
164void inc_module_count(void) 164void batadv_inc_module_count(void)
165{ 165{
166 try_module_get(THIS_MODULE); 166 try_module_get(THIS_MODULE);
167} 167}
168 168
169void dec_module_count(void) 169void batadv_dec_module_count(void)
170{ 170{
171 module_put(THIS_MODULE); 171 module_put(THIS_MODULE);
172} 172}
173 173
174int is_my_mac(const uint8_t *addr) 174int batadv_is_my_mac(const uint8_t *addr)
175{ 175{
176 const struct hard_iface *hard_iface; 176 const struct hard_iface *hard_iface;
177 177
178 rcu_read_lock(); 178 rcu_read_lock();
179 list_for_each_entry_rcu(hard_iface, &hardif_list, list) { 179 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
180 if (hard_iface->if_status != IF_ACTIVE) 180 if (hard_iface->if_status != IF_ACTIVE)
181 continue; 181 continue;
182 182
@@ -198,8 +198,9 @@ static int recv_unhandled_packet(struct sk_buff *skb,
198/* incoming packets with the batman ethertype received on any active hard 198/* incoming packets with the batman ethertype received on any active hard
199 * interface 199 * interface
200 */ 200 */
201int batman_skb_recv(struct sk_buff *skb, struct net_device *dev, 201int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
202 struct packet_type *ptype, struct net_device *orig_dev) 202 struct packet_type *ptype,
203 struct net_device *orig_dev)
203{ 204{
204 struct bat_priv *bat_priv; 205 struct bat_priv *bat_priv;
205 struct batman_ogm_packet *batman_ogm_packet; 206 struct batman_ogm_packet *batman_ogm_packet;
@@ -287,9 +288,9 @@ static void recv_handler_init(void)
287 recv_packet_handler[BAT_ROAM_ADV] = batadv_recv_roam_adv; 288 recv_packet_handler[BAT_ROAM_ADV] = batadv_recv_roam_adv;
288} 289}
289 290
290int recv_handler_register(uint8_t packet_type, 291int batadv_recv_handler_register(uint8_t packet_type,
291 int (*recv_handler)(struct sk_buff *, 292 int (*recv_handler)(struct sk_buff *,
292 struct hard_iface *)) 293 struct hard_iface *))
293{ 294{
294 if (recv_packet_handler[packet_type] != &recv_unhandled_packet) 295 if (recv_packet_handler[packet_type] != &recv_unhandled_packet)
295 return -EBUSY; 296 return -EBUSY;
@@ -298,7 +299,7 @@ int recv_handler_register(uint8_t packet_type,
298 return 0; 299 return 0;
299} 300}
300 301
301void recv_handler_unregister(uint8_t packet_type) 302void batadv_recv_handler_unregister(uint8_t packet_type)
302{ 303{
303 recv_packet_handler[packet_type] = recv_unhandled_packet; 304 recv_packet_handler[packet_type] = recv_unhandled_packet;
304} 305}
@@ -319,7 +320,7 @@ static struct bat_algo_ops *bat_algo_get(char *name)
319 return bat_algo_ops; 320 return bat_algo_ops;
320} 321}
321 322
322int bat_algo_register(struct bat_algo_ops *bat_algo_ops) 323int batadv_algo_register(struct bat_algo_ops *bat_algo_ops)
323{ 324{
324 struct bat_algo_ops *bat_algo_ops_tmp; 325 struct bat_algo_ops *bat_algo_ops_tmp;
325 int ret; 326 int ret;
@@ -353,7 +354,7 @@ out:
353 return ret; 354 return ret;
354} 355}
355 356
356int bat_algo_select(struct bat_priv *bat_priv, char *name) 357int batadv_algo_select(struct bat_priv *bat_priv, char *name)
357{ 358{
358 struct bat_algo_ops *bat_algo_ops; 359 struct bat_algo_ops *bat_algo_ops;
359 int ret = -EINVAL; 360 int ret = -EINVAL;
@@ -369,7 +370,7 @@ out:
369 return ret; 370 return ret;
370} 371}
371 372
372int bat_algo_seq_print_text(struct seq_file *seq, void *offset) 373int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
373{ 374{
374 struct bat_algo_ops *bat_algo_ops; 375 struct bat_algo_ops *bat_algo_ops;
375 struct hlist_node *node; 376 struct hlist_node *node;
@@ -407,8 +408,8 @@ static const struct kernel_param_ops param_ops_ra = {
407}; 408};
408 409
409static struct kparam_string __param_string_ra = { 410static struct kparam_string __param_string_ra = {
410 .maxlen = sizeof(bat_routing_algo), 411 .maxlen = sizeof(batadv_routing_algo),
411 .string = bat_routing_algo, 412 .string = batadv_routing_algo,
412}; 413};
413 414
414module_param_cb(routing_algo, &param_ops_ra, &__param_string_ra, 0644); 415module_param_cb(routing_algo, &param_ops_ra, &__param_string_ra, 0644);