On Mon, Oct 21, 2019 at 10:50:55AM +0200, Dietmar Maurer wrote:
> -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, (IOHandler *)qemu_coroutine_enter,
> +                       NULL, NULL, qemu_coroutine_self());

This cast is unsafe.  If qemu_coroutine_enter()'s prototype is changed
there will be no compiler warning that the prototypes are now
incompatible.

Please keep fd_coroutine_enter() so the code is type-safe.

Attachment: signature.asc
Description: PGP signature

Reply via email to