diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2019-10-25 21:57:41 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2019-10-25 21:57:41 +0100 |
| commit | 856bd2c28e108ad0eb909bbbf3774f6f8bd7c2d4 (patch) | |
| tree | efe388ca2b6587ebabcf55751f556dab2214c737 /util/qemu-coroutine-io.c | |
| parent | ee70fc26a5615e4f97c1443a39f4625899b42c4c (diff) | |
| parent | d154ef37ff885918fa3e512fd7a8e42870291667 (diff) | |
| download | focaccia-qemu-856bd2c28e108ad0eb909bbbf3774f6f8bd7c2d4.tar.gz focaccia-qemu-856bd2c28e108ad0eb909bbbf3774f6f8bd7c2d4.zip | |
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Pull request # gpg: Signature made Fri 25 Oct 2019 20:18:23 BST # gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full] # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full] # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/block-pull-request: yield_until_fd_readable: make it work with any AioContect virtio-blk: Add blk_drain() to virtio_blk_device_unrealize() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util/qemu-coroutine-io.c')
| -rw-r--r-- | util/qemu-coroutine-io.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/util/qemu-coroutine-io.c b/util/qemu-coroutine-io.c index 44a8969a69..5b80bb416f 100644 --- a/util/qemu-coroutine-io.c +++ b/util/qemu-coroutine-io.c @@ -67,6 +67,7 @@ qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_send) } typedef struct { + AioContext *ctx; Coroutine *co; int fd; } FDYieldUntilData; @@ -74,7 +75,7 @@ typedef struct { static void fd_coroutine_enter(void *opaque) { FDYieldUntilData *data = opaque; - qemu_set_fd_handler(data->fd, NULL, NULL, NULL); + aio_set_fd_handler(data->ctx, data->fd, false, NULL, NULL, NULL, NULL); qemu_coroutine_enter(data->co); } @@ -83,8 +84,10 @@ void coroutine_fn yield_until_fd_readable(int fd) FDYieldUntilData data; assert(qemu_in_coroutine()); + data.ctx = qemu_get_current_aio_context(); data.co = qemu_coroutine_self(); data.fd = fd; - qemu_set_fd_handler(fd, fd_coroutine_enter, NULL, &data); + aio_set_fd_handler( + data.ctx, fd, false, fd_coroutine_enter, NULL, NULL, &data); qemu_coroutine_yield(); } |