Skip to contentSkip to conversation

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

PATCH Applied Denis Cheng 3 participants 9 messages May 18, 2008 – May 22, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

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.

---
 net/ipv4/arp.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
net/ipv4/arp.c +2 -3
index 418862f..f460fa0 100644
@@ -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;
Signature · 1 line
1.5.5.1
maintainer Applied
#1 lore raw

From: Denis Cheng <[email protected]>
Date: Mon, 19 May 2008 02:37:44 +0800

Quoted 10 lines

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.

Applied, thanks.

#2 lore raw
Quoted 8 lines · David Miller

From: Denis Cheng <[email protected]>
Date: Mon, 19 May 2008 02:37:44 +0800

Quoted 5 lines

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

Quoted 7 lines
Quoted 5 lines

const char hex_asc[] = "0123456789abcdef";

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

Applied, thanks.

You may want to use the hex_asc_hi, hex_asc_lo helpers to do the mask/shifts for you.

Harvey

maintainer
#3 lore raw

From: Harvey Harrison <[email protected]>
Date: Tue, 20 May 2008 15:40:12 -0700

Quoted 11 lines · David Miller
Quoted 10 lines

From: Denis Cheng <[email protected]>
Date: Mon, 19 May 2008 02:37:44 +0800

Quoted 7 lines

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

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

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

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.

author Acked-by David S. Miller
#4 lore raw
Quoted 1 line

From bc47e710a3ebd8a5989404f711a051b6516d01ed Mon Sep 17 00:00:00 2001

From: Denis Cheng <[email protected]>
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.

---
 net/ipv4/arp.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
net/ipv4/arp.c +2 -3
index 418862f..9b539fa 100644
@@ -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;
Signature · 1 line
1.5.4.3
maintainer Applied
#5 lore raw

From: "rae l" <[email protected]>
Date: Wed, 21 May 2008 10:27:41 +0800

Quoted 9 lines

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";
Quoted 6 lines

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.

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.

#6 lore raw
Quoted 16 lines · David Miller

From: "rae l" <[email protected]>
Date: Wed, 21 May 2008 10:27:41 +0800

Quoted 13 lines

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.

Quoted 8 lines
Quoted 2 lines

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

author
#7 lore raw
Quoted 10 lines · Harvey Harrison
Quoted 5 lines

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

Quoted 2 lines

Harvey

Signature · 1 line
Denis
#8 lore raw
In reply to David Miller

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

---
Something like this.

 net/ipv4/arp.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
net/ipv4/arp.c +2 -3
index 418862f..9b539fa 100644
@@ -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;
Signature · 1 line
1.5.5.1.570.g26b5e