public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] Dead code cleanup
@ 2011-01-27 13:56 Sven Eckelmann
  2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Remove dangling declaration of hash_remove_element Sven Eckelmann
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Sven Eckelmann @ 2011-01-27 13:56 UTC (permalink / raw)
  To: b.a.t.m.a.n

Hi,

I started to go through the release todo and removed some dead code.

Best regards,
	Sven


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

* [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Remove dangling declaration of hash_remove_element
  2011-01-27 13:56 [B.A.T.M.A.N.] Dead code cleanup Sven Eckelmann
@ 2011-01-27 13:56 ` Sven Eckelmann
  2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Remove unused definitions Sven Eckelmann
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Sven Eckelmann @ 2011-01-27 13:56 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 batman-adv/hash.h |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/batman-adv/hash.h b/batman-adv/hash.h
index a975e07..c3939ab 100644
--- a/batman-adv/hash.h
+++ b/batman-adv/hash.h
@@ -51,11 +51,6 @@ struct hashtable_t {
 /* allocates and clears the hash */
 struct hashtable_t *hash_new(int size);
 
-/* remove element if you already found the element you want to delete and don't
- * need the overhead to find it again with hash_remove().  But usually, you
- * don't want to use this function, as it fiddles with hash-internals. */
-void *hash_remove_element(struct hashtable_t *hash, struct element_t *elem);
-
 /* free only the hashtable and the hash itself. */
 void hash_destroy(struct hashtable_t *hash);
 
-- 
1.7.2.3


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

* [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Remove unused definitions
  2011-01-27 13:56 [B.A.T.M.A.N.] Dead code cleanup Sven Eckelmann
  2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Remove dangling declaration of hash_remove_element Sven Eckelmann
@ 2011-01-27 13:56 ` Sven Eckelmann
  2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: Remove declaration of batman_skb_recv Sven Eckelmann
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Sven Eckelmann @ 2011-01-27 13:56 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 batman-adv/main.h |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/batman-adv/main.h b/batman-adv/main.h
index c239c97..b07968d 100644
--- a/batman-adv/main.h
+++ b/batman-adv/main.h
@@ -22,9 +22,6 @@
 #ifndef _NET_BATMAN_ADV_MAIN_H_
 #define _NET_BATMAN_ADV_MAIN_H_
 
-/* Kernel Programming */
-#define LINUX
-
 #define DRIVER_AUTHOR "Marek Lindner <lindner_marek@yahoo.de>, " \
 		      "Simon Wunderlich <siwu@hrz.tu-chemnitz.de>"
 #define DRIVER_DESC   "B.A.T.M.A.N. advanced"
@@ -54,7 +51,6 @@
 
 #define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE)
 
-#define PACKBUFF_SIZE 2000
 #define LOG_BUF_LEN 8192	  /* has to be a power of 2 */
 
 #define VIS_INTERVAL 5000	/* 5 seconds */
@@ -96,15 +92,11 @@
 #define DBG_ROUTES 2	/* route or hna added / changed / deleted */
 #define DBG_ALL 3
 
-#define LOG_BUF_LEN 8192          /* has to be a power of 2 */
-
 
 /*
  *  Vis
  */
 
-/* #define VIS_SUBCLUSTERS_DISABLED */
-
 /*
  * Kernel headers
  */
@@ -160,13 +152,6 @@ static inline void bat_dbg(char type __always_unused,
 }
 #endif
 
-#define bat_warning(net_dev, fmt, arg...)				\
-	do {								\
-		struct net_device *_netdev = (net_dev);                 \
-		struct bat_priv *_batpriv = netdev_priv(_netdev);       \
-		bat_dbg(DBG_ALL, _batpriv, fmt, ## arg);		\
-		pr_warning("%s: " fmt, _netdev->name, ## arg);		\
-	} while (0)
 #define bat_info(net_dev, fmt, arg...)					\
 	do {								\
 		struct net_device *_netdev = (net_dev);                 \
-- 
1.7.2.3


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

* [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: Remove declaration of batman_skb_recv
  2011-01-27 13:56 [B.A.T.M.A.N.] Dead code cleanup Sven Eckelmann
  2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Remove dangling declaration of hash_remove_element Sven Eckelmann
  2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Remove unused definitions Sven Eckelmann
@ 2011-01-27 13:56 ` Sven Eckelmann
  2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Remove unused variables Sven Eckelmann
  2011-01-28 20:25 ` [B.A.T.M.A.N.] Dead code cleanup Marek Lindner
  4 siblings, 0 replies; 7+ messages in thread
From: Sven Eckelmann @ 2011-01-27 13:56 UTC (permalink / raw)
  To: b.a.t.m.a.n

batman_skb_recv can be defined in hard-interface.c as static because it is
never used outside of that file.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 batman-adv/hard-interface.c |   11 +++++++++--
 batman-adv/hard-interface.h |    4 ----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/batman-adv/hard-interface.c b/batman-adv/hard-interface.c
index 3ab9a20..ee847e3 100644
--- a/batman-adv/hard-interface.c
+++ b/batman-adv/hard-interface.c
@@ -34,6 +34,12 @@
 /* protect update critical side of if_list - but not the content */
 static DEFINE_SPINLOCK(if_list_lock);
 
+
+static int batman_skb_recv(struct sk_buff *skb,
+			   struct net_device *dev,
+			   struct packet_type *ptype,
+			   struct net_device *orig_dev);
+
 static void hardif_free_rcu(struct rcu_head *rcu)
 {
 	struct batman_if *batman_if;
@@ -549,8 +555,9 @@ out:
 
 /* receive a packet with the batman ethertype coming on a hard
  * interface */
-int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
-	struct packet_type *ptype, struct net_device *orig_dev)
+static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
+			   struct packet_type *ptype,
+			   struct net_device *orig_dev)
 {
 	struct bat_priv *bat_priv;
 	struct batman_packet *batman_packet;
diff --git a/batman-adv/hard-interface.h b/batman-adv/hard-interface.h
index 30ec3b8..a42f5a4 100644
--- a/batman-adv/hard-interface.h
+++ b/batman-adv/hard-interface.h
@@ -35,10 +35,6 @@ struct batman_if *get_batman_if_by_netdev(struct net_device *net_dev);
 int hardif_enable_interface(struct batman_if *batman_if, char *iface_name);
 void hardif_disable_interface(struct batman_if *batman_if);
 void hardif_remove_interfaces(void);
-int batman_skb_recv(struct sk_buff *skb,
-				struct net_device *dev,
-				struct packet_type *ptype,
-				struct net_device *orig_dev);
 int hardif_min_mtu(struct net_device *soft_iface);
 void update_min_mtu(struct net_device *soft_iface);
 
-- 
1.7.2.3


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

* [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Remove unused variables
  2011-01-27 13:56 [B.A.T.M.A.N.] Dead code cleanup Sven Eckelmann
                   ` (2 preceding siblings ...)
  2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: Remove declaration of batman_skb_recv Sven Eckelmann
@ 2011-01-27 13:56 ` Sven Eckelmann
  2011-01-27 14:34   ` [B.A.T.M.A.N.] [PATCHv2 " Sven Eckelmann
  2011-01-28 20:25 ` [B.A.T.M.A.N.] Dead code cleanup Marek Lindner
  4 siblings, 1 reply; 7+ messages in thread
From: Sven Eckelmann @ 2011-01-27 13:56 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 batman-adv/bat_debugfs.c |    4 +---
 batman-adv/routing.c     |    7 -------
 2 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/batman-adv/bat_debugfs.c b/batman-adv/bat_debugfs.c
index 0ae81d0..d36d305 100644
--- a/batman-adv/bat_debugfs.c
+++ b/batman-adv/bat_debugfs.c
@@ -52,7 +52,6 @@ static void emit_log_char(struct debug_log *debug_log, char c)
 
 static int fdebug_log(struct debug_log *debug_log, char *fmt, ...)
 {
-	int printed_len;
 	va_list args;
 	static char debug_log_buf[256];
 	char *p;
@@ -62,8 +61,7 @@ static int fdebug_log(struct debug_log *debug_log, char *fmt, ...)
 
 	spin_lock_bh(&debug_log->lock);
 	va_start(args, fmt);
-	printed_len = vscnprintf(debug_log_buf, sizeof(debug_log_buf),
-				 fmt, args);
+	vscnprintf(debug_log_buf, sizeof(debug_log_buf), fmt, args);
 	va_end(args);
 
 	for (p = debug_log_buf; *p != 0; p++)
diff --git a/batman-adv/routing.c b/batman-adv/routing.c
index 6168648..936b5f8 100644
--- a/batman-adv/routing.c
+++ b/batman-adv/routing.c
@@ -866,11 +866,9 @@ static int recv_my_icmp_packet(struct bat_priv *bat_priv,
 	struct orig_node *orig_node = NULL;
 	struct neigh_node *neigh_node = NULL;
 	struct icmp_packet_rr *icmp_packet;
-	struct ethhdr *ethhdr;
 	int ret = NET_RX_DROP;
 
 	icmp_packet = (struct icmp_packet_rr *)skb->data;
-	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	/* add data to device queue */
 	if (icmp_packet->msg_type != ECHO_REQUEST) {
@@ -904,7 +902,6 @@ static int recv_my_icmp_packet(struct bat_priv *bat_priv,
 		goto out;
 
 	icmp_packet = (struct icmp_packet_rr *)skb->data;
-	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
 	memcpy(icmp_packet->orig,
@@ -932,11 +929,9 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
 	struct orig_node *orig_node = NULL;
 	struct neigh_node *neigh_node = NULL;
 	struct icmp_packet *icmp_packet;
-	struct ethhdr *ethhdr;
 	int ret = NET_RX_DROP;
 
 	icmp_packet = (struct icmp_packet *)skb->data;
-	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	/* send TTL exceeded if packet is an echo request (traceroute) */
 	if (icmp_packet->msg_type != ECHO_REQUEST) {
@@ -971,7 +966,6 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
 		goto out;
 
 	icmp_packet = (struct icmp_packet *)skb->data;
-	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
 	memcpy(icmp_packet->orig,
@@ -1068,7 +1062,6 @@ int recv_icmp_packet(struct sk_buff *skb, struct batman_if *recv_if)
 		goto out;
 
 	icmp_packet = (struct icmp_packet_rr *)skb->data;
-	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	/* decrement ttl */
 	icmp_packet->ttl--;
-- 
1.7.2.3


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

* [B.A.T.M.A.N.] [PATCHv2 4/4] batman-adv: Remove unused variables
  2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Remove unused variables Sven Eckelmann
@ 2011-01-27 14:34   ` Sven Eckelmann
  0 siblings, 0 replies; 7+ messages in thread
From: Sven Eckelmann @ 2011-01-27 14:34 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
Remove best_router_tq which is only in master, but not in next.

 batman-adv/bat_debugfs.c |    4 +---
 batman-adv/routing.c     |   10 ----------
 2 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/batman-adv/bat_debugfs.c b/batman-adv/bat_debugfs.c
index 0ae81d0..d36d305 100644
--- a/batman-adv/bat_debugfs.c
+++ b/batman-adv/bat_debugfs.c
@@ -52,7 +52,6 @@ static void emit_log_char(struct debug_log *debug_log, char c)
 
 static int fdebug_log(struct debug_log *debug_log, char *fmt, ...)
 {
-	int printed_len;
 	va_list args;
 	static char debug_log_buf[256];
 	char *p;
@@ -62,8 +61,7 @@ static int fdebug_log(struct debug_log *debug_log, char *fmt, ...)
 
 	spin_lock_bh(&debug_log->lock);
 	va_start(args, fmt);
-	printed_len = vscnprintf(debug_log_buf, sizeof(debug_log_buf),
-				 fmt, args);
+	vscnprintf(debug_log_buf, sizeof(debug_log_buf), fmt, args);
 	va_end(args);
 
 	for (p = debug_log_buf; *p != 0; p++)
diff --git a/batman-adv/routing.c b/batman-adv/routing.c
index 6168648..480c178 100644
--- a/batman-adv/routing.c
+++ b/batman-adv/routing.c
@@ -866,11 +866,9 @@ static int recv_my_icmp_packet(struct bat_priv *bat_priv,
 	struct orig_node *orig_node = NULL;
 	struct neigh_node *neigh_node = NULL;
 	struct icmp_packet_rr *icmp_packet;
-	struct ethhdr *ethhdr;
 	int ret = NET_RX_DROP;
 
 	icmp_packet = (struct icmp_packet_rr *)skb->data;
-	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	/* add data to device queue */
 	if (icmp_packet->msg_type != ECHO_REQUEST) {
@@ -904,7 +902,6 @@ static int recv_my_icmp_packet(struct bat_priv *bat_priv,
 		goto out;
 
 	icmp_packet = (struct icmp_packet_rr *)skb->data;
-	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
 	memcpy(icmp_packet->orig,
@@ -932,11 +929,9 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
 	struct orig_node *orig_node = NULL;
 	struct neigh_node *neigh_node = NULL;
 	struct icmp_packet *icmp_packet;
-	struct ethhdr *ethhdr;
 	int ret = NET_RX_DROP;
 
 	icmp_packet = (struct icmp_packet *)skb->data;
-	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	/* send TTL exceeded if packet is an echo request (traceroute) */
 	if (icmp_packet->msg_type != ECHO_REQUEST) {
@@ -971,7 +966,6 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
 		goto out;
 
 	icmp_packet = (struct icmp_packet *)skb->data;
-	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
 	memcpy(icmp_packet->orig,
@@ -1068,7 +1062,6 @@ int recv_icmp_packet(struct sk_buff *skb, struct batman_if *recv_if)
 		goto out;
 
 	icmp_packet = (struct icmp_packet_rr *)skb->data;
-	ethhdr = (struct ethhdr *)skb_mac_header(skb);
 
 	/* decrement ttl */
 	icmp_packet->ttl--;
@@ -1100,7 +1093,6 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
 	struct neigh_node *router, *first_candidate, *tmp_neigh_node;
 	static uint8_t zero_mac[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
 	int bonding_enabled;
-	int best_router_tq;
 
 	if (!orig_node)
 		return NULL;
@@ -1190,7 +1182,6 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
 		/* if bonding is disabled, use the best of the
 		 * remaining candidates which are not using
 		 * this interface. */
-		best_router_tq = 0;
 		list_for_each_entry_rcu(tmp_neigh_node,
 			&primary_orig_node->bond_list, bonding_list) {
 			if (!first_candidate)
@@ -1203,7 +1194,6 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
 				if ((!router) ||
 				(tmp_neigh_node->tq_avg > router->tq_avg)) {
 					router = tmp_neigh_node;
-					best_router_tq = 0;
 				}
 		}
 
-- 
1.7.2.3


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

* Re: [B.A.T.M.A.N.] Dead code cleanup
  2011-01-27 13:56 [B.A.T.M.A.N.] Dead code cleanup Sven Eckelmann
                   ` (3 preceding siblings ...)
  2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Remove unused variables Sven Eckelmann
@ 2011-01-28 20:25 ` Marek Lindner
  4 siblings, 0 replies; 7+ messages in thread
From: Marek Lindner @ 2011-01-28 20:25 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Thursday 27 January 2011 14:56:07 Sven Eckelmann wrote:
> I started to go through the release todo and removed some dead code.

Applied in revision 1918-1921.

Thanks,
Marek

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

end of thread, other threads:[~2011-01-28 20:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-27 13:56 [B.A.T.M.A.N.] Dead code cleanup Sven Eckelmann
2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Remove dangling declaration of hash_remove_element Sven Eckelmann
2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Remove unused definitions Sven Eckelmann
2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: Remove declaration of batman_skb_recv Sven Eckelmann
2011-01-27 13:56 ` [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Remove unused variables Sven Eckelmann
2011-01-27 14:34   ` [B.A.T.M.A.N.] [PATCHv2 " Sven Eckelmann
2011-01-28 20:25 ` [B.A.T.M.A.N.] Dead code cleanup Marek Lindner

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