]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commit
curl: implement .bdrv_detach/attach_aio_context()
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 8 May 2014 14:34:40 +0000 (16:34 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Wed, 4 Jun 2014 07:56:11 +0000 (09:56 +0200)
commit63f0f45f2e89b60ff8245fec81328ddfde42a303
treee9714eac2db7033fd2320496ee9100f0cdf849a3
parent9d94020bc65485fe03a4acabd8559b682b193d07
curl: implement .bdrv_detach/attach_aio_context()

The curl block driver uses fd handlers, timers, and BHs.  The fd
handlers and timers are managed on behalf of libcurl, which controls
them using callback functions that the block driver implements.

The simplest way to implement .bdrv_detach/attach_aio_context() is to
clean up libcurl in the old event loop and initialize it again in the
new event loop.  We do not need to keep track of anything since there
are no pending requests when the AioContext is changed.

Also make sure to use aio_set_fd_handler() instead of
qemu_aio_set_fd_handler() and aio_bh_new() instead of qemu_bh_new() so
the current AioContext is passed in.

Cc: Alexander Graf <agraf@suse.de>
Cc: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
block/curl.c