提交 6a8341b6 编写于 作者: H Harvey Harrison 提交者: David S. Miller

net: use the common ascii hex helpers

Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 697f8d03
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "h/smc.h" #include "h/smc.h"
#include "h/smt_p.h" #include "h/smt_p.h"
#include <linux/bitrev.h> #include <linux/bitrev.h>
#include <linux/kernel.h>
#define KERNEL #define KERNEL
#include "h/smtstate.h" #include "h/smtstate.h"
...@@ -1730,20 +1731,18 @@ void fddi_send_antc(struct s_smc *smc, struct fddi_addr *dest) ...@@ -1730,20 +1731,18 @@ void fddi_send_antc(struct s_smc *smc, struct fddi_addr *dest)
#endif #endif
#ifdef DEBUG #ifdef DEBUG
#define hextoasc(x) "0123456789abcdef"[x]
char *addr_to_string(struct fddi_addr *addr) char *addr_to_string(struct fddi_addr *addr)
{ {
int i ; int i ;
static char string[6*3] = "****" ; static char string[6*3] = "****" ;
for (i = 0 ; i < 6 ; i++) { for (i = 0 ; i < 6 ; i++) {
string[i*3] = hextoasc((addr->a[i]>>4)&0xf) ; string[i * 3] = hex_asc_hi(addr->a[i]);
string[i*3+1] = hextoasc((addr->a[i])&0xf) ; string[i * 3 + 1] = hex_asc_lo(addr->a[i]);
string[i*3+2] = ':' ; string[i * 3 + 2] = ':';
} }
string[5*3+2] = 0 ; string[5 * 3 + 2] = 0;
return(string) ; return(string);
} }
#endif #endif
......
...@@ -475,11 +475,10 @@ static void arp_print(struct arp_payload *payload) ...@@ -475,11 +475,10 @@ static void arp_print(struct arp_payload *payload)
#define HBUFFERLEN 30 #define HBUFFERLEN 30
char hbuffer[HBUFFERLEN]; char hbuffer[HBUFFERLEN];
int j,k; int j,k;
const char hexbuf[]= "0123456789abcdef";
for (k=0, j=0; k < HBUFFERLEN-3 && j < ETH_ALEN; j++) { for (k=0, j=0; k < HBUFFERLEN-3 && j < ETH_ALEN; j++) {
hbuffer[k++]=hexbuf[(payload->src_hw[j]>>4)&15]; hbuffer[k++] = hex_asc_hi(payload->src_hw[j]);
hbuffer[k++]=hexbuf[payload->src_hw[j]&15]; hbuffer[k++] = hex_asc_lo(payload->src_hw[j]);
hbuffer[k++]=':'; hbuffer[k++]=':';
} }
hbuffer[--k]='\0'; hbuffer[--k]='\0';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册