All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
	Marek Lindner <lindner_marek@yahoo.de>,
	Antonio Quartulli <ordex@autistici.org>
Subject: [B.A.T.M.A.N.] [PATCH 02/16] batman-adv: make tt_global_add static and return bool
Date: Sun, 13 Oct 2013 13:22:47 +0200	[thread overview]
Message-ID: <1381663381-626-3-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1381663381-626-1-git-send-email-antonio@meshcoding.com>

From: Antonio Quartulli <ordex@autistici.org>

batadv_tt_global_add is not used anymore outside of the TT
code thanks to the TVLV implementation. It can therefore be
declared as static

Last user has been removed by 3de4e64df0f1326db7cc0ef25f5af8522850252d
("batman-adv: tvlv - convert roaming adv packet to use tvlv unicast packets")

Moreover make it return bool since its result can be either 0 or 1.

Reported-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
 net/batman-adv/translation-table.c | 14 ++++++++------
 net/batman-adv/translation-table.h |  4 ----
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index c741694..b3c4369 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -805,15 +805,17 @@ out:
  * If a TT local entry exists for this non-mesh client remove it.
  *
  * The caller must hold orig_node refcount.
+ *
+ * Return true if the new entry has been added, false otherwise
  */
-int batadv_tt_global_add(struct batadv_priv *bat_priv,
-			 struct batadv_orig_node *orig_node,
-			 const unsigned char *tt_addr, uint16_t flags,
-			 uint8_t ttvn)
+static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
+				 struct batadv_orig_node *orig_node,
+				 const unsigned char *tt_addr, uint16_t flags,
+				 uint8_t ttvn)
 {
 	struct batadv_tt_global_entry *tt_global_entry;
 	struct batadv_tt_local_entry *tt_local_entry;
-	int ret = 0;
+	bool ret = false;
 	int hash_added;
 	struct batadv_tt_common_entry *common;
 	uint16_t local_flags;
@@ -914,7 +916,7 @@ add_orig_entry:
 	batadv_dbg(BATADV_DBG_TT, bat_priv,
 		   "Creating new global tt entry: %pM (via %pM)\n",
 		   common->addr, orig_node->orig);
-	ret = 1;
+	ret = true;
 
 out_remove:
 
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h
index b4b6dea..fb710c5 100644
--- a/net/batman-adv/translation-table.h
+++ b/net/batman-adv/translation-table.h
@@ -30,10 +30,6 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset);
 void batadv_tt_global_add_orig(struct batadv_priv *bat_priv,
 			       struct batadv_orig_node *orig_node,
 			       const unsigned char *tt_buff, int tt_buff_len);
-int batadv_tt_global_add(struct batadv_priv *bat_priv,
-			 struct batadv_orig_node *orig_node,
-			 const unsigned char *addr, uint16_t flags,
-			 uint8_t ttvn);
 int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset);
 void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
 			       struct batadv_orig_node *orig_node,
-- 
1.8.3.2


WARNING: multiple messages have this Message-ID (diff)
From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
	Antonio Quartulli <ordex@autistici.org>,
	Marek Lindner <lindner_marek@yahoo.de>
Subject: [PATCH 02/16] batman-adv: make tt_global_add static and return bool
Date: Sun, 13 Oct 2013 13:22:47 +0200	[thread overview]
Message-ID: <1381663381-626-3-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1381663381-626-1-git-send-email-antonio@meshcoding.com>

From: Antonio Quartulli <ordex@autistici.org>

batadv_tt_global_add is not used anymore outside of the TT
code thanks to the TVLV implementation. It can therefore be
declared as static

Last user has been removed by 3de4e64df0f1326db7cc0ef25f5af8522850252d
("batman-adv: tvlv - convert roaming adv packet to use tvlv unicast packets")

Moreover make it return bool since its result can be either 0 or 1.

Reported-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
 net/batman-adv/translation-table.c | 14 ++++++++------
 net/batman-adv/translation-table.h |  4 ----
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index c741694..b3c4369 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -805,15 +805,17 @@ out:
  * If a TT local entry exists for this non-mesh client remove it.
  *
  * The caller must hold orig_node refcount.
