[PATCH] net/ipv4/arp.c: Use the exported hex_asc from lib/hexdump.c instead

Subsystems: networking [general], networking [ipv4/ipv6], the rest

STALE6699d

9 messages, 3 authors, 2008-05-22 · open the first message on its own page

[PATCH] net/ipv4/arp.c: Use the exported hex_asc from lib/hexdump.c instead

From: Denis Cheng <hidden>
Date: 2008-05-18 18:39:56

Here the local hexbuf is a duplicate of global const char hex_asc from
lib/hexdump.c, except the hex letters' cases:

const char hexbuf[] = "0123456789ABCDEF";

const char hex_asc[] = "0123456789abcdef";

and here to print HW addresses, the hex cases are not significant.

Signed-off-by: Denis Cheng <redacted>
---
 net/ipv4/arp.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 418862f..f460fa0 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1288,7 +1288,6 @@ static void arp_format_neigh_entry(struct seq_file *seq,
 				   struct neighbour *n)
 {
 	char hbuffer[HBUFFERLEN];
-	const char hexbuf[] = "0123456789ABCDEF";
 	int k, j;
 	char tbuf[16];
 	struct net_device *dev = n->dev;
@@ -1302,8 +1301,8 @@ static void arp_format_neigh_entry(struct seq_file *seq,
 	else {
 #endif
 	for (k = 0, j = 0; k < HBUFFERLEN - 3 && j < dev->addr_len; j++) {
-		hbuffer[k++] = hexbuf[(n->ha[j] >> 4) & 15];
-		hbuffer[k++] = hexbuf[n->ha[j] & 15];
+		hbuffer[k++] = hex_asc[(n->ha[j] >> 4) & 15];
+		hbuffer[k++] = hex_asc[n->ha[j] & 15];
 		hbuffer[k++] = ':';
 	}
 	hbuffer[--k] = 0;
-- 
1.5.5.1

Re: [PATCH] net/ipv4/arp.c: Use the exported hex_asc from lib/hexdump.c instead

From: David Miller <davem@davemloft.net>
Date: 2008-05-20 22:40:29

From: Denis Cheng <redacted>
Date: Mon, 19 May 2008 02:37:44 +0800
Here the local hexbuf is a duplicate of global const char hex_asc from
lib/hexdump.c, except the hex letters' cases:

const char hexbuf[] = "0123456789ABCDEF";

const char hex_asc[] = "0123456789abcdef";

and here to print HW addresses, the hex cases are not significant.

Signed-off-by: Denis Cheng <redacted>
Applied, thanks.

Re: [PATCH] net/ipv4/arp.c: Use the exported hex_asc from lib/hexdump.c instead

From: Harvey Harrison <hidden>
Date: 2008-05-20 22:44:07

On Tue, 2008-05-20 at 15:36 -0700, David Miller wrote:
From: Denis Cheng <redacted>
Date: Mon, 19 May 2008 02:37:44 +0800
quoted
Here the local hexbuf is a duplicate of global const char hex_asc from
lib/hexdump.c, except the hex letters' cases:

const char hexbuf[] = "0123456789ABCDEF";

const char hex_asc[] = "0123456789abcdef";

and here to print HW addresses, the hex cases are not significant.

Signed-off-by: Denis Cheng <redacted>
Applied, thanks.
You may want to use the hex_asc_hi, hex_asc_lo helpers to do the
mask/shifts for you.

Harvey

Re: [PATCH] net/ipv4/arp.c: Use the exported hex_asc from lib/hexdump.c instead

From: Harvey Harrison <hidden>
Date: 2008-05-20 22:45:06

From: Harvey Harrison <redacted>
Subject: [PATCH] net: use common hex_asc helpers

Signed-off-by: Harvey Harrison <redacted>
---
Something like this.

 net/ipv4/arp.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 418862f..9b539fa 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1288,7 +1288,6 @@ static void arp_format_neigh_entry(struct seq_file *seq,
 				   struct neighbour *n)
 {
 	char hbuffer[HBUFFERLEN];
-	const char hexbuf[] = "0123456789ABCDEF";
 	int k, j;
 	char tbuf[16];
 	struct net_device *dev = n->dev;
@@ -1302,8 +1301,8 @@ static void arp_format_neigh_entry(struct seq_file *seq,
 	else {
 #endif
 	for (k = 0, j = 0; k < HBUFFERLEN - 3 && j < dev->addr_len; j++) {
-		hbuffer[k++] = hexbuf[(n->ha[j] >> 4) & 15];
-		hbuffer[k++] = hexbuf[n->ha[j] & 15];
+		hbuffer[k++] = hex_asc_hi(n->ha[j]);
+		hbuffer[k++] = hex_asc_lo(n->ha[j]);
 		hbuffer[k++] = ':';
 	}
 	hbuffer[--k] = 0;
-- 
1.5.5.1.570.g26b5e


Re: [PATCH] net/ipv4/arp.c: Use the exported hex_asc from lib/hexdump.c instead

From: David Miller <davem@davemloft.net>
Date: 2008-05-20 22:46:46

From: Harvey Harrison <redacted>
Date: Tue, 20 May 2008 15:40:12 -0700
On Tue, 2008-05-20 at 15:36 -0700, David Miller wrote:
quoted
From: Denis Cheng <redacted>
Date: Mon, 19 May 2008 02:37:44 +0800
quoted
Here the local hexbuf is a duplicate of global const char hex_asc from
lib/hexdump.c, except the hex letters' cases:

const char hexbuf[] = "0123456789ABCDEF";

const char hex_asc[] = "0123456789abcdef";

and here to print HW addresses, the hex cases are not significant.

Signed-off-by: Denis Cheng <redacted>
Applied, thanks.
You may want to use the hex_asc_hi, hex_asc_lo helpers to do the
mask/shifts for you.
Good idea, I'll revert, Denis can you generate a new patch?

Thanks.

Re: [PATCH] net/ipv4/arp.c: Use the exported hex_asc from lib/hexdump.c instead

From: rae l <hidden>
Date: 2008-05-21 02:27:53

From bc47e710a3ebd8a5989404f711a051b6516d01ed Mon Sep 17 00:00:00 2001
From: Denis Cheng <redacted>
Date: Wed, 21 May 2008 09:43:32 +0800
Subject: [PATCH] net/ipv4/arp.c: Use common hex_asc helpers

Here the local hexbuf is a duplicate of global const char hex_asc from
lib/hexdump.c, except the hex letters' cases:

	const char hexbuf[] = "0123456789ABCDEF";

	const char hex_asc[] = "0123456789abcdef";

and here to print HW addresses, the hex cases are not significant.

Thanks to Harvey Harrison to introduce the hex_asc_hi/hex_asc_lo helpers.

Signed-off-by: Denis Cheng <redacted>
Signed-off-by: Harvey Harrison <redacted>
Acked-by: David S. Miller <davem@davemloft.net>
---
 net/ipv4/arp.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 418862f..9b539fa 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1288,7 +1288,6 @@ static void arp_format_neigh_entry(struct seq_file *seq,
 				   struct neighbour *n)
 {
 	char hbuffer[HBUFFERLEN];
-	const char hexbuf[] = "0123456789ABCDEF";
 	int k, j;
 	char tbuf[16];
 	struct net_device *dev = n->dev;
@@ -1302,8 +1301,8 @@ static void arp_format_neigh_entry(struct seq_file *seq,
 	else {
 #endif
 	for (k = 0, j = 0; k < HBUFFERLEN - 3 && j < dev->addr_len; j++) {
-		hbuffer[k++] = hexbuf[(n->ha[j] >> 4) & 15];
-		hbuffer[k++] = hexbuf[n->ha[j] & 15];
+		hbuffer[k++] = hex_asc_hi(n->ha[j]);
+		hbuffer[k++] = hex_asc_lo(n->ha[j]);
 		hbuffer[k++] = ':';
 	}
 	hbuffer[--k] = 0;
-- 
1.5.4.3

Re: [PATCH] net/ipv4/arp.c: Use the exported hex_asc from lib/hexdump.c instead

From: David Miller <davem@davemloft.net>
Date: 2008-05-22 00:35:47

From: "rae l" <redacted>
Date: Wed, 21 May 2008 10:27:41 +0800
net/ipv4/arp.c: Use common hex_asc helpers

Here the local hexbuf is a duplicate of global const char hex_asc from
lib/hexdump.c, except the hex letters' cases:

	const char hexbuf[] = "0123456789ABCDEF";

	const char hex_asc[] = "0123456789abcdef";

and here to print HW addresses, the hex cases are not significant.

Thanks to Harvey Harrison to introduce the hex_asc_hi/hex_asc_lo helpers.

Signed-off-by: Denis Cheng <redacted>
Signed-off-by: Harvey Harrison <redacted>
Applied, thanks.

Harvey I know you posted a nearly identical patch, I had
to choose one and he did credit you with the idea for the
updated patch, so I hope this is OK.

Thanks.

Re: [PATCH] net/ipv4/arp.c: Use the exported hex_asc from lib/hexdump.c instead

From: Harvey Harrison <hidden>
Date: 2008-05-22 00:37:59

On Wed, 2008-05-21 at 17:35 -0700, David Miller wrote:
From: "rae l" <redacted>
Date: Wed, 21 May 2008 10:27:41 +0800
quoted
net/ipv4/arp.c: Use common hex_asc helpers

Here the local hexbuf is a duplicate of global const char hex_asc from
lib/hexdump.c, except the hex letters' cases:

	const char hexbuf[] = "0123456789ABCDEF";

	const char hex_asc[] = "0123456789abcdef";

and here to print HW addresses, the hex cases are not significant.

Thanks to Harvey Harrison to introduce the hex_asc_hi/hex_asc_lo helpers.

Signed-off-by: Denis Cheng <redacted>
Signed-off-by: Harvey Harrison <redacted>
Applied, thanks.

Harvey I know you posted a nearly identical patch, I had
to choose one and he did credit you with the idea for the
updated patch, so I hope this is OK.
His had the better changelog, I just sent mine to make my point clear
what the patch could look like.

No problems here.

Harvey

Re: [PATCH] net/ipv4/arp.c: Use the exported hex_asc from lib/hexdump.c instead

From: rae l <hidden>
Date: 2008-05-22 01:04:50

On Thu, May 22, 2008 at 8:37 AM, Harvey Harrison
[off-list ref] wrote:
quoted
Applied, thanks.

Harvey I know you posted a nearly identical patch, I had
to choose one and he did credit you with the idea for the
updated patch, so I hope this is OK.
His had the better changelog, I just sent mine to make my point clear
what the patch could look like.

No problems here.
Also thanks to all you guy. :-)
Harvey
-- 
Denis
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help