diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-10-20 15:07:27 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-10-27 19:05:23 +0200 |
commit | 16a389dc9ecc05e9d8d6ebd3eff6dc98158523e0 (patch) | |
tree | 14975d3b373c2269a84f79cf6c1f58e23ca1f1ca /block | |
parent | 61b2450414ee052c8f2561e999852fad0534899e (diff) | |
download | qemu-16a389dc9ecc05e9d8d6ebd3eff6dc98158523e0.zip qemu-16a389dc9ecc05e9d8d6ebd3eff6dc98158523e0.tar.gz qemu-16a389dc9ecc05e9d8d6ebd3eff6dc98158523e0.tar.bz2 |
block: Introduce .bdrv_co_ioctl() driver callback
This allows drivers to implement ioctls in a coroutine-based way.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/io.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -2502,17 +2502,21 @@ int bdrv_co_ioctl(BlockDriverState *bs, int req, void *buf) BlockAIOCB *acb; tracked_request_begin(&tracked_req, bs, 0, 0, BDRV_TRACKED_IOCTL); - if (!drv || !drv->bdrv_aio_ioctl) { + if (!drv || (!drv->bdrv_aio_ioctl && !drv->bdrv_co_ioctl)) { co.ret = -ENOTSUP; goto out; } - acb = drv->bdrv_aio_ioctl(bs, req, buf, bdrv_co_io_em_complete, &co); - if (!acb) { - co.ret = -ENOTSUP; - goto out; + if (drv->bdrv_co_ioctl) { + co.ret = drv->bdrv_co_ioctl(bs, req, buf); + } else { + acb = drv->bdrv_aio_ioctl(bs, req, buf, bdrv_co_io_em_complete, &co); + if (!acb) { + co.ret = -ENOTSUP; + goto out; + } + qemu_coroutine_yield(); } - qemu_coroutine_yield(); out: tracked_request_end(&tracked_req); return co.ret; |