OSDN Git Service

util: remove the net/net.h dependency
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 24 Feb 2022 11:11:39 +0000 (15:11 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 22 Mar 2022 10:46:17 +0000 (14:46 +0400)
Move qemu_ether_ntoa() which is only needed in net/.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
include/qemu-common.h
net/announce.c
util/cutils.c

index 19e254d..f0fe07c 100644 (file)
@@ -108,7 +108,6 @@ void qemu_hexdump(FILE *fp, const char *prefix,
  */
 int parse_debug_env(const char *name, int max, int initial);
 
-const char *qemu_ether_ntoa(const MACAddr *mac);
 void page_size_init(void);
 
 /* returns non-zero if dump is in progress, otherwise zero is
index 26f057f..3b9e2f1 100644 (file)
@@ -120,6 +120,19 @@ static int announce_self_create(uint8_t *buf,
     return 60; /* len (FCS will be added by hardware) */
 }
 
+/*
+ * Helper to print ethernet mac address
+ */
+static 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;
+}
+
 static void qemu_announce_self_iter(NICState *nic, void *opaque)
 {
     AnnounceTimer *timer = opaque;
index 5334613..0d475ec 100644 (file)
@@ -27,7 +27,6 @@
 #include <math.h>
 
 #include "qemu-common.h"
-#include "net/net.h"
 #include "qemu/ctype.h"
 #include "qemu/cutils.h"
 #include "qemu/error-report.h"
@@ -937,19 +936,6 @@ int parse_debug_env(const char *name, int max, int initial)
 }
 
 /*
- * 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;
-}
-
-/*
  * Return human readable string for size @val.
  * @val can be anything that uint64_t allows (no more than "16 EiB").
  * Use IEC binary units like KiB, MiB, and so forth.