qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	Amit Shah <amit.shah@redhat.com>,
	Juan Quintela <quintela@redhat.com>
Subject: [Qemu-devel] [PATCH v4 1/4] util: add qemu_ether_ntoa
Date: Tue, 11 Mar 2014 10:42:26 +1100	[thread overview]
Message-ID: <1394494949-9306-2-git-send-email-aik@ozlabs.ru> (raw)
In-Reply-To: <1394494949-9306-1-git-send-email-aik@ozlabs.ru>

This adds a helper to format ethernet MAC address.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 include/qemu-common.h |  2 ++
 util/cutils.c         | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/qemu-common.h b/include/qemu-common.h
index c8a58a8..a998e8d 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -472,4 +472,6 @@ size_t buffer_find_nonzero_offset(const void *buf, size_t len);
  */
 int parse_debug_env(const char *name, int max, int initial);
 
+const char *qemu_ether_ntoa(const MACAddr *mac);
+
 #endif
diff --git a/util/cutils.c b/util/cutils.c
index 0116fcd..b337293 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -27,6 +27,7 @@
 
 #include "qemu/sockets.h"
 #include "qemu/iov.h"
+#include "net/net.h"
 
 void strpadcpy(char *buf, int buf_size, const char *str, char pad)
 {
@@ -530,3 +531,16 @@ int parse_debug_env(const char *name, int max, int initial)
     }
     return debug;
 }
+
+/*
+ * Helper to print ethernet mac address
+ */
+const char *qemu_ether_ntoa(const MACAddr *mac)
+{
+    static char ret[18];
+
+    snprintf(ret, sizeof(ret), "%02x:%02x:%02x:%02x:%02x:%02x",
+             mac->a[0], mac->a[1], mac->a[2], mac->a[3], mac->a[4], mac->a[5]);
+
+    return ret;
+}
-- 
1.8.4.rc4

  reply	other threads:[~2014-03-10 23:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-10 23:42 [Qemu-devel] [PATCH v4 0/4] migration: add more traces Alexey Kardashevskiy
2014-03-10 23:42 ` Alexey Kardashevskiy [this message]
2014-03-11 19:36   ` [Qemu-devel] [PATCH v4 1/4] util: add qemu_ether_ntoa Juan Quintela
2014-03-27  3:43     ` Alexey Kardashevskiy
2014-03-27 10:50       ` Amit Shah
2014-03-27 11:17         ` Alexey Kardashevskiy
2014-03-10 23:42 ` [Qemu-devel] [PATCH v4 2/4] vl: add system_wakeup_request tracepoint Alexey Kardashevskiy
2014-03-11 19:38   ` Juan Quintela
2014-03-10 23:42 ` [Qemu-devel] [PATCH v4 3/4] migration: extend section_start/end traces Alexey Kardashevskiy
2014-03-11 19:38   ` Juan Quintela
2014-03-10 23:42 ` [Qemu-devel] [PATCH v4 4/4] migration: add more traces Alexey Kardashevskiy
2014-03-11 19:38   ` Juan Quintela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394494949-9306-2-git-send-email-aik@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=amit.shah@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).