diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-05-11 20:09:42 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-06-20 16:15:32 -0400 |
commit | 3193e8fdfa355289892661d206d1954114a7be95 (patch) | |
tree | 4fce7c85cd572389433a128db0ed180a3928e968 /net/batman-adv/main.c | |
parent | d0f714f472967577067853acc8dabe0abc75ae8f (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.c | 57 |
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 */ |
41 | struct list_head hardif_list; | 41 | struct list_head batadv_hardif_list; |
42 | static int (*recv_packet_handler[256])(struct sk_buff *, struct hard_iface *); | 42 | static int (*recv_packet_handler[256])(struct sk_buff *, struct hard_iface *); |
43 | char bat_routing_algo[20] = "BATMAN_IV"; | 43 | char batadv_routing_algo[20] = "BATMAN_IV"; |
44 | static struct hlist_head bat_algo_list; | 44 | static struct hlist_head bat_algo_list; |
45 | 45 | ||
46 | unsigned char broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | 46 | unsigned char batadv_broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
47 | 47 | ||
48 | struct workqueue_struct *bat_event_workqueue; | 48 | struct workqueue_struct *batadv_event_workqueue; |
49 | 49 | ||
50 | static void recv_handler_init(void); | 50 | static void recv_handler_init(void); |
51 | 51 | ||
52 | static int __init batman_init(void) | 52 | static 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 | ||
92 | int mesh_init(struct net_device *soft_iface) | 92 | int 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 | ||
137 | err: | 137 | err: |
138 | mesh_free(soft_iface); | 138 | batadv_mesh_free(soft_iface); |
139 | return ret; | 139 | return ret; |
140 | } | 140 | } |
141 | 141 | ||
142 | void mesh_free(struct net_device *soft_iface) | 142 | void 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 | ||
164 | void inc_module_count(void) | 164 | void batadv_inc_module_count(void) |
165 | { | 165 | { |
166 | try_module_get(THIS_MODULE); | 166 | try_module_get(THIS_MODULE); |
167 | } | 167 | } |
168 | 168 | ||
169 | void dec_module_count(void) | 169 | void batadv_dec_module_count(void) |
170 | { | 170 | { |
171 | module_put(THIS_MODULE); | 171 | module_put(THIS_MODULE); |
172 | } | 172 | } |
173 | 173 | ||
174 | int is_my_mac(const uint8_t *addr) | 174 | int 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 | */ |
201 | int batman_skb_recv(struct sk_buff *skb, struct net_device *dev, | 201 | int 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 | ||
290 | int recv_handler_register(uint8_t packet_type, | 291 | int 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 | ||
301 | void recv_handler_unregister(uint8_t packet_type) | 302 | void 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 | ||
322 | int bat_algo_register(struct bat_algo_ops *bat_algo_ops) | 323 | int 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 | ||
356 | int bat_algo_select(struct bat_priv *bat_priv, char *name) | 357 | int 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 | ||
372 | int bat_algo_seq_print_text(struct seq_file *seq, void *offset) | 373 | int 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 | ||
409 | static struct kparam_string __param_string_ra = { | 410 | static 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 | ||
414 | module_param_cb(routing_algo, ¶m_ops_ra, &__param_string_ra, 0644); | 415 | module_param_cb(routing_algo, ¶m_ops_ra, &__param_string_ra, 0644); |