public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCHv2 1/2] batman-adv: make tt_global_add static and return bool
@ 2013-05-05 17:32 Antonio Quartulli
  2013-05-06  3:22 ` Marek Lindner
  0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2013-05-05 17:32 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

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>
---

v1 name was: [PATCH 1/2] batman-adv: make tt_global_add stati

v2:
- add some kernel doc
- make the function return bool


 translation-table.c | 14 ++++++++------
 translation-table.h |  4 ----
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/translation-table.c b/translation-table.c
index 48e1ca9..df6b5cd 100644
--- a/translation-table.c
+++ b/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/translation-table.h b/translation-table.h
index b4b6dea..fb710c5 100644
--- a/translation-table.h
+++ b/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.1.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv2 1/2] batman-adv: make tt_global_add static and return bool
  2013-05-05 17:32 [B.A.T.M.A.N.] [PATCHv2 1/2] batman-adv: make tt_global_add static and return bool Antonio Quartulli
@ 2013-05-06  3:22 ` Marek Lindner
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Lindner @ 2013-05-06  3:22 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

On Monday, May 06, 2013 01:32:38 Antonio Quartulli wrote:
> 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>
> ---
> 
> v1 name was: [PATCH 1/2] batman-adv: make tt_global_add stati
> 
> v2:
> - add some kernel doc
> - make the function return bool
> 
> 
>  translation-table.c | 14 ++++++++------
>  translation-table.h |  4 ----
>  2 files changed, 8 insertions(+), 10 deletions(-)

Applied in revision be7e115.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-06  3:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-05 17:32 [B.A.T.M.A.N.] [PATCHv2 1/2] batman-adv: make tt_global_add static and return bool Antonio Quartulli
2013-05-06  3:22 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox