summary refs log tree commit diff stats
path: root/net/socket.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-04-25 17:33:47 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-05-03 15:53:20 +0400
commitff5927baa7ffb9c97873a071f6a8d85a3584182b (patch)
treefac232e795ec7f76ad8ca15a59a7d8b908e7a225 /net/socket.c
parentb2670d1f9976260191ebccecc822fea7114fd448 (diff)
downloadfocaccia-qemu-ff5927baa7ffb9c97873a071f6a8d85a3584182b.tar.gz
focaccia-qemu-ff5927baa7ffb9c97873a071f6a8d85a3584182b.zip
util: rename qemu_*block() socket functions
The qemu_*block() functions are meant to be be used with sockets (the
win32 implementation expects SOCKET)

Over time, those functions where used with Win32 SOCKET or
file-descriptors interchangeably. But for portability, they must only be
used with socket-like file-descriptors. FDs can use
g_unix_set_fd_nonblocking() instead.

Rename the functions with "socket" in the name to prevent bad usages.

This is effectively reverting commit f9e8cacc5557e43 ("oslib-posix:
rename socket_set_nonblock() to qemu_set_nonblock()").

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/socket.c b/net/socket.c
index ea5220a2eb..bfd8596250 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -297,7 +297,7 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr,
         }
     }
 
-    qemu_set_nonblock(fd);
+    qemu_socket_set_nonblock(fd);
     return fd;
 fail:
     if (fd >= 0)
@@ -522,7 +522,7 @@ static int net_socket_listen_init(NetClientState *peer,
         error_setg_errno(errp, errno, "can't create stream socket");
         return -1;
     }
-    qemu_set_nonblock(fd);
+    qemu_socket_set_nonblock(fd);
 
     socket_set_fast_reuse(fd);
 
@@ -570,7 +570,7 @@ static int net_socket_connect_init(NetClientState *peer,
         error_setg_errno(errp, errno, "can't create stream socket");
         return -1;
     }
-    qemu_set_nonblock(fd);
+    qemu_socket_set_nonblock(fd);
 
     connected = 0;
     for(;;) {
@@ -688,7 +688,7 @@ static int net_socket_udp_init(NetClientState *peer,
         closesocket(fd);
         return -1;
     }
-    qemu_set_nonblock(fd);
+    qemu_socket_set_nonblock(fd);
 
     s = net_socket_fd_init(peer, model, name, fd, 0, NULL, errp);
     if (!s) {
@@ -730,7 +730,7 @@ int net_init_socket(const Netdev *netdev, const char *name,
         if (fd == -1) {
             return -1;
         }
-        ret = qemu_try_set_nonblock(fd);
+        ret = qemu_socket_try_set_nonblock(fd);
         if (ret < 0) {
             error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d",
                              name, fd);