Skip to content

Commit 70ea5ce

Browse files
ecsvsimonwunderlich
authored andcommitted
batman-adv: Use proper name for gateway list head
The batman-adv codebase is using "list" for the list node (prev/next) and <list content descriptor>+"_list" for the head of a list. Not using this naming scheme can up in confusions when reading the code. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
1 parent 176e5b7 commit 70ea5ce

5 files changed

Lines changed: 15 additions & 14 deletions

File tree

‎net/batman-adv/bat_iv_ogm.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,7 +2486,7 @@ batadv_iv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
24862486
struct batadv_orig_node *orig_node;
24872487

24882488
rcu_read_lock();
2489-
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
2489+
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
24902490
orig_node = gw_node->orig_node;
24912491
router = batadv_orig_router_get(orig_node, BATADV_IF_DEFAULT);
24922492
if (!router)
@@ -2674,7 +2674,7 @@ static void batadv_iv_gw_print(struct batadv_priv *bat_priv,
26742674
" Gateway (#/255) Nexthop [outgoingIF]: advertised uplink bandwidth\n");
26752675

26762676
rcu_read_lock();
2677-
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
2677+
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
26782678
/* fails if orig_node has no router */
26792679
if (batadv_iv_gw_write_buffer_text(bat_priv, seq, gw_node) < 0)
26802680
continue;
@@ -2774,7 +2774,7 @@ static void batadv_iv_gw_dump(struct sk_buff *msg, struct netlink_callback *cb,
27742774
int idx = 0;
27752775

27762776
rcu_read_lock();
2777-
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
2777+
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
27782778
if (idx++ < idx_skip)
27792779
continue;
27802780

‎net/batman-adv/bat_v.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ batadv_v_gw_get_best_gw_node(struct batadv_priv *bat_priv)
750750
u32 max_bw = 0, bw;
751751

752752
rcu_read_lock();
753-
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
753+
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
754754
if (!kref_get_unless_zero(&gw_node->refcount))
755755
continue;
756756

@@ -889,7 +889,7 @@ static void batadv_v_gw_print(struct batadv_priv *bat_priv,
889889
" Gateway ( throughput) Nexthop [outgoingIF]: advertised uplink bandwidth\n");
890890

891891
rcu_read_lock();
892-
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
892+
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
893893
/* fails if orig_node has no router */
894894
if (batadv_v_gw_write_buffer_text(bat_priv, seq, gw_node) < 0)
895895
continue;
@@ -1009,7 +1009,7 @@ static void batadv_v_gw_dump(struct sk_buff *msg, struct netlink_callback *cb,
10091009
int idx = 0;
10101010

10111011
rcu_read_lock();
1012-
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
1012+
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
10131013
if (idx++ < idx_skip)
10141014
continue;
10151015

‎net/batman-adv/gateway_client.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv,
348348

349349
spin_lock_bh(&bat_priv->gw.list_lock);
350350
kref_get(&gw_node->refcount);
351-
hlist_add_head_rcu(&gw_node->list, &bat_priv->gw.list);
351+
hlist_add_head_rcu(&gw_node->list, &bat_priv->gw.gateway_list);
352352
spin_unlock_bh(&bat_priv->gw.list_lock);
353353

354354
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
@@ -376,7 +376,8 @@ struct batadv_gw_node *batadv_gw_node_get(struct batadv_priv *bat_priv,
376376
struct batadv_gw_node *gw_node_tmp, *gw_node = NULL;
377377

378378
rcu_read_lock();
379-
hlist_for_each_entry_rcu(gw_node_tmp, &bat_priv->gw.list, list) {
379+
hlist_for_each_entry_rcu(gw_node_tmp, &bat_priv->gw.gateway_list,
380+
list) {
380381
if (gw_node_tmp->orig_node != orig_node)
381382
continue;
382383

@@ -475,7 +476,7 @@ void batadv_gw_node_free(struct batadv_priv *bat_priv)
475476

476477
spin_lock_bh(&bat_priv->gw.list_lock);
477478
hlist_for_each_entry_safe(gw_node, node_tmp,
478-
&bat_priv->gw.list, list) {
479+
&bat_priv->gw.gateway_list, list) {
479480
hlist_del_init_rcu(&gw_node->list);
480481
batadv_gw_node_put(gw_node);
481482
}

‎net/batman-adv/main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ int batadv_mesh_init(struct net_device *soft_iface)
160160

161161
INIT_HLIST_HEAD(&bat_priv->forw_bat_list);
162162
INIT_HLIST_HEAD(&bat_priv->forw_bcast_list);
163-
INIT_HLIST_HEAD(&bat_priv->gw.list);
163+
INIT_HLIST_HEAD(&bat_priv->gw.gateway_list);
164164
#ifdef CONFIG_BATMAN_ADV_MCAST
165165
INIT_HLIST_HEAD(&bat_priv->mcast.want_all_unsnoopables_list);
166166
INIT_HLIST_HEAD(&bat_priv->mcast.want_all_ipv4_list);

‎net/batman-adv/types.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,8 @@ struct batadv_priv_debug_log {
706706

707707
/**
708708
* struct batadv_priv_gw - per mesh interface gateway data
709-
* @list: list of available gateway nodes
710-
* @list_lock: lock protecting gw_list & curr_gw
709+
* @gateway_list: list of available gateway nodes
710+
* @list_lock: lock protecting gateway_list & curr_gw
711711
* @curr_gw: pointer to currently selected gateway node
712712
* @mode: gateway operation: off, client or server (see batadv_gw_modes)
713713
* @sel_class: gateway selection class (applies if gw_mode client)
@@ -716,8 +716,8 @@ struct batadv_priv_debug_log {
716716
* @reselect: bool indicating a gateway re-selection is in progress
717717
*/
718718
struct batadv_priv_gw {
719-
struct hlist_head list;
720-
spinlock_t list_lock; /* protects gw_list & curr_gw */
719+
struct hlist_head gateway_list;
720+
spinlock_t list_lock; /* protects gateway_list & curr_gw */
721721
struct batadv_gw_node __rcu *curr_gw; /* rcu protected pointer */
722722
atomic_t mode;
723723
atomic_t sel_class;

0 commit comments

Comments
 (0)