Skip to content

Commit c0a5592

Browse files
ecsvAntonio Quartulli
authored andcommitted
batman-adv: Prefix hash static inline 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>
1 parent e5d8925 commit c0a5592

5 files changed

Lines changed: 42 additions & 35 deletions

File tree

‎net/batman-adv/bridge_loop_avoidance.c‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,9 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv,
379379
/* one for the hash, one for returning */
380380
atomic_set(&entry->refcount, 2);
381381

382-
hash_added = hash_add(bat_priv->backbone_hash, compare_backbone_gw,
383-
choose_backbone_gw, entry, &entry->hash_entry);
382+
hash_added = batadv_hash_add(bat_priv->backbone_hash,
383+
compare_backbone_gw, choose_backbone_gw,
384+
entry, &entry->hash_entry);
384385

385386
if (unlikely(hash_added != 0)) {
386387
/* hash failed, free the structure */
@@ -540,8 +541,9 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac,
540541
bat_dbg(DBG_BLA, bat_priv,
541542
"bla_add_claim(): adding new entry %pM, vid %d to hash ...\n",
542543
mac, vid);
543-
hash_added = hash_add(bat_priv->claim_hash, compare_claim,
544-
choose_claim, claim, &claim->hash_entry);
544+
hash_added = batadv_hash_add(bat_priv->claim_hash,
545+
compare_claim, choose_claim,
546+
claim, &claim->hash_entry);
545547

546548
if (unlikely(hash_added != 0)) {
547549
/* only local changes happened. */
@@ -590,7 +592,8 @@ static void bla_del_claim(struct bat_priv *bat_priv, const uint8_t *mac,
590592

591593
bat_dbg(DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", mac, vid);
592594

593-
hash_remove(bat_priv->claim_hash, compare_claim, choose_claim, claim);
595+
batadv_hash_remove(bat_priv->claim_hash, compare_claim, choose_claim,
596+
claim);
594597
claim_free_ref(claim); /* reference from the hash is gone */
595598

596599
claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);

‎net/batman-adv/hash.h‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ void batadv_hash_destroy(struct hashtable_t *hash);
5454
* called to remove the elements inside of the hash. if you don't remove the
5555
* elements, memory might be leaked.
5656
*/
57-
static inline void hash_delete(struct hashtable_t *hash,
58-
hashdata_free_cb free_cb, void *arg)
57+
static inline void batadv_hash_delete(struct hashtable_t *hash,
58+
hashdata_free_cb free_cb, void *arg)
5959
{
6060
struct hlist_head *head;
6161
struct hlist_node *node, *node_tmp;
@@ -89,10 +89,11 @@ static inline void hash_delete(struct hashtable_t *hash,
8989
* Returns 0 on success, 1 if the element already is in the hash
9090
* and -1 on error.
9191
*/
92-
static inline int hash_add(struct hashtable_t *hash,
93-
hashdata_compare_cb compare,
94-
hashdata_choose_cb choose,
95-
const void *data, struct hlist_node *data_node)
92+
static inline int batadv_hash_add(struct hashtable_t *hash,
93+
hashdata_compare_cb compare,
94+
hashdata_choose_cb choose,
95+
const void *data,
96+
struct hlist_node *data_node)
9697
{
9798
uint32_t index;
9899
int ret = -1;
@@ -133,9 +134,9 @@ static inline int hash_add(struct hashtable_t *hash,
133134
* structure you use with just the key filled, we just need the key for
134135
* comparing.
135136
*/
136-
static inline void *hash_remove(struct hashtable_t *hash,
137-
hashdata_compare_cb compare,
138-
hashdata_choose_cb choose, void *data)
137+
static inline void *batadv_hash_remove(struct hashtable_t *hash,
138+
hashdata_compare_cb compare,
139+
hashdata_choose_cb choose, void *data)
139140
{
140141
uint32_t index;
141142
struct hlist_node *node;

‎net/batman-adv/originator.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,9 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,
248248
if (!orig_node->bcast_own_sum)
249249
goto free_bcast_own;
250250

251-
hash_added = hash_add(bat_priv->orig_hash, compare_orig,
252-
choose_orig, orig_node, &orig_node->hash_entry);
251+
hash_added = batadv_hash_add(bat_priv->orig_hash, compare_orig,
252+
choose_orig, orig_node,
253+
&orig_node->hash_entry);
253254
if (hash_added != 0)
254255
goto free_bcast_own_sum;
255256

‎net/batman-adv/translation-table.c‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
234234
*/
235235
tt_local_entry->common.flags |= TT_CLIENT_NEW;
236236

237-
hash_added = hash_add(bat_priv->tt_local_hash, compare_tt, choose_orig,
238-
&tt_local_entry->common,
239-
&tt_local_entry->common.hash_entry);
237+
hash_added = batadv_hash_add(bat_priv->tt_local_hash, compare_tt,
238+
choose_orig, &tt_local_entry->common,
239+
&tt_local_entry->common.hash_entry);
240240

241241
if (unlikely(hash_added != 0)) {
242242
/* remove the reference for the hash */
@@ -618,6 +618,7 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
618618
struct tt_global_entry *tt_global_entry = NULL;
619619
int ret = 0;
620620
int hash_added;
621+
struct tt_common_entry *common;
621622

622623
tt_global_entry = tt_global_hash_find(bat_priv, tt_addr);
623624

@@ -627,18 +628,19 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
627628
if (!tt_global_entry)
628629
goto out;
629630

630-
memcpy(tt_global_entry->common.addr, tt_addr, ETH_ALEN);
631+
common = &tt_global_entry->common;
632+
memcpy(common->addr, tt_addr, ETH_ALEN);
631633

632-
tt_global_entry->common.flags = NO_FLAGS;
634+
common->flags = NO_FLAGS;
633635
tt_global_entry->roam_at = 0;
634-
atomic_set(&tt_global_entry->common.refcount, 2);
636+
atomic_set(&common->refcount, 2);
635637

636638
INIT_HLIST_HEAD(&tt_global_entry->orig_list);
637639
spin_lock_init(&tt_global_entry->list_lock);
638640

639-
hash_added = hash_add(bat_priv->tt_global_hash, compare_tt,
640-
choose_orig, &tt_global_entry->common,
641-
&tt_global_entry->common.hash_entry);
641+
hash_added = batadv_hash_add(bat_priv->tt_global_hash,
642+
compare_tt, choose_orig,
643+
common, &common->hash_entry);
642644

643645
if (unlikely(hash_added != 0)) {
644646
/* remove the reference for the hash */
@@ -816,8 +818,8 @@ static void tt_global_del_struct(struct bat_priv *bat_priv,
816818
"Deleting global tt entry %pM: %s\n",
817819
tt_global_entry->common.addr, message);
818820

819-
hash_remove(bat_priv->tt_global_hash, compare_tt, choose_orig,
820-
tt_global_entry->common.addr);
821+
batadv_hash_remove(bat_priv->tt_global_hash, compare_tt, choose_orig,
822+
tt_global_entry->common.addr);
821823
tt_global_entry_free_ref(tt_global_entry);
822824

823825
}

‎net/batman-adv/vis.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
433433
}
434434
}
435435
/* remove old entry */
436-
hash_remove(bat_priv->vis_hash, vis_info_cmp, vis_info_choose,
437-
old_info);
436+
batadv_hash_remove(bat_priv->vis_hash, vis_info_cmp,
437+
vis_info_choose, old_info);
438438
send_list_del(old_info);
439439
kref_put(&old_info->refcount, free_info);
440440
}
@@ -474,8 +474,8 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
474474
recv_list_add(bat_priv, &info->recv_list, packet->sender_orig);
475475

476476
/* try to add it */
477-
hash_added = hash_add(bat_priv->vis_hash, vis_info_cmp, vis_info_choose,
478-
info, &info->hash_entry);
477+
hash_added = batadv_hash_add(bat_priv->vis_hash, vis_info_cmp,
478+
vis_info_choose, info, &info->hash_entry);
479479
if (hash_added != 0) {
480480
/* did not work (for some reason) */
481481
kref_put(&info->refcount, free_info);
@@ -934,9 +934,9 @@ int batadv_vis_init(struct bat_priv *bat_priv)
934934

935935
INIT_LIST_HEAD(&bat_priv->vis_send_list);
936936

937-
hash_added = hash_add(bat_priv->vis_hash, vis_info_cmp, vis_info_choose,
938-
bat_priv->my_vis_info,
939-
&bat_priv->my_vis_info->hash_entry);
937+
hash_added = batadv_hash_add(bat_priv->vis_hash, vis_info_cmp,
938+
vis_info_choose, bat_priv->my_vis_info,
939+
&bat_priv->my_vis_info->hash_entry);
940940
if (hash_added != 0) {
941941
pr_err("Can't add own vis packet into hash\n");
942942
/* not in hash, need to remove it manually. */
@@ -977,7 +977,7 @@ void batadv_vis_quit(struct bat_priv *bat_priv)
977977

978978
spin_lock_bh(&bat_priv->vis_hash_lock);
979979
/* properly remove, kill timers ... */
980-
hash_delete(bat_priv->vis_hash, free_info_ref, NULL);
980+
batadv_hash_delete(bat_priv->vis_hash, free_info_ref, NULL);
981981
bat_priv->vis_hash = NULL;
982982
bat_priv->my_vis_info = NULL;
983983
spin_unlock_bh(&bat_priv->vis_hash_lock);

0 commit comments

Comments
 (0)