* [PATCH ] yield_until_fd_readable: make it work with any AioContect
@ 2019-10-20 13:56 Dietmar Maurer
2019-10-20 14:33 ` no-reply
0 siblings, 1 reply; 2+ messages in thread
From: Dietmar Maurer @ 2019-10-20 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: Dietmar Maurer, stefanha
Simply use qemu_get_current_aio_context().
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
util/qemu-coroutine-io.c | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/util/qemu-coroutine-io.c b/util/qemu-coroutine-io.c
index 44a8969a69..2938c5420c 100644
--- a/util/qemu-coroutine-io.c
+++ b/util/qemu-coroutine-io.c
@@ -66,25 +66,11 @@ qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_send)
return qemu_co_sendv_recvv(sockfd, &iov, 1, 0, bytes, do_send);
}
-typedef struct {
- Coroutine *co;
- int fd;
-} FDYieldUntilData;
-
-static void fd_coroutine_enter(void *opaque)
-{
- FDYieldUntilData *data = opaque;
- qemu_set_fd_handler(data->fd, NULL, NULL, NULL);
- qemu_coroutine_enter(data->co);
-}
-
void coroutine_fn yield_until_fd_readable(int fd)
{
- FDYieldUntilData data;
-
assert(qemu_in_coroutine());
- data.co = qemu_coroutine_self();
- data.fd = fd;
- qemu_set_fd_handler(fd, fd_coroutine_enter, NULL, &data);
+ AioContext *ctx = qemu_get_current_aio_context();
+ aio_set_fd_handler(ctx, fd, false, NULL, (void (*)(void *))qemu_coroutine_enter, NULL, qemu_coroutine_self());
qemu_coroutine_yield();
+ aio_set_fd_handler(ctx, fd, false, NULL, NULL, NULL, NULL);
}
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH ] yield_until_fd_readable: make it work with any AioContect
2019-10-20 13:56 [PATCH ] yield_until_fd_readable: make it work with any AioContect Dietmar Maurer
@ 2019-10-20 14:33 ` no-reply
0 siblings, 0 replies; 2+ messages in thread
From: no-reply @ 2019-10-20 14:33 UTC (permalink / raw)
To: dietmar; +Cc: qemu-devel, stefanha, dietmar
Patchew URL: https://patchew.org/QEMU/20191020135628.16255-1-dietmar@proxmox.com/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Subject: [PATCH ] yield_until_fd_readable: make it work with any AioContect
Type: series
Message-id: 20191020135628.16255-1-dietmar@proxmox.com
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
ead4b5f yield_until_fd_readable: make it work with any AioContect
=== OUTPUT BEGIN ===
ERROR: line over 90 characters
#41: FILE: util/qemu-coroutine-io.c:73:
+ aio_set_fd_handler(ctx, fd, false, NULL, (void (*)(void *))qemu_coroutine_enter, NULL, qemu_coroutine_self());
total: 1 errors, 0 warnings, 28 lines checked
Commit ead4b5fc8173 (yield_until_fd_readable: make it work with any AioContect) has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20191020135628.16255-1-dietmar@proxmox.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-20 14:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-20 13:56 [PATCH ] yield_until_fd_readable: make it work with any AioContect Dietmar Maurer
2019-10-20 14:33 ` no-reply
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).