b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: Remove declaration of only locally used functions
@ 2012-02-05 17:55 Sven Eckelmann
  2012-02-06 14:42 ` Marek Lindner
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Eckelmann @ 2012-02-05 17:55 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
This should help us to find unused code. The test was done with
a script that was inspired by another script from d0tslash.
I would like to add this to the daily tests when this patch
was added to next.

set -e
defined="`nm -g --defined-only *.o|awk '{print $3}'|sort|uniq`"
used="`nm -g --undefined-only *.o|awk '{print $2}'|sort|uniq`"

for i in $defined; do
	found=0
	for j in $used; do
		[ "$i" = "$j" ] && found=1 && break
	done
	[ "$found" = "0" ] && echo $i
done
---
 translation-table.c |   22 ++++++++++++++--------
 translation-table.h |    8 --------
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/translation-table.c b/translation-table.c
index 9a6f315..c1abf48 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -30,6 +30,8 @@
 
 #include <linux/crc16.h>
 
+static void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
+			  struct orig_node *orig_node);
 static void _tt_global_del(struct bat_priv *bat_priv,
 			   struct tt_global_entry *tt_global_entry,
 			   const char *message);
@@ -644,9 +646,10 @@ out:
 		tt_global_entry_free_ref(tt_global_entry);
 }
 
-void tt_global_del(struct bat_priv *bat_priv,
-		   struct orig_node *orig_node, const unsigned char *addr,
-		   const char *message, bool roaming)
+static void tt_global_del(struct bat_priv *bat_priv,
+			  struct orig_node *orig_node,
+			  const unsigned char *addr,
+			  const char *message, bool roaming)
 {
 	struct tt_global_entry *tt_global_entry = NULL;
 	struct tt_local_entry *tt_local_entry = NULL;
@@ -848,7 +851,8 @@ out:
 }
 
 /* Calculates the checksum of the local table of a given orig_node */
-uint16_t tt_global_crc(struct bat_priv *bat_priv, struct orig_node *orig_node)
+static uint16_t tt_global_crc(struct bat_priv *bat_priv,
+			      struct orig_node *orig_node)
 {
 	uint16_t total = 0, total_one;
 	struct hashtable_t *hash = bat_priv->tt_global_hash;
@@ -936,8 +940,10 @@ static void tt_req_list_free(struct bat_priv *bat_priv)
 	spin_unlock_bh(&bat_priv->tt_req_list_lock);
 }
 
-void tt_save_orig_buffer(struct bat_priv *bat_priv, struct orig_node *orig_node,
-			 const unsigned char *tt_buff, uint8_t tt_num_changes)
+static void tt_save_orig_buffer(struct bat_priv *bat_priv,
+				struct orig_node *orig_node,
+				const unsigned char *tt_buff,
+				uint8_t tt_num_changes)
 {
 	uint16_t tt_buff_len = tt_len(tt_num_changes);
 
@@ -1629,8 +1635,8 @@ unlock:
 	return ret;
 }
 
-void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
-		   struct orig_node *orig_node)
+static void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
+			  struct orig_node *orig_node)
 {
 	struct neigh_node *neigh_node = NULL;
 	struct sk_buff *skb = NULL;
diff --git a/translation-table.h b/translation-table.h
index c753633..bfebe26 100644
--- a/translation-table.h
+++ b/translation-table.h
@@ -39,23 +39,15 @@ int tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
 int tt_global_seq_print_text(struct seq_file *seq, void *offset);
 void tt_global_del_orig(struct bat_priv *bat_priv,
 			struct orig_node *orig_node, const char *message);
-void tt_global_del(struct bat_priv *bat_priv,
-		   struct orig_node *orig_node, const unsigned char *addr,
-		   const char *message, bool roaming);
 struct orig_node *transtable_search(struct bat_priv *bat_priv,
 				    const uint8_t *src, const uint8_t *addr);
-void tt_save_orig_buffer(struct bat_priv *bat_priv, struct orig_node *orig_node,
-			 const unsigned char *tt_buff, uint8_t tt_num_changes);
 uint16_t tt_local_crc(struct bat_priv *bat_priv);
-uint16_t tt_global_crc(struct bat_priv *bat_priv, struct orig_node *orig_node);
 void tt_free(struct bat_priv *bat_priv);
 bool send_tt_response(struct bat_priv *bat_priv,
 		      struct tt_query_packet *tt_request);
 bool is_my_client(struct bat_priv *bat_priv, const uint8_t *addr);
 void handle_tt_response(struct bat_priv *bat_priv,
 			struct tt_query_packet *tt_response);
-void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
-		   struct orig_node *orig_node);
 void tt_commit_changes(struct bat_priv *bat_priv);
 bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst);
 void tt_update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node,
-- 
1.7.8.3


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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Remove declaration of only locally used functions
  2012-02-05 17:55 [B.A.T.M.A.N.] [PATCH] batman-adv: Remove declaration of only locally used functions Sven Eckelmann
@ 2012-02-06 14:42 ` Marek Lindner
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2012-02-06 14:42 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Monday, February 06, 2012 01:55:22 Sven Eckelmann wrote:
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> This should help us to find unused code. The test was done with
> a script that was inspired by another script from d0tslash.
> I would like to add this to the daily tests when this patch
> was added to next.