+ *
+ * Return true if the new entry has been added, false otherwise
  */
-int batadv_tt_global_add(struct batadv_priv *bat_priv,
-			 struct batadv_orig_node *orig_node,
-			 const unsigned char *tt_addr, uint16_t flags,
-			 uint8_t ttvn)
+static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
+				 struct batadv_orig_node *orig_node,
+				 const unsigned char *tt_addr, uint16_t flags,
+				 uint8_t ttvn)
 {
 	struct batadv_tt_global_entry *tt_global_entry;
 	struct batadv_tt_local_entry *tt_local_entry;
-	int ret = 0;
+	bool ret = false;
 	int hash_added;
 	struct batadv_tt_common_entry *common;
 	uint16_t local_flags;
@@ -914,7 +916,7 @@ add_orig_entry:
 	batadv_dbg(BATADV_DBG_TT, bat_priv,
 		   "Creating new global tt entry: %pM (via %pM)\n",
 		   common->addr, orig_node->orig);
-	ret = 1;
+	ret = true;
 
 out_remove:
 
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h
index b4b6dea..fb710c5 100644
--- a/net/batman-adv/translation-table.h
+++ b/net/batman-adv/translation-table.h
@@ -30,10 +30,6 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset);
 void batadv_tt_global_add_orig(struct batadv_priv *bat_priv,
 			       struct batadv_orig_node *orig_node,
 			       const unsigned char *tt_buff, int tt_buff_len);
-int batadv_tt_global_add(struct batadv_priv *bat_priv,
-			 struct batadv_orig_node *orig_node,
-			 const unsigned char *addr, uint16_t flags,
-			 uint8_t ttvn);
 int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset);
 void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
 			       struct batadv_orig_node *orig_node,
-- 
1.8.3.2

  parent reply	other threads:[~2013-10-13 11:22 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-13 11:22 [B.A.T.M.A.N.] pull request: batman-adv 2013-10-13 Antonio Quartulli
2013-10-13 11:22 ` Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 01/16] batman-adv: only add recordroute information to icmp request/reply Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:22 ` Antonio Quartulli [this message]
2013-10-13 11:22   ` [PATCH 02/16] batman-adv: make tt_global_add static and return bool Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 03/16] batman-adv: remove batadv_tt_global_add_orig declaration Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 04/16] batman-adv: don't use call_rcu if not needed Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 05/16] batman-adv: h_vlan_encapsulated_proto access refactoring Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 06/16] batman-adv: use VLAN_ETH_HLEN instead of sizeof(struct vlan_eth_hdr) Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 07/16] batman-adv: Remove old fragmentation code Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 08/16] batman-adv: Receive fragmented packets and merge Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 09/16] batman-adv: Fragment and send skbs larger than mtu Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 10/16] batman-adv: use htons when possible Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 11/16] batman-adv: create common header for ICMP packets Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 12/16] batman-adv: consider network coding overhead when calculating required mtu Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 13/16] batman-adv: remove useless find_router look up Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:22 ` [B.A.T.M.A.N.] [PATCH 14/16] batman-adv: implement batadv_tt_entries Antonio Quartulli
2013-10-13 11:22   ` Antonio Quartulli
2013-10-13 11:23 ` [B.A.T.M.A.N.] [PATCH 15/16] batman-adv: make batadv_tt_save_orig_buffer() generic Antonio Quartulli
2013-10-13 11:23   ` Antonio Quartulli
2013-10-13 11:23 ` [B.A.T.M.A.N.] [PATCH 16/16] batman-adv: Add dummy soft-interface rx mode handler Antonio Quartulli
2013-10-13 11:23   ` Antonio Quartulli
2013-10-17 18:27 ` [B.A.T.M.A.N.] pull request: batman-adv 2013-10-13 David Miller
2013-10-17 18: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=1381663381-626-3-git-send-email-antonio@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=lindner_marek@yahoo.de \
    --cc=netdev@vger.kernel.org \
    --cc=ordex@autistici.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.