yield_until_fd_readable: make it work with any AioContect
PATCH v2 1/1 yield_until_fd_readable: make it work with any AioContect
Simply use qemu_get_current_aio_context().
---
Changelog for v2:
- use correct read handler in aio_set_fd_handler (instead of write handler)
util/qemu-coroutine-io.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)
util/qemu-coroutine-io.c +3 -17
@@ -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, (void (*)(void *))qemu_coroutine_enter,NULL ,NULL ,qemu_coroutine_self ());qemu_coroutine_yield (); +aio_set_fd_handler (ctx, fd, false,NULL ,NULL ,NULL ,NULL ); }
Signature · 1 line
2.20.1
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [PATCH v2] yield_until_fd_readable: make it work with any AioContect
Type: series
Message-id: [email protected]
=== 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 ===
Switched to a new branch 'test'
5dabe8a 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, (void (*)(void *))qemu_coroutine_enter, NULL, NULL, qemu_coroutine_self());
total: 1 errors, 0 warnings, 28 lines checked
Commit 5dabe8a02051 (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/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]