From e7b794282264868d84b3d9a5da222b08a783d8fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Sat, 19 Feb 2022 01:34:50 +0400 Subject: Drop qemu_foo() socket API wrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The socket API wrappers were initially introduced in commit 00aa0040 ("Wrap recv to avoid warnings"), but made redundant with commit a2d96af4 ("osdep: add wrappers for socket functions") which fixes the win32 declarations and thus removed the earlier warnings. Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé --- util/osdep.c | 4 ++-- util/qemu-sockets.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'util') diff --git a/util/osdep.c b/util/osdep.c index 394804d..84575ec 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -39,7 +39,7 @@ static const char *hw_version = QEMU_HW_VERSION; int socket_set_cork(int fd, int v) { #if defined(SOL_TCP) && defined(TCP_CORK) - return qemu_setsockopt(fd, SOL_TCP, TCP_CORK, &v, sizeof(v)); + return setsockopt(fd, SOL_TCP, TCP_CORK, &v, sizeof(v)); #else return 0; #endif @@ -48,7 +48,7 @@ int socket_set_cork(int fd, int v) int socket_set_nodelay(int fd) { int v = 1; - return qemu_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v)); + return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v)); } int qemu_madvise(void *addr, size_t len, int advice) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 0585e7a..e8f45a7 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -97,7 +97,7 @@ bool fd_is_socket(int fd) { int optval; socklen_t optlen = sizeof(optval); - return !qemu_getsockopt(fd, SOL_SOCKET, SO_TYPE, &optval, &optlen); + return !getsockopt(fd, SOL_SOCKET, SO_TYPE, &optval, &optlen); } @@ -185,8 +185,8 @@ static int try_bind(int socket, InetSocketAddress *saddr, struct addrinfo *e) rebind: if (e->ai_family == PF_INET6) { - qemu_setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, &v6only, - sizeof(v6only)); + setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, &v6only, + sizeof(v6only)); } stat = bind(socket, e->ai_addr, e->ai_addrlen); @@ -483,8 +483,8 @@ int inet_connect_saddr(InetSocketAddress *saddr, Error **errp) if (saddr->keep_alive) { int val = 1; - int ret = qemu_setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, - &val, sizeof(val)); + int ret = setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, + &val, sizeof(val)); if (ret < 0) { error_setg_errno(errp, errno, "Unable to set KEEPALIVE"); -- cgit v1.1 From 5933dd9576e9be2053598f4fad88f2406d72a85c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 24 Feb 2022 14:57:16 +0400 Subject: util: remove needless includes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Reviewed-by: Richard Henderson --- util/cutils.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'util') diff --git a/util/cutils.c b/util/cutils.c index c9b91e7..5334613 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -27,8 +27,6 @@ #include #include "qemu-common.h" -#include "qemu/sockets.h" -#include "qemu/iov.h" #include "net/net.h" #include "qemu/ctype.h" #include "qemu/cutils.h" -- cgit v1.1 From 8a166615a49de80234aa14ae4e830b4a3cc9da6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 24 Feb 2022 15:11:39 +0400 Subject: util: remove the net/net.h dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move qemu_ether_ntoa() which is only needed in net/. Signed-off-by: Marc-André Lureau Reviewed-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé --- util/cutils.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'util') diff --git a/util/cutils.c b/util/cutils.c index 5334613..0d475ec 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -27,7 +27,6 @@ #include #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. -- cgit v1.1 From 336d354ba73f62099b1a931662694b23cb3d2b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 21 Feb 2022 14:11:47 +0400 Subject: error: use GLib to remember the program name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Reviewed-by: Markus Armbruster --- util/qemu-error.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'util') diff --git a/util/qemu-error.c b/util/qemu-error.c index 52a9e01..7769aee 100644 --- a/util/qemu-error.c +++ b/util/qemu-error.c @@ -146,22 +146,6 @@ void loc_set_file(const char *fname, int lno) } } -static const char *progname; - -/* - * Set the program name for error_print_loc(). - */ -static void error_set_progname(const char *argv0) -{ - const char *p = strrchr(argv0, '/'); - progname = p ? p + 1 : argv0; -} - -const char *error_get_progname(void) -{ - return progname; -} - /* * Print current location to current monitor if we have one, else to stderr. */ @@ -171,8 +155,8 @@ static void print_loc(void) int i; const char *const *argp; - if (!monitor_cur() && progname) { - fprintf(stderr, "%s:", progname); + if (!monitor_cur() && g_get_prgname()) { + fprintf(stderr, "%s:", g_get_prgname()); sep = " "; } switch (cur_loc->kind) { @@ -400,8 +384,10 @@ static void qemu_log_func(const gchar *log_domain, void error_init(const char *argv0) { + const char *p = strrchr(argv0, '/'); + /* Set the program name for error_print_loc(). */ - error_set_progname(argv0); + g_set_prgname(p ? p + 1 : argv0); /* * This sets up glib logging so libraries using it also print their logs -- cgit v1.1