From a1555559ab5bad24fcd1c56fd39284afad8f5af7 Mon Sep 17 00:00:00 2001 From: Isaac Lozano <109lozanoi@gmail.com> Date: Fri, 25 Mar 2016 03:42:15 -0700 Subject: util: Improved qemu_hexmap() to include an ascii dump of the buffer qemu_hexdump() in util/hexdump.c has been changed to give also include a ascii dump of the buffer. Also, calls to hex_dump() in net/net.c have been replaced with calls to qemu_hexdump(). This takes care of two misc BiteSized Tasks. Reviewed-by: Thomas Huth Reviewed-by: Gerd Hoffmann Signed-off-by: Isaac Lozano <109lozanoi@gmail.com> Signed-off-by: Jason Wang --- net/net.c | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'net') diff --git a/net/net.c b/net/net.c index 594c3b8..0bc42a1 100644 --- a/net/net.c +++ b/net/net.c @@ -81,34 +81,6 @@ int default_net = 1; /***********************************************************/ /* network device redirectors */ -#if defined(DEBUG_NET) -static void hex_dump(FILE *f, const uint8_t *buf, int size) -{ - int len, i, j, c; - - for(i=0;i 16) - len = 16; - fprintf(f, "%08x ", i); - for(j=0;j<16;j++) { - if (j < len) - fprintf(f, " %02x", buf[i+j]); - else - fprintf(f, " "); - } - fprintf(f, " "); - for(j=0;j '~') - c = '.'; - fprintf(f, "%c", c); - } - fprintf(f, "\n"); - } -} -#endif - static int get_str_sep(char *buf, int buf_size, const char **pp, int sep) { const char *p, *p1; @@ -664,7 +636,7 @@ static ssize_t qemu_send_packet_async_with_flags(NetClientState *sender, #ifdef DEBUG_NET printf("qemu_send_packet_async:\n"); - hex_dump(stdout, buf, size); + qemu_hexdump((const char *)buf, stdout, "net", size); #endif if (sender->link_down || !sender->peer) { -- cgit v1.1