[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 11/16] main-loop: remove qemu_fd_register(), win32/slirp/socke
From: |
marcandre . lureau |
Subject: |
[PATCH v3 11/16] main-loop: remove qemu_fd_register(), win32/slirp/socket specific |
Date: |
Tue, 21 Feb 2023 16:47:56 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Open-code the socket registration where it's needed, to avoid
artificially used or unclear generic interface.
Furthermore, the following patches are going to make socket handling use
FD-only inside QEMU, but we need to handle win32 SOCKET from libslirp.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
include/qemu/main-loop.h | 2 --
net/slirp.c | 8 +++++++-
util/main-loop.c | 11 -----------
3 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
index c25f390696..b3e54e00bc 100644
--- a/include/qemu/main-loop.h
+++ b/include/qemu/main-loop.h
@@ -387,8 +387,6 @@ void qemu_cond_timedwait_iothread(QemuCond *cond, int ms);
/* internal interfaces */
-void qemu_fd_register(int fd);
-
#define qemu_bh_new(cb, opaque) \
qemu_bh_new_full((cb), (opaque), (stringify(cb)))
QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name);
diff --git a/net/slirp.c b/net/slirp.c
index 2ee3f1a0d7..0730a935ba 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -248,7 +248,13 @@ static void net_slirp_timer_mod(void *timer, int64_t
expire_timer,
static void net_slirp_register_poll_fd(int fd, void *opaque)
{
- qemu_fd_register(fd);
+#ifdef WIN32
+ AioContext *ctxt = qemu_get_aio_context();
+
+ qemu_socket_select(fd, event_notifier_get_handle(&ctxt->notifier),
+ FD_READ | FD_ACCEPT | FD_CLOSE |
+ FD_CONNECT | FD_WRITE | FD_OOB, NULL);
+#endif
}
static void net_slirp_unregister_poll_fd(int fd, void *opaque)
diff --git a/util/main-loop.c b/util/main-loop.c
index 16e837fb12..e180c85145 100644
--- a/util/main-loop.c
+++ b/util/main-loop.c
@@ -252,10 +252,6 @@ static int max_priority;
static int glib_pollfds_idx;
static int glib_n_poll_fds;
-void qemu_fd_register(int fd)
-{
-}
-
static void glib_pollfds_fill(int64_t *cur_timeout)
{
GMainContext *context = g_main_context_default();
@@ -414,13 +410,6 @@ void qemu_del_wait_object(HANDLE handle, WaitObjectFunc
*func, void *opaque)
}
}
-void qemu_fd_register(int fd)
-{
- qemu_socket_select(fd,
event_notifier_get_handle(&qemu_aio_context->notifier),
- FD_READ | FD_ACCEPT | FD_CLOSE |
- FD_CONNECT | FD_WRITE | FD_OOB, NULL);
-}
-
static int pollfds_fill(GArray *pollfds, fd_set *rfds, fd_set *wfds,
fd_set *xfds)
{
--
2.39.2
- [PATCH v3 04/16] tests: add test-error-report, (continued)
- [PATCH v3 04/16] tests: add test-error-report, marcandre . lureau, 2023/02/21
- [PATCH v3 05/16] error: add global &error_warn destination, marcandre . lureau, 2023/02/21
- [PATCH v3 06/16] win32/socket: introduce qemu_socket_select() helper, marcandre . lureau, 2023/02/21
- [PATCH v3 07/16] win32/socket: introduce qemu_socket_unselect() helper, marcandre . lureau, 2023/02/21
- [PATCH v3 08/16] aio: make aio_set_fd_poll() static to aio-posix.c, marcandre . lureau, 2023/02/21
- [PATCH v3 10/16] RFC: build-sys: add slirp.wrap, marcandre . lureau, 2023/02/21
- [PATCH v3 09/16] aio/win32: aio_set_fd_handler() only supports SOCKET, marcandre . lureau, 2023/02/21
- [PATCH v3 13/16] slirp: open-code qemu_socket_(un)select(), marcandre . lureau, 2023/02/21
- [PATCH v3 12/16] slirp: unregister the win32 SOCKET, marcandre . lureau, 2023/02/21
- [PATCH v3 11/16] main-loop: remove qemu_fd_register(), win32/slirp/socket specific,
marcandre . lureau <=
- [PATCH v3 14/16] win32: avoid mixing SOCKET and file descriptor space, marcandre . lureau, 2023/02/21
- [PATCH v3 15/16] os-posix: remove useless ioctlsocket() define, marcandre . lureau, 2023/02/21
- [PATCH v3 16/16] win32: replace closesocket() with close() wrapper, marcandre . lureau, 2023/02/21