Applied in revision c8060ad.

This nifty little script seems to be a good idea. Please go ahead and add it 
to our daily code check. :)

Thanks,
Marek

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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Remove declaration of only locally used functions
  2012-02-06 22:11 Sven Eckelmann
@ 2012-02-07  8:12 ` Marek Lindner
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2012-02-07  8:12 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Tuesday, February 07, 2012 06:11:53 Sven Eckelmann wrote:
> The blaII code removed references to two functions outside of the own
> source file. route_unicast_packet can be marked as static since
> 9c11509d3bbf914060be1bcb4448ea69d571fcb9 and tt_global_del since
> 7c5289cb52a5cecaeeddc719cd52b50bb17263dd

Applied in revision befb4bc.

Thanks,
Marek

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

* [B.A.T.M.A.N.] [PATCH] batman-adv: Remove declaration of only locally used functions
@ 2012-02-06 22:11 Sven Eckelmann
  2012-02-07  8:12 ` Marek Lindner
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Eckelmann @ 2012-02-06 22:11 UTC (permalink / raw)
  To: b.a.t.m.a.n

The blaII code removed references to two functions outside of the own source
file. route_unicast_packet can be marked as static since
9c11509d3bbf914060be1bcb4448ea69d571fcb9 and tt_global_del since
7c5289cb52a5cecaeeddc719cd52b50bb17263dd

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 routing.c           |    5 ++++-
 routing.h           |    1 -
 translation-table.c |    7 ++++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/routing.c b/routing.c
index 4a0e265..7b7fcbe 100644
--- a/routing.c
+++ b/routing.c
@@ -31,6 +31,9 @@
 #include "unicast.h"
 #include "bridge_loop_avoidance.h"
 
+static int route_unicast_packet(struct sk_buff *skb,
+				struct hard_iface *recv_if);
+
 void slide_own_bcast_window(struct hard_iface *hard_iface)
 {
 	struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
@@ -806,7 +809,7 @@ static int check_unicast_packet(struct sk_buff *skb, int hdr_size)
 	return 0;
 }
 
-int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
+static int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
 {
 	struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
 	struct orig_node *orig_node = NULL;
diff --git a/routing.h b/routing.h
index 92ac100..3d729cb 100644
--- a/routing.h
+++ b/routing.h
@@ -25,7 +25,6 @@
 void slide_own_bcast_window(struct hard_iface *hard_iface);
 void update_route(struct bat_priv *bat_priv, struct orig_node *orig_node,
 		  struct neigh_node *neigh_node);
-int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if);
 int recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if);
 int recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if);
 int recv_ucast_frag_packet(struct sk_buff *skb, struct hard_iface *recv_if);
diff --git a/translation-table.c b/translation-table.c
index 295d4b3..9a07882 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -816,9 +816,10 @@ static void tt_global_del_roaming(struct bat_priv *bat_priv,
 
 
 
-void tt_global_del(struct bat_priv *bat_priv,
-		   struct orig_node *orig_node, const unsigned char *addr,
-		   const char *message, bool roaming)
+static void tt_global_del(struct bat_priv *bat_priv,
+			  struct orig_node *orig_node,
+			  const unsigned char *addr,
+			  const char *message, bool roaming)
 {
 	struct tt_global_entry *tt_global_entry = NULL;
 	struct tt_local_entry *tt_local_entry = NULL;
-- 
1.7.8.3


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

end of thread, other threads:[~2012-02-07  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-05 17:55 [B.A.T.M.A.N.] [PATCH] batman-adv: Remove declaration of only locally used functions Sven Eckelmann
2012-02-06 14:42 ` Marek Lindner
2012-02-06 22:11 Sven Eckelmann
2012-02-07  8:12 ` Marek Lindner

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