Re: [PATCH] net: arp: code cleanup

Previous thread: skb allocation size question by Aaron Williams on Wednesday, September 1, 2010 - 11:51 am. (2 messages)

Next thread: [PATCH net-next] wan: make driver strings const by Stephen Hemminger on Wednesday, September 1, 2010 - 6:15 pm. (5 messages)
From: Changli Gao
Date: Wednesday, September 1, 2010 - 4:51 pm

Clean the code up according to Documentation/CodingStyle.

Don't initialize the variable dont_send in arp_process().

Remove the temporary varialbe flags in arp_state_to_flags().

Replace printk(KERN_DEBUG...) with pr_debug(...).

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
 1 file changed, 212 insertions(+), 228 deletions(-)
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 96c1955..cbb0e7c 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1,4 +1,5 @@
-/* linux/net/ipv4/arp.c
+/*
+ * linux/net/ipv4/arp.c
  *
  * Copyright (C) 1994 by Florian  La Roche
  *
@@ -55,7 +56,7 @@
  *		Stuart Cheshire	:	Metricom and grat arp fixes
  *					*** FOR 2.1 clean this up ***
  *		Lawrence V. Stefani: (08/12/96) Added FDDI support.
- *		Alan Cox 	:	Took the AP1000 nasty FDDI hack and
+ *		Alan Cox	:	Took the AP1000 nasty FDDI hack and
  *					folded into the mainstream FDDI code.
  *					Ack spit, Linus how did you allow that
  *					one in...
@@ -120,7 +121,7 @@ EXPORT_SYMBOL(clip_tbl_hook);
 #endif
 
 #include <asm/system.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/netfilter_arp.h>
 
@@ -173,32 +174,32 @@ const struct neigh_ops arp_broken_ops = {
 EXPORT_SYMBOL(arp_broken_ops);
 
 struct neigh_table arp_tbl = {
-	.family =	AF_INET,
-	.entry_size =	sizeof(struct neighbour) + 4,
-	.key_len =	4,
-	.hash =		arp_hash,
-	.constructor =	arp_constructor,
-	.proxy_redo =	parp_redo,
-	.id =		"arp_cache",
-	.parms = {
-		.tbl =			&arp_tbl,
-		.base_reachable_time =	30 * HZ,
-		.retrans_time =	1 * HZ,
-		.gc_staletime =	60 * HZ,
-		.reachable_time =		30 * HZ,
-		.delay_probe_time =	5 * HZ,
-		.queue_len =		3,
-		.ucast_probes =	3,
-		.mcast_probes =	3,
-		.anycast_delay =	1 * HZ,
-		.proxy_delay =		(8 * HZ) / 10,
-		.proxy_qlen =		64,
-		.locktime =		1 * HZ,
+	.family		= AF_INET,
+	.entry_size	= sizeof(struct neighbour) + 4,
+	.key_len	= 4,
+	.hash		= arp_hash,
+	.constructor	= arp_constructor,
+	.proxy_redo	= ...
From: David Miller
Date: Wednesday, September 1, 2010 - 5:57 pm

From: Changli Gao <xiaosuo@gmail.com>

I do not condone comments being written this way, it wastes precious
vertical space in one's terminal window.  They should always be
written as:

	/* A comment
	 * looks like this.
	 */

in any patch you want me to apply in the networking.

And what really angers me when people touch things like that is

you go and apply COMPLETELY INCONSISTENT changes to other comemnts.

Leave the comments alone, thanks.
--

From: Changli Gao
Date: Wednesday, September 1, 2010 - 6:28 pm

Do you mean that all the multi-line comments should be written as you
said above or I should not touch any comment? Thanks.

-- 
Regards,
Changli Gao(xiaosuo@gmail.com)
--

From: David Miller
Date: Wednesday, September 1, 2010 - 6:33 pm

From: Changli Gao <xiaosuo@gmail.com>

Let us start slowly and try your patch without the comment changes,
then we can work on comments in a seperate patch if you like.

Thanks.
--

From: Joe Perches
Date: Wednesday, September 1, 2010 - 6:29 pm

/*
 * multiline comment
 * style 1
 */

vs

/* multiline comment
 * style 2
 */

Style 1 vs style 2 in drivers/net: (13600/13785)
Style 1 vs style 2 in net: (6801/5114)

Style 1 is recommended in Documentation/CodingStyle.


--

Previous thread: skb allocation size question by Aaron Williams on Wednesday, September 1, 2010 - 11:51 am. (2 messages)

Next thread: [PATCH net-next] wan: make driver strings const by Stephen Hemminger on Wednesday, September 1, 2010 - 6:15 pm. (5 messages)