From: Simon Wunderlich <sw@simonwunderlich.de>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Sven Eckelmann <sven@narfation.org>,
Simon Wunderlich <sw@simonwunderlich.de>
Subject: [PATCH 14/17] batman-adv: Use proper name for fragments list head
Date: Thu, 27 Oct 2016 21:01:47 +0200 [thread overview]
Message-ID: <20161027190150.7880-15-sw@simonwunderlich.de> (raw)
In-Reply-To: <20161027190150.7880-1-sw@simonwunderlich.de>
From: Sven Eckelmann <sven@narfation.org>
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>
---
net/batman-adv/fragmentation.c | 14 +++++++-------
net/batman-adv/fragmentation.h | 2 +-
net/batman-adv/originator.c | 2 +-
net/batman-adv/types.h | 6 +++---
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index 1b2f5b9..2b967a3 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -73,7 +73,7 @@ void batadv_frag_purge_orig(struct batadv_orig_node *orig_node,
spin_lock_bh(&chain->lock);
if (!check_cb || check_cb(chain)) {
- batadv_frag_clear_chain(&chain->head);
+ batadv_frag_clear_chain(&chain->fragment_list);
chain->size = 0;
}
@@ -117,8 +117,8 @@ static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain,
if (chain->seqno == seqno)
return false;
- if (!hlist_empty(&chain->head))
- batadv_frag_clear_chain(&chain->head);
+ if (!hlist_empty(&chain->fragment_list))
+ batadv_frag_clear_chain(&chain->fragment_list);
chain->size = 0;
chain->seqno = seqno;
@@ -176,7 +176,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
chain = &orig_node->fragments[bucket];
spin_lock_bh(&chain->lock);
if (batadv_frag_init_chain(chain, seqno)) {
- hlist_add_head(&frag_entry_new->list, &chain->head);
+ hlist_add_head(&frag_entry_new->list, &chain->fragment_list);
chain->size = skb->len - hdr_size;
chain->timestamp = jiffies;
chain->total_size = ntohs(frag_packet->total_size);
@@ -185,7 +185,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
}
/* Find the position for the new fragment. */
- hlist_for_each_entry(frag_entry_curr, &chain->head, list) {
+ hlist_for_each_entry(frag_entry_curr, &chain->fragment_list, list) {
/* Drop packet if fragment already exists. */
if (frag_entry_curr->no == frag_entry_new->no)
goto err_unlock;
@@ -220,11 +220,11 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
* exceeds the maximum size of one merged packet. Don't allow
* packets to have different total_size.
*/
- batadv_frag_clear_chain(&chain->head);
+ batadv_frag_clear_chain(&chain->fragment_list);
chain->size = 0;
} else if (ntohs(frag_packet->total_size) == chain->size) {
/* All fragments received. Hand over chain to caller. */
- hlist_move_list(&chain->head, chain_out);
+ hlist_move_list(&chain->fragment_list, chain_out);
chain->size = 0;
}
diff --git a/net/batman-adv/fragmentation.h b/net/batman-adv/fragmentation.h
index 3202fe3..b95f619 100644
--- a/net/batman-adv/fragmentation.h
+++ b/net/batman-adv/fragmentation.h
@@ -47,7 +47,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
static inline bool
batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
{
- if (!hlist_empty(&frags_entry->head) &&
+ if (!hlist_empty(&frags_entry->fragment_list) &&
batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT))
return true;
return false;
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 6af87c9..518b1ed 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -1021,7 +1021,7 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
batadv_orig_node_vlan_put(vlan);
for (i = 0; i < BATADV_FRAG_BUFFER_COUNT; i++) {
- INIT_HLIST_HEAD(&orig_node->fragments[i].head);
+ INIT_HLIST_HEAD(&orig_node->fragments[i].fragment_list);
spin_lock_init(&orig_node->fragments[i].lock);
orig_node->fragments[i].size = 0;
}
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 97336ec..d31e7ec 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -184,7 +184,7 @@ struct batadv_orig_ifinfo {
/**
* struct batadv_frag_table_entry - head in the fragment buffer table
- * @head: head of list with fragments
+ * @fragment_list: head of list with fragments
* @lock: lock to protect the list of fragments
* @timestamp: time (jiffie) of last received fragment
* @seqno: sequence number of the fragments in the list
@@ -192,8 +192,8 @@ struct batadv_orig_ifinfo {
* @total_size: expected size of the assembled packet
*/
struct batadv_frag_table_entry {
- struct hlist_head head;
- spinlock_t lock; /* protects head */
+ struct hlist_head fragment_list;
+ spinlock_t lock; /* protects fragment_list */
unsigned long timestamp;
u16 seqno;
u16 size;
--
2.10.1
next prev parent reply other threads:[~2016-10-27 19:02 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-27 19:01 [PATCH 00/17] pull request for net-next: batman-adv 2016-10-27 Simon Wunderlich
2016-10-27 19:01 ` [PATCH 04/17] batman-adv: Add dat, mcast, nc and neighbor debugfs files to README Simon Wunderlich
2016-10-27 19:01 ` [PATCH 05/17] batman-adv: Document new nc, mcast and tpmeter log levels Simon Wunderlich
2016-10-27 19:01 ` [PATCH 07/17] batman-adv: Move batadv_sum_counter to soft-interface.c Simon Wunderlich
2016-10-27 19:01 ` [PATCH 08/17] batman-adv: Remove unused batadv_icmp_user_cmd_type Simon Wunderlich
2016-10-27 19:01 ` [PATCH 09/17] batman-adv: fix batadv_forw_packet kerneldoc for list attribute Simon Wunderlich
2016-10-27 19:01 ` [PATCH 10/17] batman-adv: remove unsed argument from batadv_dbg_arp() function Simon Wunderlich
2016-10-27 19:01 ` [PATCH 11/17] batman-adv: Allow selecting BATMAN V if CFG80211 is not built Simon Wunderlich
2016-10-27 19:01 ` [PATCH 12/17] batman-adv: Less function calls in batadv_is_ap_isolated() after error detection Simon Wunderlich
2016-10-27 19:01 ` [PATCH 13/17] batman-adv: Remove needless init of variables on stack Simon Wunderlich
2016-10-27 19:01 ` Simon Wunderlich [this message]
2016-10-27 19:01 ` [PATCH 15/17] batman-adv: Use proper name for gateway list head Simon Wunderlich
2016-10-27 19:01 ` [PATCH 16/17] batman-adv: Use octal permissions instead of macros Simon Wunderlich
2016-10-27 19:01 ` [PATCH 17/17] batman-adv: Avoid precedence issues in macros Simon Wunderlich
2016-10-28 21:13 ` Joe Perches
2016-10-28 21:27 ` Sven Eckelmann
2016-10-29 1:56 ` Joe Perches
[not found] ` <1477706184.23018.3.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2016-10-29 6:52 ` Sven Eckelmann
[not found] ` <20161027190150.7880-1-sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
2016-10-27 19:01 ` [PATCH 01/17] batman-adv: Start new development cycle Simon Wunderlich
2016-10-27 19:01 ` [PATCH 02/17] batman-adv: Add B.A.T.M.A.N. V sysfs files to README Simon Wunderlich
2016-10-27 19:01 ` [PATCH 03/17] batman-adv: Add network_coding and mcast " Simon Wunderlich
2016-10-29 10:33 ` Jiri Pirko
2016-10-29 10:37 ` Sven Eckelmann
2016-10-29 10:56 ` Jiri Pirko
[not found] ` <20161029105628.GE1692-6KJVSR23iU488b5SBfVpbw@public.gmane.org>
2016-10-29 11:46 ` Sven Eckelmann
2016-10-29 13:51 ` Jiri Pirko
2018-03-27 15:43 ` [B.A.T.M.A.N.] " Linus Lüssing
2018-05-07 6:34 ` Sven Eckelmann
2018-05-20 4:37 ` Sven Eckelmann
2018-05-20 6:19 ` Jiri Pirko
2018-08-04 9:24 ` [B.A.T.M.A.N.] " Antonio Quartulli
[not found] ` <113e9222-3310-71c6-7cec-c253b9b5d194-2CpIooy/SPIKlTDg6p0iyA@public.gmane.org>
2018-08-04 9:36 ` Jiri Pirko
2018-08-04 11:19 ` [B.A.T.M.A.N.] " Antonio Quartulli
[not found] ` <f2964fca-072e-2a6c-4ce9-aa7963465195-2CpIooy/SPIKlTDg6p0iyA@public.gmane.org>
2018-08-04 11:52 ` Jiri Pirko
2016-10-27 19:01 ` [PATCH 06/17] batman-adv: Remove unused function batadv_hash_delete Simon Wunderlich
2016-10-29 20:28 ` [PATCH 00/17] pull request for net-next: batman-adv 2016-10-27 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161027190150.7880-15-sw@simonwunderlich.de \
--to=sw@simonwunderlich.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=sven@narfation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).