aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-11 20:09:32 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-20 16:15:21 -0400
commit1a8eaf0733ca754533a03d6cfa4463def2b81ce3 (patch)
treebe806212d9109703e0d5d56708ff2efdf65c3d46 /net/batman-adv
parent9563877ea52ea18bb4f1ed724c5e3a39bbbcf60b (diff)
batman-adv: Prefix hash 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')
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c8
-rw-r--r--net/batman-adv/hash.c4
-rw-r--r--net/batman-adv/hash.h6
-rw-r--r--net/batman-adv/originator.c4
-rw-r--r--net/batman-adv/translation-table.c8
-rw-r--r--net/batman-adv/vis.c2
6 files changed, 16 insertions, 16 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index b0561e338ae5..eb2178951c39 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1166,8 +1166,8 @@ int batadv_bla_init(struct bat_priv *bat_priv)
1166 if (bat_priv->claim_hash) 1166 if (bat_priv->claim_hash)
1167 return 0; 1167 return 0;
1168 1168
1169 bat_priv->claim_hash = hash_new(128); 1169 bat_priv->claim_hash = batadv_hash_new(128);
1170 bat_priv->backbone_hash = hash_new(32); 1170 bat_priv->backbone_hash = batadv_hash_new(32);
1171 1171
1172 if (!bat_priv->claim_hash || !bat_priv->backbone_hash) 1172 if (!bat_priv->claim_hash || !bat_priv->backbone_hash)
1173 return -ENOMEM; 1173 return -ENOMEM;
@@ -1348,12 +1348,12 @@ void batadv_bla_free(struct bat_priv *bat_priv)
1348 1348
1349 if (bat_priv->claim_hash) { 1349 if (bat_priv->claim_hash) {
1350 bla_purge_claims(bat_priv, primary_if, 1); 1350 bla_purge_claims(bat_priv, primary_if, 1);
1351 hash_destroy(bat_priv->claim_hash); 1351 batadv_hash_destroy(bat_priv->claim_hash);
1352 bat_priv->claim_hash = NULL; 1352 bat_priv->claim_hash = NULL;
1353 } 1353 }
1354 if (bat_priv->backbone_hash) { 1354 if (bat_priv->backbone_hash) {
1355 bla_purge_backbone_gw(bat_priv, 1); 1355 bla_purge_backbone_gw(bat_priv, 1);
1356 hash_destroy(bat_priv->backbone_hash); 1356 batadv_hash_destroy(bat_priv->backbone_hash);
1357 bat_priv->backbone_hash = NULL; 1357 bat_priv->backbone_hash = NULL;
1358 } 1358 }
1359 if (primary_if) 1359 if (primary_if)
diff --git a/net/batman-adv/hash.c b/net/batman-adv/hash.c
index 5b2eabe7c4e0..65bbd15dd37c 100644
--- a/net/batman-adv/hash.c
+++ b/net/batman-adv/hash.c
@@ -34,7 +34,7 @@ static void hash_init(struct hashtable_t *hash)
34} 34}
35 35
36/* free only the hashtable and the hash itself. */ 36/* free only the hashtable and the hash itself. */
37void hash_destroy(struct hashtable_t *hash) 37void batadv_hash_destroy(struct hashtable_t *hash)
38{ 38{
39 kfree(hash->list_locks); 39 kfree(hash->list_locks);
40 kfree(hash->table); 40 kfree(hash->table);
@@ -42,7 +42,7 @@ void hash_destroy(struct hashtable_t *hash)
42} 42}
43 43
44/* allocates and clears the hash */ 44/* allocates and clears the hash */
45struct hashtable_t *hash_new(uint32_t size) 45struct hashtable_t *batadv_hash_new(uint32_t size)
46{ 46{
47 struct hashtable_t *hash; 47 struct hashtable_t *hash;
48 48
diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h
index 3d67ce49fc31..e75df6be4f22 100644
--- a/net/batman-adv/hash.h
+++ b/net/batman-adv/hash.h
@@ -43,14 +43,14 @@ struct hashtable_t {
43}; 43};
44 44
45/* allocates and clears the hash */ 45/* allocates and clears the hash */
46struct hashtable_t *hash_new(uint32_t size); 46struct hashtable_t *batadv_hash_new(uint32_t size);
47 47
48/* set class key for all locks */ 48/* set class key for all locks */
49void batadv_hash_set_lock_class(struct hashtable_t *hash, 49void batadv_hash_set_lock_class(struct hashtable_t *hash,
50 struct lock_class_key *key); 50 struct lock_class_key *key);
51 51
52/* free only the hashtable and the hash itself. */ 52/* free only the hashtable and the hash itself. */
53void hash_destroy(struct hashtable_t *hash); 53void batadv_hash_destroy(struct hashtable_t *hash);
54 54
55/* remove the hash structure. if hashdata_free_cb != NULL, this function will be 55/* remove the hash structure. if hashdata_free_cb != NULL, this function will be
56 * called to remove the elements inside of the hash. if you don't remove the 56 * called to remove the elements inside of the hash. if you don't remove the
@@ -77,7 +77,7 @@ static inline void hash_delete(struct hashtable_t *hash,
77 spin_unlock_bh(list_lock); 77 spin_unlock_bh(list_lock);
78 } 78 }
79 79
80 hash_destroy(hash); 80 batadv_hash_destroy(hash);
81} 81}
82 82
83/** 83/**
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 2f921bff84a9..410a197854ed 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -52,7 +52,7 @@ int originator_init(struct bat_priv *bat_priv)
52 if (bat_priv->orig_hash) 52 if (bat_priv->orig_hash)
53 return 0; 53 return 0;
54 54
55 bat_priv->orig_hash = hash_new(1024); 55 bat_priv->orig_hash = batadv_hash_new(1024);
56 56
57 if (!bat_priv->orig_hash) 57 if (!bat_priv->orig_hash)
58 goto err; 58 goto err;
@@ -184,7 +184,7 @@ void originator_free(struct bat_priv *bat_priv)
184 spin_unlock_bh(list_lock); 184 spin_unlock_bh(list_lock);
185 } 185 }
186 186
187 hash_destroy(hash); 187 batadv_hash_destroy(hash);
188} 188}
189 189
190/* this function finds or creates an originator entry for the given 190/* this function finds or creates an originator entry for the given
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 7324b89bf731..a7cbc915afef 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -183,7 +183,7 @@ static int tt_local_init(struct bat_priv *bat_priv)
183 if (bat_priv->tt_local_hash) 183 if (bat_priv->tt_local_hash)
184 return 0; 184 return 0;
185 185
186 bat_priv->tt_local_hash = hash_new(1024); 186 bat_priv->tt_local_hash = batadv_hash_new(1024);
187 187
188 if (!bat_priv->tt_local_hash) 188 if (!bat_priv->tt_local_hash)
189 return -ENOMEM; 189 return -ENOMEM;
@@ -531,7 +531,7 @@ static void tt_local_table_free(struct bat_priv *bat_priv)
531 spin_unlock_bh(list_lock); 531 spin_unlock_bh(list_lock);
532 } 532 }
533 533
534 hash_destroy(hash); 534 batadv_hash_destroy(hash);
535 535
536 bat_priv->tt_local_hash = NULL; 536 bat_priv->tt_local_hash = NULL;
537} 537}
@@ -541,7 +541,7 @@ static int tt_global_init(struct bat_priv *bat_priv)
541 if (bat_priv->tt_global_hash) 541 if (bat_priv->tt_global_hash)
542 return 0; 542 return 0;
543 543
544 bat_priv->tt_global_hash = hash_new(1024); 544 bat_priv->tt_global_hash = batadv_hash_new(1024);
545 545
546 if (!bat_priv->tt_global_hash) 546 if (!bat_priv->tt_global_hash)
547 return -ENOMEM; 547 return -ENOMEM;
@@ -1031,7 +1031,7 @@ static void tt_global_table_free(struct bat_priv *bat_priv)
1031 spin_unlock_bh(list_lock); 1031 spin_unlock_bh(list_lock);
1032 } 1032 }
1033 1033
1034 hash_destroy(hash); 1034 batadv_hash_destroy(hash);
1035 1035
1036 bat_priv->tt_global_hash = NULL; 1036 bat_priv->tt_global_hash = NULL;
1037} 1037}
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index 01d5da54143e..99f1931472f3 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -889,7 +889,7 @@ int vis_init(struct bat_priv *bat_priv)
889 889
890 spin_lock_bh(&bat_priv->vis_hash_lock); 890 spin_lock_bh(&bat_priv->vis_hash_lock);
891 891
892 bat_priv->vis_hash = hash_new(256); 892 bat_priv->vis_hash = batadv_hash_new(256);
893 if (!bat_priv->vis_hash) { 893 if (!bat_priv->vis_hash) {
894 pr_err("Can't initialize vis_hash\n"); 894 pr_err("Can't initialize vis_hash\n");
895 goto err; 895 goto err;