aio: add errp argument to aio_context_setup()

When aio_context_new() -> aio_context_setup() fails at startup it
doesn't really matter whether errors are returned to the caller or the
process terminates immediately.

However, it is not acceptable to terminate when hotplugging --object
iothread at runtime. Refactor aio_context_setup() so that errors can be
propagated. The next commit will set errp when fdmon_io_uring_setup()
fails.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20251104022933.618123-10-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2025-11-03 21:29:27 -05:00 committed by Kevin Wolf
parent 3769b9abe9
commit 421dcc8023
4 changed files with 14 additions and 5 deletions

View file

@ -718,10 +718,13 @@ void qemu_set_current_aio_context(AioContext *ctx);
/**
* aio_context_setup:
* @ctx: the aio context
* @errp: error pointer
*
* Initialize the aio context.
*
* Returns: true on success, false otherwise
*/
void aio_context_setup(AioContext *ctx);
bool aio_context_setup(AioContext *ctx, Error **errp);
/**
* aio_context_destroy: