Skip to content

Commit 176e5b7

Browse files
ecsvsimonwunderlich
authored andcommitted
batman-adv: Use proper name for fragments 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 because list_head is used for both the head of the list and the list node (prev/next) in each item of the list. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
1 parent 422d2f7 commit 176e5b7

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎net/batman-adv/fragmentation.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void batadv_frag_purge_orig(struct batadv_orig_node *orig_node,
7373
spin_lock_bh(&chain->lock);
7474

7575
if (!check_cb || check_cb(chain)) {
76-
batadv_frag_clear_chain(&chain->head);
76+
batadv_frag_clear_chain(&chain->fragment_list);
7777
chain->size = 0;
7878
}
7979

@@ -117,8 +117,8 @@ static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain,
117117
if (chain->seqno == seqno)
118118
return false;
119119

120-
if (!hlist_empty(&chain->head))
121-
batadv_frag_clear_chain(&chain->head);
120+
if (!hlist_empty(&chain->fragment_list))
121+
batadv_frag_clear_chain(&chain->fragment_list);
122122

123123
chain->size = 0;
124124
chain->seqno = seqno;
@@ -176,7 +176,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
176176
chain = &orig_node->fragments[bucket];
177177
spin_lock_bh(&chain->lock);
178178
if (batadv_frag_init_chain(chain, seqno)) {
179-
hlist_add_head(&frag_entry_new->list, &chain->head);
179+
hlist_add_head(&frag_entry_new->list, &chain->fragment_list);
180180
chain->size = skb->len - hdr_size;
181181
chain->timestamp = jiffies;
182182
chain->total_size = ntohs(frag_packet->total_size);
@@ -185,7 +185,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
185185
}
186186

187187
/* Find the position for the new fragment. */
188-
hlist_for_each_entry(frag_entry_curr, &chain->head, list) {
188+
hlist_for_each_entry(frag_entry_curr, &chain->fragment_list, list) {
189189
/* Drop packet if fragment already exists. */
190190
if (frag_entry_curr->no == frag_entry_new->no)
191191
goto err_unlock;
@@ -220,11 +220,11 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
220220
* exceeds the maximum size of one merged packet. Don't allow
221221
* packets to have different total_size.
222222
*/
223-
batadv_frag_clear_chain(&chain->head);
223+
batadv_frag_clear_chain(&chain->fragment_list);
224224
chain->size = 0;
225225
} else if (ntohs(frag_packet->total_size) == chain->size) {
226226
/* All fragments received. Hand over chain to caller. */
227-
hlist_move_list(&chain->head, chain_out);
227+
hlist_move_list(&chain->fragment_list, chain_out);
228228
chain->size = 0;
229229
}
230230

‎net/batman-adv/fragmentation.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
4747
static inline bool
4848
batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
4949
{
50-
if (!hlist_empty(&frags_entry->head) &&
50+
if (!hlist_empty(&frags_entry->fragment_list) &&
5151
batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT))
5252
return true;
5353
return false;

‎net/batman-adv/originator.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
10211021
batadv_orig_node_vlan_put(vlan);
10221022

10231023
for (i = 0; i < BATADV_FRAG_BUFFER_COUNT; i++) {
1024-
INIT_HLIST_HEAD(&orig_node->fragments[i].head);
1024+
INIT_HLIST_HEAD(&orig_node->fragments[i].fragment_list);
10251025
spin_lock_init(&orig_node->fragments[i].lock);
10261026
orig_node->fragments[i].size = 0;
10271027
}

‎net/batman-adv/types.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,16 @@ struct batadv_orig_ifinfo {
184184

185185
/**
186186
* struct batadv_frag_table_entry - head in the fragment buffer table
187-
* @head: head of list with fragments
187+
* @fragment_list: head of list with fragments
188188
* @lock: lock to protect the list of fragments
189189
* @timestamp: time (jiffie) of last received fragment
190190
* @seqno: sequence number of the fragments in the list
191191
* @size: accumulated size of packets in list
192192
* @total_size: expected size of the assembled packet
193193
*/
194194
struct batadv_frag_table_entry {
195-
struct hlist_head head;
196-
spinlock_t lock; /* protects head */
195+
struct hlist_head fragment_list;
196+
spinlock_t lock; /* protects fragment_list */
197197
unsigned long timestamp;
198198
u16 seqno;
199199
u16 size;

0 commit comments

Comments
 (0)