I'll use BlockDriverAIOCB with block backends shortly, and the name is going to fit badly there. It's a block layer thing anyway, not just a block driver thing.
Signed-off-by: Markus Armbruster <arm...@redhat.com> --- block-migration.c | 2 +- block.c | 151 ++++++++++++++++++++++---------------------- block/archipelago.c | 30 ++++----- block/backup.c | 2 +- block/blkdebug.c | 22 +++---- block/blkverify.c | 20 +++--- block/commit.c | 2 +- block/curl.c | 8 +-- block/iscsi.c | 8 +-- block/linux-aio.c | 8 +-- block/mirror.c | 6 +- block/qed-gencb.c | 4 +- block/qed-table.c | 10 +-- block/qed.c | 46 +++++++------- block/qed.h | 12 ++-- block/quorum.c | 38 +++++------ block/raw-aio.h | 8 +-- block/raw-posix.c | 32 +++++----- block/raw-win32.c | 16 ++--- block/raw_bsd.c | 8 +-- block/rbd.c | 58 ++++++++--------- block/sheepdog.c | 4 +- block/stream.c | 2 +- block/win32-aio.c | 8 +-- blockjob.c | 4 +- dma-helpers.c | 24 +++---- hw/block/nvme.h | 2 +- hw/ide/ahci.c | 2 +- hw/ide/ahci.h | 2 +- hw/ide/core.c | 12 ++-- hw/ide/internal.h | 12 ++-- hw/ide/macio.c | 2 +- hw/ide/pci.c | 2 +- hw/ide/pci.h | 2 +- hw/ppc/mac.h | 2 +- hw/scsi/scsi-generic.c | 2 +- include/block/aio.h | 12 ++-- include/block/block.h | 36 +++++------ include/block/block_int.h | 30 ++++----- include/block/blockjob.h | 4 +- include/block/thread-pool.h | 4 +- include/hw/scsi/scsi.h | 2 +- include/monitor/monitor.h | 4 +- include/sysemu/dma.h | 26 ++++---- monitor.c | 6 +- tests/test-thread-pool.c | 2 +- thread-pool.c | 8 +-- 47 files changed, 353 insertions(+), 354 deletions(-) diff --git a/block-migration.c b/block-migration.c index da30e93..08db01a 100644 --- a/block-migration.c +++ b/block-migration.c @@ -72,7 +72,7 @@ typedef struct BlkMigBlock { int nr_sectors; struct iovec iov; QEMUIOVector qiov; - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; /* Protected by block migration lock. */ int ret; diff --git a/block.c b/block.c index 34c8f8c..f71b87c 100644 --- a/block.c +++ b/block.c @@ -61,12 +61,12 @@ struct BdrvDirtyBitmap { #define COROUTINE_POOL_RESERVATION 64 /* number of coroutines to reserve */ static void bdrv_dev_change_media_cb(BlockDriverState *bs, bool load); -static BlockDriverAIOCB *bdrv_aio_readv_em(BlockDriverState *bs, +static BlockAIOCB *bdrv_aio_readv_em(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); -static BlockDriverAIOCB *bdrv_aio_writev_em(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque); +static BlockAIOCB *bdrv_aio_writev_em(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); + BlockCompletionFunc *cb, void *opaque); static int coroutine_fn bdrv_co_readv_em(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *iov); @@ -79,14 +79,14 @@ static int coroutine_fn bdrv_co_do_preadv(BlockDriverState *bs, static int coroutine_fn bdrv_co_do_pwritev(BlockDriverState *bs, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, BdrvRequestFlags flags); -static BlockDriverAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, - int nb_sectors, - BdrvRequestFlags flags, - BlockDriverCompletionFunc *cb, - void *opaque, - bool is_write); +static BlockAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, + int nb_sectors, + BdrvRequestFlags flags, + BlockCompletionFunc *cb, + void *opaque, + bool is_write); static void coroutine_fn bdrv_co_do_rw(void *opaque); static int coroutine_fn bdrv_co_do_write_zeroes(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BdrvRequestFlags flags); @@ -4383,9 +4383,9 @@ int bdrv_get_backing_file_depth(BlockDriverState *bs) /**************************************************************/ /* async I/Os */ -BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, - QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) +BlockAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, + QEMUIOVector *qiov, int nb_sectors, + BlockCompletionFunc *cb, void *opaque) { trace_bdrv_aio_readv(bs, sector_num, nb_sectors, opaque); @@ -4393,9 +4393,9 @@ BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, cb, opaque, false); } -BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, - QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) +BlockAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, + QEMUIOVector *qiov, int nb_sectors, + BlockCompletionFunc *cb, void *opaque) { trace_bdrv_aio_writev(bs, sector_num, nb_sectors, opaque); @@ -4403,9 +4403,9 @@ BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, cb, opaque, true); } -BlockDriverAIOCB *bdrv_aio_write_zeroes(BlockDriverState *bs, +BlockAIOCB *bdrv_aio_write_zeroes(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BdrvRequestFlags flags, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { trace_bdrv_aio_write_zeroes(bs, sector_num, nb_sectors, flags, opaque); @@ -4420,7 +4420,7 @@ typedef struct MultiwriteCB { int num_requests; int num_callbacks; struct { - BlockDriverCompletionFunc *cb; + BlockCompletionFunc *cb; void *opaque; QEMUIOVector *free_qiov; } callbacks[]; @@ -4597,7 +4597,7 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, int num_reqs) return 0; } -void bdrv_aio_cancel(BlockDriverAIOCB *acb) +void bdrv_aio_cancel(BlockAIOCB *acb) { acb->aiocb_info->cancel(acb); } @@ -4605,33 +4605,32 @@ void bdrv_aio_cancel(BlockDriverAIOCB *acb) /**************************************************************/ /* async block device emulation */ -typedef struct BlockDriverAIOCBSync { - BlockDriverAIOCB common; +typedef struct BlockAIOCBSync { + BlockAIOCB common; QEMUBH *bh; int ret; /* vector translation state */ QEMUIOVector *qiov; uint8_t *bounce; int is_write; -} BlockDriverAIOCBSync; +} BlockAIOCBSync; -static void bdrv_aio_cancel_em(BlockDriverAIOCB *blockacb) +static void bdrv_aio_cancel_em(BlockAIOCB *blockacb) { - BlockDriverAIOCBSync *acb = - container_of(blockacb, BlockDriverAIOCBSync, common); + BlockAIOCBSync *acb = container_of(blockacb, BlockAIOCBSync, common); qemu_bh_delete(acb->bh); acb->bh = NULL; qemu_aio_release(acb); } static const AIOCBInfo bdrv_em_aiocb_info = { - .aiocb_size = sizeof(BlockDriverAIOCBSync), + .aiocb_size = sizeof(BlockAIOCBSync), .cancel = bdrv_aio_cancel_em, }; static void bdrv_aio_bh_cb(void *opaque) { - BlockDriverAIOCBSync *acb = opaque; + BlockAIOCBSync *acb = opaque; if (!acb->is_write && acb->ret >= 0) { qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size); @@ -4643,16 +4642,16 @@ static void bdrv_aio_bh_cb(void *opaque) qemu_aio_release(acb); } -static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, - int nb_sectors, - BlockDriverCompletionFunc *cb, - void *opaque, - int is_write) +static BlockAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, + int nb_sectors, + BlockCompletionFunc *cb, + void *opaque, + int is_write) { - BlockDriverAIOCBSync *acb; + BlockAIOCBSync *acb; acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque); acb->is_write = is_write; @@ -4674,34 +4673,34 @@ static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs, return &acb->common; } -static BlockDriverAIOCB *bdrv_aio_readv_em(BlockDriverState *bs, +static BlockAIOCB *bdrv_aio_readv_em(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { return bdrv_aio_rw_vector(bs, sector_num, qiov, nb_sectors, cb, opaque, 0); } -static BlockDriverAIOCB *bdrv_aio_writev_em(BlockDriverState *bs, +static BlockAIOCB *bdrv_aio_writev_em(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { return bdrv_aio_rw_vector(bs, sector_num, qiov, nb_sectors, cb, opaque, 1); } -typedef struct BlockDriverAIOCBCoroutine { - BlockDriverAIOCB common; +typedef struct BlockAIOCBCoroutine { + BlockAIOCB common; BlockRequest req; bool is_write; bool *done; QEMUBH* bh; -} BlockDriverAIOCBCoroutine; +} BlockAIOCBCoroutine; -static void bdrv_aio_co_cancel_em(BlockDriverAIOCB *blockacb) +static void bdrv_aio_co_cancel_em(BlockAIOCB *blockacb) { AioContext *aio_context = bdrv_get_aio_context(blockacb->bs); - BlockDriverAIOCBCoroutine *acb = - container_of(blockacb, BlockDriverAIOCBCoroutine, common); + BlockAIOCBCoroutine *acb = + container_of(blockacb, BlockAIOCBCoroutine, common); bool done = false; acb->done = &done; @@ -4711,13 +4710,13 @@ static void bdrv_aio_co_cancel_em(BlockDriverAIOCB *blockacb) } static const AIOCBInfo bdrv_em_co_aiocb_info = { - .aiocb_size = sizeof(BlockDriverAIOCBCoroutine), + .aiocb_size = sizeof(BlockAIOCBCoroutine), .cancel = bdrv_aio_co_cancel_em, }; static void bdrv_co_em_bh(void *opaque) { - BlockDriverAIOCBCoroutine *acb = opaque; + BlockAIOCBCoroutine *acb = opaque; acb->common.cb(acb->common.opaque, acb->req.error); @@ -4732,7 +4731,7 @@ static void bdrv_co_em_bh(void *opaque) /* Invoke bdrv_co_do_readv/bdrv_co_do_writev */ static void coroutine_fn bdrv_co_do_rw(void *opaque) { - BlockDriverAIOCBCoroutine *acb = opaque; + BlockAIOCBCoroutine *acb = opaque; BlockDriverState *bs = acb->common.bs; if (!acb->is_write) { @@ -4747,17 +4746,17 @@ static void coroutine_fn bdrv_co_do_rw(void *opaque) qemu_bh_schedule(acb->bh); } -static BlockDriverAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, - int nb_sectors, - BdrvRequestFlags flags, - BlockDriverCompletionFunc *cb, - void *opaque, - bool is_write) +static BlockAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, + int nb_sectors, + BdrvRequestFlags flags, + BlockCompletionFunc *cb, + void *opaque, + bool is_write) { Coroutine *co; - BlockDriverAIOCBCoroutine *acb; + BlockAIOCBCoroutine *acb; acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->req.sector = sector_num; @@ -4775,7 +4774,7 @@ static BlockDriverAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs, static void coroutine_fn bdrv_aio_flush_co_entry(void *opaque) { - BlockDriverAIOCBCoroutine *acb = opaque; + BlockAIOCBCoroutine *acb = opaque; BlockDriverState *bs = acb->common.bs; acb->req.error = bdrv_co_flush(bs); @@ -4783,13 +4782,13 @@ static void coroutine_fn bdrv_aio_flush_co_entry(void *opaque) qemu_bh_schedule(acb->bh); } -BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque) +BlockAIOCB *bdrv_aio_flush(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque) { trace_bdrv_aio_flush(bs, opaque); Coroutine *co; - BlockDriverAIOCBCoroutine *acb; + BlockAIOCBCoroutine *acb; acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->done = NULL; @@ -4802,7 +4801,7 @@ BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, static void coroutine_fn bdrv_aio_discard_co_entry(void *opaque) { - BlockDriverAIOCBCoroutine *acb = opaque; + BlockAIOCBCoroutine *acb = opaque; BlockDriverState *bs = acb->common.bs; acb->req.error = bdrv_co_discard(bs, acb->req.sector, acb->req.nb_sectors); @@ -4810,12 +4809,12 @@ static void coroutine_fn bdrv_aio_discard_co_entry(void *opaque) qemu_bh_schedule(acb->bh); } -BlockDriverAIOCB *bdrv_aio_discard(BlockDriverState *bs, +BlockAIOCB *bdrv_aio_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { Coroutine *co; - BlockDriverAIOCBCoroutine *acb; + BlockAIOCBCoroutine *acb; trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque); @@ -4841,9 +4840,9 @@ void bdrv_init_with_whitelist(void) } void *qemu_aio_get(const AIOCBInfo *aiocb_info, BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { - BlockDriverAIOCB *acb; + BlockAIOCB *acb; acb = g_slice_alloc(aiocb_info->aiocb_size); acb->aiocb_info = aiocb_info; @@ -4855,7 +4854,7 @@ void *qemu_aio_get(const AIOCBInfo *aiocb_info, BlockDriverState *bs, void qemu_aio_release(void *p) { - BlockDriverAIOCB *acb = p; + BlockAIOCB *acb = p; g_slice_free1(acb->aiocb_info->aiocb_size, acb); } @@ -4882,7 +4881,7 @@ static int coroutine_fn bdrv_co_io_em(BlockDriverState *bs, int64_t sector_num, CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; - BlockDriverAIOCB *acb; + BlockAIOCB *acb; if (is_write) { acb = bs->drv->bdrv_aio_writev(bs, sector_num, iov, nb_sectors, @@ -4948,7 +4947,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs) if (bs->drv->bdrv_co_flush_to_disk) { ret = bs->drv->bdrv_co_flush_to_disk(bs); } else if (bs->drv->bdrv_aio_flush) { - BlockDriverAIOCB *acb; + BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; @@ -5131,7 +5130,7 @@ int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num, if (bs->drv->bdrv_co_discard) { ret = bs->drv->bdrv_co_discard(bs, sector_num, num); } else { - BlockDriverAIOCB *acb; + BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; @@ -5257,9 +5256,9 @@ int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) return -ENOTSUP; } -BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, +BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, unsigned long int req, void *buf, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { BlockDriver *drv = bs->drv; diff --git a/block/archipelago.c b/block/archipelago.c index 22a7daa..9bbae4e 100644 --- a/block/archipelago.c +++ b/block/archipelago.c @@ -87,7 +87,7 @@ typedef enum { } ARCHIPCmd; typedef struct ArchipelagoAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; struct BDRVArchipelagoState *s; QEMUIOVector *qiov; @@ -724,7 +724,7 @@ static int qemu_archipelago_create(const char *filename, return ret; } -static void qemu_archipelago_aio_cancel(BlockDriverAIOCB *blockacb) +static void qemu_archipelago_aio_cancel(BlockAIOCB *blockacb) { ArchipelagoAIOCB *aio_cb = (ArchipelagoAIOCB *) blockacb; aio_cb->cancelled = true; @@ -869,13 +869,13 @@ err_exit: return ret; } -static BlockDriverAIOCB *qemu_archipelago_aio_rw(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, - int nb_sectors, - BlockDriverCompletionFunc *cb, - void *opaque, - int op) +static BlockAIOCB *qemu_archipelago_aio_rw(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, + int nb_sectors, + BlockCompletionFunc *cb, + void *opaque, + int op) { ArchipelagoAIOCB *aio_cb; BDRVArchipelagoState *s = bs->opaque; @@ -908,17 +908,17 @@ err_exit: return NULL; } -static BlockDriverAIOCB *qemu_archipelago_aio_readv(BlockDriverState *bs, +static BlockAIOCB *qemu_archipelago_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { return qemu_archipelago_aio_rw(bs, sector_num, qiov, nb_sectors, cb, opaque, ARCHIP_OP_READ); } -static BlockDriverAIOCB *qemu_archipelago_aio_writev(BlockDriverState *bs, +static BlockAIOCB *qemu_archipelago_aio_writev(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { return qemu_archipelago_aio_rw(bs, sector_num, qiov, nb_sectors, cb, opaque, ARCHIP_OP_WRITE); @@ -1008,8 +1008,8 @@ static QemuOptsList qemu_archipelago_create_opts = { } }; -static BlockDriverAIOCB *qemu_archipelago_aio_flush(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque) +static BlockAIOCB *qemu_archipelago_aio_flush(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque) { return qemu_archipelago_aio_rw(bs, 0, NULL, 0, cb, opaque, ARCHIP_OP_FLUSH); diff --git a/block/backup.c b/block/backup.c index d0b0225..e334740 100644 --- a/block/backup.c +++ b/block/backup.c @@ -353,7 +353,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, MirrorSyncMode sync_mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, void *opaque, + BlockCompletionFunc *cb, void *opaque, Error **errp) { int64_t len; diff --git a/block/blkdebug.c b/block/blkdebug.c index 69b330e..008d3e3 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -41,7 +41,7 @@ typedef struct BDRVBlkdebugState { } BDRVBlkdebugState; typedef struct BlkdebugAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; int ret; } BlkdebugAIOCB; @@ -52,7 +52,7 @@ typedef struct BlkdebugSuspendedReq { QLIST_ENTRY(BlkdebugSuspendedReq) next; } BlkdebugSuspendedReq; -static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb); +static void blkdebug_aio_cancel(BlockAIOCB *blockacb); static const AIOCBInfo blkdebug_aiocb_info = { .aiocb_size = sizeof(BlkdebugAIOCB), @@ -450,7 +450,7 @@ static void error_callback_bh(void *opaque) qemu_aio_release(acb); } -static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb) +static void blkdebug_aio_cancel(BlockAIOCB *blockacb) { BlkdebugAIOCB *acb = container_of(blockacb, BlkdebugAIOCB, common); if (acb->bh) { @@ -460,8 +460,8 @@ static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb) qemu_aio_release(acb); } -static BlockDriverAIOCB *inject_error(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque, BlkdebugRule *rule) +static BlockAIOCB *inject_error(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque, BlkdebugRule *rule) { BDRVBlkdebugState *s = bs->opaque; int error = rule->options.inject.error; @@ -486,9 +486,9 @@ static BlockDriverAIOCB *inject_error(BlockDriverState *bs, return &acb->common; } -static BlockDriverAIOCB *blkdebug_aio_readv(BlockDriverState *bs, +static BlockAIOCB *blkdebug_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { BDRVBlkdebugState *s = bs->opaque; BlkdebugRule *rule = NULL; @@ -508,9 +508,9 @@ static BlockDriverAIOCB *blkdebug_aio_readv(BlockDriverState *bs, return bdrv_aio_readv(bs->file, sector_num, qiov, nb_sectors, cb, opaque); } -static BlockDriverAIOCB *blkdebug_aio_writev(BlockDriverState *bs, +static BlockAIOCB *blkdebug_aio_writev(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { BDRVBlkdebugState *s = bs->opaque; BlkdebugRule *rule = NULL; @@ -530,8 +530,8 @@ static BlockDriverAIOCB *blkdebug_aio_writev(BlockDriverState *bs, return bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, cb, opaque); } -static BlockDriverAIOCB *blkdebug_aio_flush(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque) +static BlockAIOCB *blkdebug_aio_flush(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque) { BDRVBlkdebugState *s = bs->opaque; BlkdebugRule *rule = NULL; diff --git a/block/blkverify.c b/block/blkverify.c index 163064c..d4553cc 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -19,7 +19,7 @@ typedef struct { typedef struct BlkverifyAIOCB BlkverifyAIOCB; struct BlkverifyAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; /* Request metadata */ @@ -38,7 +38,7 @@ struct BlkverifyAIOCB { void (*verify)(BlkverifyAIOCB *acb); }; -static void blkverify_aio_cancel(BlockDriverAIOCB *blockacb) +static void blkverify_aio_cancel(BlockAIOCB *blockacb) { BlkverifyAIOCB *acb = (BlkverifyAIOCB *)blockacb; AioContext *aio_context = bdrv_get_aio_context(blockacb->bs); @@ -180,7 +180,7 @@ static int64_t blkverify_getlength(BlockDriverState *bs) static BlkverifyAIOCB *blkverify_aio_get(BlockDriverState *bs, bool is_write, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque) { BlkverifyAIOCB *acb = qemu_aio_get(&blkverify_aiocb_info, bs, cb, opaque); @@ -248,9 +248,9 @@ static void blkverify_verify_readv(BlkverifyAIOCB *acb) } } -static BlockDriverAIOCB *blkverify_aio_readv(BlockDriverState *bs, +static BlockAIOCB *blkverify_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { BDRVBlkverifyState *s = bs->opaque; BlkverifyAIOCB *acb = blkverify_aio_get(bs, false, sector_num, qiov, @@ -268,9 +268,9 @@ static BlockDriverAIOCB *blkverify_aio_readv(BlockDriverState *bs, return &acb->common; } -static BlockDriverAIOCB *blkverify_aio_writev(BlockDriverState *bs, +static BlockAIOCB *blkverify_aio_writev(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { BDRVBlkverifyState *s = bs->opaque; BlkverifyAIOCB *acb = blkverify_aio_get(bs, true, sector_num, qiov, @@ -283,9 +283,9 @@ static BlockDriverAIOCB *blkverify_aio_writev(BlockDriverState *bs, return &acb->common; } -static BlockDriverAIOCB *blkverify_aio_flush(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, - void *opaque) +static BlockAIOCB *blkverify_aio_flush(BlockDriverState *bs, + BlockCompletionFunc *cb, + void *opaque) { BDRVBlkverifyState *s = bs->opaque; diff --git a/block/commit.c b/block/commit.c index 91517d3..60a2acc 100644 --- a/block/commit.c +++ b/block/commit.c @@ -182,7 +182,7 @@ static const BlockJobDriver commit_job_driver = { void commit_start(BlockDriverState *bs, BlockDriverState *base, BlockDriverState *top, int64_t speed, - BlockdevOnError on_error, BlockDriverCompletionFunc *cb, + BlockdevOnError on_error, BlockCompletionFunc *cb, void *opaque, const char *backing_file_str, Error **errp) { CommitBlockJob *s; diff --git a/block/curl.c b/block/curl.c index 938f9d9..5e96b05 100644 --- a/block/curl.c +++ b/block/curl.c @@ -78,7 +78,7 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle, struct BDRVCURLState; typedef struct CURLAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; QEMUIOVector *qiov; @@ -613,7 +613,7 @@ out_noclean: return -EINVAL; } -static void curl_aio_cancel(BlockDriverAIOCB *blockacb) +static void curl_aio_cancel(BlockAIOCB *blockacb) { // Do we have to implement canceling? Seems to work without... } @@ -686,9 +686,9 @@ static void curl_readv_bh_cb(void *p) curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running); } -static BlockDriverAIOCB *curl_aio_readv(BlockDriverState *bs, +static BlockAIOCB *curl_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { CURLAIOCB *acb; diff --git a/block/iscsi.c b/block/iscsi.c index af3d0f6..1a1a389 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -81,7 +81,7 @@ typedef struct IscsiTask { } IscsiTask; typedef struct IscsiAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUIOVector *qiov; QEMUBH *bh; IscsiLun *iscsilun; @@ -231,7 +231,7 @@ iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data, } static void -iscsi_aio_cancel(BlockDriverAIOCB *blockacb) +iscsi_aio_cancel(BlockAIOCB *blockacb) { IscsiAIOCB *acb = (IscsiAIOCB *)blockacb; IscsiLun *iscsilun = acb->iscsilun; @@ -669,9 +669,9 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status, iscsi_schedule_bh(acb); } -static BlockDriverAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, +static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, unsigned long int req, void *buf, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { IscsiLun *iscsilun = bs->opaque; struct iscsi_context *iscsi = iscsilun->iscsi; diff --git a/block/linux-aio.c b/block/linux-aio.c index 9aca758..2436140 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -28,7 +28,7 @@ #define MAX_QUEUED_IO 128 struct qemu_laiocb { - BlockDriverAIOCB common; + BlockAIOCB common; struct qemu_laio_state *ctx; struct iocb iocb; ssize_t ret; @@ -147,7 +147,7 @@ static void qemu_laio_completion_cb(EventNotifier *e) } } -static void laio_cancel(BlockDriverAIOCB *blockacb) +static void laio_cancel(BlockAIOCB *blockacb) { struct qemu_laiocb *laiocb = (struct qemu_laiocb *)blockacb; struct io_event event; @@ -257,9 +257,9 @@ int laio_io_unplug(BlockDriverState *bs, void *aio_ctx, bool unplug) return ret; } -BlockDriverAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd, +BlockAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque, int type) + BlockCompletionFunc *cb, void *opaque, int type) { struct qemu_laio_state *s = aio_ctx; struct qemu_laiocb *laiocb; diff --git a/block/mirror.c b/block/mirror.c index 829be2f..e8a43eb 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -613,7 +613,7 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target, int64_t buf_size, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp, const BlockJobDriver *driver, bool is_none_mode, BlockDriverState *base) @@ -673,7 +673,7 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, int64_t granularity, int64_t buf_size, MirrorSyncMode mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp) { bool is_none_mode; @@ -690,7 +690,7 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target, void commit_active_start(BlockDriverState *bs, BlockDriverState *base, int64_t speed, BlockdevOnError on_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp) { int64_t length, base_length; diff --git a/block/qed-gencb.c b/block/qed-gencb.c index 7d7ac1f..b817a8b 100644 --- a/block/qed-gencb.c +++ b/block/qed-gencb.c @@ -13,7 +13,7 @@ #include "qed.h" -void *gencb_alloc(size_t len, BlockDriverCompletionFunc *cb, void *opaque) +void *gencb_alloc(size_t len, BlockCompletionFunc *cb, void *opaque) { GenericCB *gencb = g_malloc(len); gencb->cb = cb; @@ -24,7 +24,7 @@ void *gencb_alloc(size_t len, BlockDriverCompletionFunc *cb, void *opaque) void gencb_complete(void *opaque, int ret) { GenericCB *gencb = opaque; - BlockDriverCompletionFunc *cb = gencb->cb; + BlockCompletionFunc *cb = gencb->cb; void *user_opaque = gencb->opaque; g_free(gencb); diff --git a/block/qed-table.c b/block/qed-table.c index f61107a..513aa87 100644 --- a/block/qed-table.c +++ b/block/qed-table.c @@ -49,7 +49,7 @@ out: } static void qed_read_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { QEDReadTableCB *read_table_cb = gencb_alloc(sizeof(*read_table_cb), cb, opaque); @@ -119,7 +119,7 @@ out: */ static void qed_write_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, unsigned int index, unsigned int n, bool flush, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { QEDWriteTableCB *write_table_cb; unsigned int sector_mask = BDRV_SECTOR_SIZE / sizeof(uint64_t) - 1; @@ -180,7 +180,7 @@ int qed_read_l1_table_sync(BDRVQEDState *s) } void qed_write_l1_table(BDRVQEDState *s, unsigned int index, unsigned int n, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { BLKDBG_EVENT(s->bs->file, BLKDBG_L1_UPDATE); qed_write_table(s, s->header.l1_table_offset, @@ -235,7 +235,7 @@ static void qed_read_l2_table_cb(void *opaque, int ret) } void qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, uint64_t offset, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { QEDReadL2TableCB *read_l2_table_cb; @@ -275,7 +275,7 @@ int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, uint64_t offset void qed_write_l2_table(BDRVQEDState *s, QEDRequest *request, unsigned int index, unsigned int n, bool flush, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { BLKDBG_EVENT(s->bs->file, BLKDBG_L2_UPDATE); qed_write_table(s, request->l2_table->offset, diff --git a/block/qed.c b/block/qed.c index f20ffb3..a0eafa9 100644 --- a/block/qed.c +++ b/block/qed.c @@ -18,7 +18,7 @@ #include "qapi/qmp/qerror.h" #include "migration/migration.h" -static void qed_aio_cancel(BlockDriverAIOCB *blockacb) +static void qed_aio_cancel(BlockAIOCB *blockacb) { QEDAIOCB *acb = (QEDAIOCB *)blockacb; AioContext *aio_context = bdrv_get_aio_context(blockacb->bs); @@ -144,7 +144,7 @@ static void qed_write_header_read_cb(void *opaque, int ret) * This function only updates known header fields in-place and does not affect * extra data after the QED header. */ -static void qed_write_header(BDRVQEDState *s, BlockDriverCompletionFunc cb, +static void qed_write_header(BDRVQEDState *s, BlockCompletionFunc cb, void *opaque) { /* We must write full sectors for O_DIRECT but cannot necessarily generate @@ -772,7 +772,7 @@ static BDRVQEDState *acb_to_s(QEDAIOCB *acb) static void qed_read_backing_file(BDRVQEDState *s, uint64_t pos, QEMUIOVector *qiov, QEMUIOVector **backing_qiov, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { uint64_t backing_length = 0; size_t size; @@ -864,7 +864,7 @@ static void qed_copy_from_backing_file_write(void *opaque, int ret) */ static void qed_copy_from_backing_file(BDRVQEDState *s, uint64_t pos, uint64_t len, uint64_t offset, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque) { CopyFromBackingFileCB *copy_cb; @@ -915,7 +915,7 @@ static void qed_update_l2_table(BDRVQEDState *s, QEDTable *table, int index, static void qed_aio_complete_bh(void *opaque) { QEDAIOCB *acb = opaque; - BlockDriverCompletionFunc *cb = acb->common.cb; + BlockCompletionFunc *cb = acb->common.cb; void *user_opaque = acb->common.opaque; int ret = acb->bh_ret; bool *finished = acb->finished; @@ -1083,7 +1083,7 @@ static void qed_aio_write_main(void *opaque, int ret) BDRVQEDState *s = acb_to_s(acb); uint64_t offset = acb->cur_cluster + qed_offset_into_cluster(s, acb->cur_pos); - BlockDriverCompletionFunc *next_fn; + BlockCompletionFunc *next_fn; trace_qed_aio_write_main(s, acb, ret, offset, acb->cur_qiov.size); @@ -1183,7 +1183,7 @@ static void qed_aio_write_zero_cluster(void *opaque, int ret) static void qed_aio_write_alloc(QEDAIOCB *acb, size_t len) { BDRVQEDState *s = acb_to_s(acb); - BlockDriverCompletionFunc *cb; + BlockCompletionFunc *cb; /* Cancel timer when the first allocating request comes in */ if (QSIMPLEQ_EMPTY(&s->allocating_write_reqs)) { @@ -1384,11 +1384,11 @@ static void qed_aio_next_io(void *opaque, int ret) io_fn, acb); } -static BlockDriverAIOCB *qed_aio_setup(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, - void *opaque, int flags) +static BlockAIOCB *qed_aio_setup(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, int nb_sectors, + BlockCompletionFunc *cb, + void *opaque, int flags) { QEDAIOCB *acb = qemu_aio_get(&qed_aiocb_info, bs, cb, opaque); @@ -1410,20 +1410,20 @@ static BlockDriverAIOCB *qed_aio_setup(BlockDriverState *bs, return &acb->common; } -static BlockDriverAIOCB *bdrv_qed_aio_readv(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, - void *opaque) +static BlockAIOCB *bdrv_qed_aio_readv(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, int nb_sectors, + BlockCompletionFunc *cb, + void *opaque) { return qed_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque, 0); } -static BlockDriverAIOCB *bdrv_qed_aio_writev(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, - void *opaque) +static BlockAIOCB *bdrv_qed_aio_writev(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, int nb_sectors, + BlockCompletionFunc *cb, + void *opaque) { return qed_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque, QED_AIOCB_WRITE); @@ -1451,7 +1451,7 @@ static int coroutine_fn bdrv_qed_co_write_zeroes(BlockDriverState *bs, int nb_sectors, BdrvRequestFlags flags) { - BlockDriverAIOCB *blockacb; + BlockAIOCB *blockacb; BDRVQEDState *s = bs->opaque; QEDWriteZeroesCB cb = { .done = false }; QEMUIOVector qiov; diff --git a/block/qed.h b/block/qed.h index 2b0e724..d3934a0 100644 --- a/block/qed.h +++ b/block/qed.h @@ -128,7 +128,7 @@ enum { }; typedef struct QEDAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; int bh_ret; /* final return status for completion bh */ QSIMPLEQ_ENTRY(QEDAIOCB) next; /* next request */ @@ -203,11 +203,11 @@ typedef void QEDFindClusterFunc(void *opaque, int ret, uint64_t offset, size_t l * Generic callback for chaining async callbacks */ typedef struct { - BlockDriverCompletionFunc *cb; + BlockCompletionFunc *cb; void *opaque; } GenericCB; -void *gencb_alloc(size_t len, BlockDriverCompletionFunc *cb, void *opaque); +void *gencb_alloc(size_t len, BlockCompletionFunc *cb, void *opaque); void gencb_complete(void *opaque, int ret); /** @@ -230,16 +230,16 @@ void qed_commit_l2_cache_entry(L2TableCache *l2_cache, CachedL2Table *l2_table); */ int qed_read_l1_table_sync(BDRVQEDState *s); void qed_write_l1_table(BDRVQEDState *s, unsigned int index, unsigned int n, - BlockDriverCompletionFunc *cb, void *opaque); + BlockCompletionFunc *cb, void *opaque); int qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index, unsigned int n); int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, uint64_t offset); void qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, uint64_t offset, - BlockDriverCompletionFunc *cb, void *opaque); + BlockCompletionFunc *cb, void *opaque); void qed_write_l2_table(BDRVQEDState *s, QEDRequest *request, unsigned int index, unsigned int n, bool flush, - BlockDriverCompletionFunc *cb, void *opaque); + BlockCompletionFunc *cb, void *opaque); int qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request, unsigned int index, unsigned int n, bool flush); diff --git a/block/quorum.c b/block/quorum.c index f958269..26f8dfa 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -92,7 +92,7 @@ typedef struct QuorumAIOCB QuorumAIOCB; * $children_count QuorumChildRequest. */ typedef struct QuorumChildRequest { - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; QEMUIOVector qiov; uint8_t *buf; int ret; @@ -105,7 +105,7 @@ typedef struct QuorumChildRequest { * used to do operations on each children and track overall progress. */ struct QuorumAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; /* Request metadata */ uint64_t sector_num; @@ -130,7 +130,7 @@ struct QuorumAIOCB { static bool quorum_vote(QuorumAIOCB *acb); -static void quorum_aio_cancel(BlockDriverAIOCB *blockacb) +static void quorum_aio_cancel(BlockAIOCB *blockacb) { QuorumAIOCB *acb = container_of(blockacb, QuorumAIOCB, common); BDRVQuorumState *s = acb->common.bs->opaque; @@ -187,7 +187,7 @@ static QuorumAIOCB *quorum_aio_get(BDRVQuorumState *s, QEMUIOVector *qiov, uint64_t sector_num, int nb_sectors, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque) { QuorumAIOCB *acb = qemu_aio_get(&quorum_aiocb_info, bs, cb, opaque); @@ -265,7 +265,7 @@ static void quorum_rewrite_aio_cb(void *opaque, int ret) quorum_aio_finalize(acb); } -static BlockDriverAIOCB *read_fifo_child(QuorumAIOCB *acb); +static BlockAIOCB *read_fifo_child(QuorumAIOCB *acb); static void quorum_copy_qiov(QEMUIOVector *dest, QEMUIOVector *source) { @@ -641,7 +641,7 @@ free_exit: return rewrite; } -static BlockDriverAIOCB *read_quorum_children(QuorumAIOCB *acb) +static BlockAIOCB *read_quorum_children(QuorumAIOCB *acb) { BDRVQuorumState *s = acb->common.bs->opaque; int i; @@ -660,7 +660,7 @@ static BlockDriverAIOCB *read_quorum_children(QuorumAIOCB *acb) return &acb->common; } -static BlockDriverAIOCB *read_fifo_child(QuorumAIOCB *acb) +static BlockAIOCB *read_fifo_child(QuorumAIOCB *acb) { BDRVQuorumState *s = acb->common.bs->opaque; @@ -676,12 +676,12 @@ static BlockDriverAIOCB *read_fifo_child(QuorumAIOCB *acb) return &acb->common; } -static BlockDriverAIOCB *quorum_aio_readv(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, - int nb_sectors, - BlockDriverCompletionFunc *cb, - void *opaque) +static BlockAIOCB *quorum_aio_readv(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, + int nb_sectors, + BlockCompletionFunc *cb, + void *opaque) { BDRVQuorumState *s = bs->opaque; QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num, @@ -697,12 +697,12 @@ static BlockDriverAIOCB *quorum_aio_readv(BlockDriverState *bs, return read_fifo_child(acb); } -static BlockDriverAIOCB *quorum_aio_writev(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, - int nb_sectors, - BlockDriverCompletionFunc *cb, - void *opaque) +static BlockAIOCB *quorum_aio_writev(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, + int nb_sectors, + BlockCompletionFunc *cb, + void *opaque) { BDRVQuorumState *s = bs->opaque; QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num, nb_sectors, diff --git a/block/raw-aio.h b/block/raw-aio.h index e18c975..80681ce 100644 --- a/block/raw-aio.h +++ b/block/raw-aio.h @@ -35,9 +35,9 @@ #ifdef CONFIG_LINUX_AIO void *laio_init(void); void laio_cleanup(void *s); -BlockDriverAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd, +BlockAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque, int type); + BlockCompletionFunc *cb, void *opaque, int type); void laio_detach_aio_context(void *s, AioContext *old_context); void laio_attach_aio_context(void *s, AioContext *new_context); void laio_io_plug(BlockDriverState *bs, void *aio_ctx); @@ -49,10 +49,10 @@ typedef struct QEMUWin32AIOState QEMUWin32AIOState; QEMUWin32AIOState *win32_aio_init(void); void win32_aio_cleanup(QEMUWin32AIOState *aio); int win32_aio_attach(QEMUWin32AIOState *aio, HANDLE hfile); -BlockDriverAIOCB *win32_aio_submit(BlockDriverState *bs, +BlockAIOCB *win32_aio_submit(BlockDriverState *bs, QEMUWin32AIOState *aio, HANDLE hfile, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque, int type); + BlockCompletionFunc *cb, void *opaque, int type); void win32_aio_detach_aio_context(QEMUWin32AIOState *aio, AioContext *old_context); void win32_aio_attach_aio_context(QEMUWin32AIOState *aio, diff --git a/block/raw-posix.c b/block/raw-posix.c index d737f3a..2efbfeb 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1040,9 +1040,9 @@ static int paio_submit_co(BlockDriverState *bs, int fd, return thread_pool_submit_co(pool, aio_worker, acb); } -static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd, +static BlockAIOCB *paio_submit(BlockDriverState *bs, int fd, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque, int type) + BlockCompletionFunc *cb, void *opaque, int type) { RawPosixAIOData *acb = g_slice_new(RawPosixAIOData); ThreadPool *pool; @@ -1065,9 +1065,9 @@ static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd, return thread_pool_submit_aio(pool, aio_worker, acb, cb, opaque); } -static BlockDriverAIOCB *raw_aio_submit(BlockDriverState *bs, +static BlockAIOCB *raw_aio_submit(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque, int type) + BlockCompletionFunc *cb, void *opaque, int type) { BDRVRawState *s = bs->opaque; @@ -1124,24 +1124,24 @@ static void raw_aio_flush_io_queue(BlockDriverState *bs) #endif } -static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs, +static BlockAIOCB *raw_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { return raw_aio_submit(bs, sector_num, qiov, nb_sectors, cb, opaque, QEMU_AIO_READ); } -static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs, +static BlockAIOCB *raw_aio_writev(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { return raw_aio_submit(bs, sector_num, qiov, nb_sectors, cb, opaque, QEMU_AIO_WRITE); } -static BlockDriverAIOCB *raw_aio_flush(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque) +static BlockAIOCB *raw_aio_flush(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; @@ -1536,9 +1536,9 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, return ret; } -static coroutine_fn BlockDriverAIOCB *raw_aio_discard(BlockDriverState *bs, +static coroutine_fn BlockAIOCB *raw_aio_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; @@ -1871,9 +1871,9 @@ static int hdev_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) return ioctl(s->fd, req, buf); } -static BlockDriverAIOCB *hdev_aio_ioctl(BlockDriverState *bs, +static BlockAIOCB *hdev_aio_ioctl(BlockDriverState *bs, unsigned long int req, void *buf, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; RawPosixAIOData *acb; @@ -1912,9 +1912,9 @@ static int fd_open(BlockDriverState *bs) #endif /* !linux && !FreeBSD */ -static coroutine_fn BlockDriverAIOCB *hdev_aio_discard(BlockDriverState *bs, +static coroutine_fn BlockAIOCB *hdev_aio_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; diff --git a/block/raw-win32.c b/block/raw-win32.c index 902eab6..88a2a33 100644 --- a/block/raw-win32.c +++ b/block/raw-win32.c @@ -138,9 +138,9 @@ static int aio_worker(void *arg) return ret; } -static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, HANDLE hfile, +static BlockAIOCB *paio_submit(BlockDriverState *bs, HANDLE hfile, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque, int type) + BlockCompletionFunc *cb, void *opaque, int type) { RawWin32AIOData *acb = g_slice_new(RawWin32AIOData); ThreadPool *pool; @@ -369,9 +369,9 @@ fail: return ret; } -static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs, +static BlockAIOCB *raw_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; if (s->aio) { @@ -383,9 +383,9 @@ static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs, } } -static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs, +static BlockAIOCB *raw_aio_writev(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; if (s->aio) { @@ -397,8 +397,8 @@ static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs, } } -static BlockDriverAIOCB *raw_aio_flush(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque) +static BlockAIOCB *raw_aio_flush(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; return paio_submit(bs, s->hfile, 0, NULL, 0, cb, opaque, QEMU_AIO_FLUSH); diff --git a/block/raw_bsd.c b/block/raw_bsd.c index f82f4c2..401b967 100644 --- a/block/raw_bsd.c +++ b/block/raw_bsd.c @@ -129,10 +129,10 @@ static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) return bdrv_ioctl(bs->file, req, buf); } -static BlockDriverAIOCB *raw_aio_ioctl(BlockDriverState *bs, - unsigned long int req, void *buf, - BlockDriverCompletionFunc *cb, - void *opaque) +static BlockAIOCB *raw_aio_ioctl(BlockDriverState *bs, + unsigned long int req, void *buf, + BlockCompletionFunc *cb, + void *opaque) { return bdrv_aio_ioctl(bs->file, req, buf, cb, opaque); } diff --git a/block/rbd.c b/block/rbd.c index ea969e7..ceddc11 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -68,7 +68,7 @@ typedef enum { } RBDAIOCmd; typedef struct RBDAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; int64_t ret; QEMUIOVector *qiov; @@ -542,7 +542,7 @@ static void qemu_rbd_close(BlockDriverState *bs) * Cancel aio. Since we don't reference acb in a non qemu threads, * it is safe to access it here. */ -static void qemu_rbd_aio_cancel(BlockDriverAIOCB *blockacb) +static void qemu_rbd_aio_cancel(BlockAIOCB *blockacb) { RBDAIOCB *acb = (RBDAIOCB *) blockacb; acb->cancelled = 1; @@ -608,13 +608,13 @@ static int rbd_aio_flush_wrapper(rbd_image_t image, #endif } -static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, - int nb_sectors, - BlockDriverCompletionFunc *cb, - void *opaque, - RBDAIOCmd cmd) +static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, + int nb_sectors, + BlockCompletionFunc *cb, + void *opaque, + RBDAIOCmd cmd) { RBDAIOCB *acb; RADOSCB *rcb = NULL; @@ -695,32 +695,32 @@ failed: return NULL; } -static BlockDriverAIOCB *qemu_rbd_aio_readv(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, - int nb_sectors, - BlockDriverCompletionFunc *cb, - void *opaque) +static BlockAIOCB *qemu_rbd_aio_readv(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, + int nb_sectors, + BlockCompletionFunc *cb, + void *opaque) { return rbd_start_aio(bs, sector_num, qiov, nb_sectors, cb, opaque, RBD_AIO_READ); } -static BlockDriverAIOCB *qemu_rbd_aio_writev(BlockDriverState *bs, - int64_t sector_num, - QEMUIOVector *qiov, - int nb_sectors, - BlockDriverCompletionFunc *cb, - void *opaque) +static BlockAIOCB *qemu_rbd_aio_writev(BlockDriverState *bs, + int64_t sector_num, + QEMUIOVector *qiov, + int nb_sectors, + BlockCompletionFunc *cb, + void *opaque) { return rbd_start_aio(bs, sector_num, qiov, nb_sectors, cb, opaque, RBD_AIO_WRITE); } #ifdef LIBRBD_SUPPORTS_AIO_FLUSH -static BlockDriverAIOCB *qemu_rbd_aio_flush(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, - void *opaque) +static BlockAIOCB *qemu_rbd_aio_flush(BlockDriverState *bs, + BlockCompletionFunc *cb, + void *opaque) { return rbd_start_aio(bs, 0, NULL, 0, cb, opaque, RBD_AIO_FLUSH); } @@ -896,11 +896,11 @@ static int qemu_rbd_snap_list(BlockDriverState *bs, } #ifdef LIBRBD_SUPPORTS_DISCARD -static BlockDriverAIOCB* qemu_rbd_aio_discard(BlockDriverState *bs, - int64_t sector_num, - int nb_sectors, - BlockDriverCompletionFunc *cb, - void *opaque) +static BlockAIOCB *qemu_rbd_aio_discard(BlockDriverState *bs, + int64_t sector_num, + int nb_sectors, + BlockCompletionFunc *cb, + void *opaque) { return rbd_start_aio(bs, sector_num, NULL, nb_sectors, cb, opaque, RBD_AIO_DISCARD); diff --git a/block/sheepdog.c b/block/sheepdog.c index f91afc3..86085d3 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -301,7 +301,7 @@ enum AIOCBState { }; struct SheepdogAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUIOVector *qiov; @@ -477,7 +477,7 @@ static bool sd_acb_cancelable(const SheepdogAIOCB *acb) return true; } -static void sd_aio_cancel(BlockDriverAIOCB *blockacb) +static void sd_aio_cancel(BlockAIOCB *blockacb) { SheepdogAIOCB *acb = (SheepdogAIOCB *)blockacb; BDRVSheepdogState *s = acb->common.bs->opaque; diff --git a/block/stream.c b/block/stream.c index cdea3e8..a1dc8da 100644 --- a/block/stream.c +++ b/block/stream.c @@ -220,7 +220,7 @@ static const BlockJobDriver stream_job_driver = { void stream_start(BlockDriverState *bs, BlockDriverState *base, const char *backing_file_str, int64_t speed, BlockdevOnError on_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp) { StreamBlockJob *s; diff --git a/block/win32-aio.c b/block/win32-aio.c index 5030e32..de273b8 100644 --- a/block/win32-aio.c +++ b/block/win32-aio.c @@ -44,7 +44,7 @@ struct QEMUWin32AIOState { }; typedef struct QEMUWin32AIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; struct QEMUWin32AIOState *ctx; int nbytes; OVERLAPPED ov; @@ -106,7 +106,7 @@ static void win32_aio_completion_cb(EventNotifier *e) } } -static void win32_aio_cancel(BlockDriverAIOCB *blockacb) +static void win32_aio_cancel(BlockAIOCB *blockacb) { QEMUWin32AIOCB *waiocb = (QEMUWin32AIOCB *)blockacb; @@ -124,10 +124,10 @@ static const AIOCBInfo win32_aiocb_info = { .cancel = win32_aio_cancel, }; -BlockDriverAIOCB *win32_aio_submit(BlockDriverState *bs, +BlockAIOCB *win32_aio_submit(BlockDriverState *bs, QEMUWin32AIOState *aio, HANDLE hfile, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque, int type) + BlockCompletionFunc *cb, void *opaque, int type) { struct QEMUWin32AIOCB *waiocb; uint64_t offset = sector_num * 512; diff --git a/blockjob.c b/blockjob.c index 3af0f6c..ff0908a 100644 --- a/blockjob.c +++ b/blockjob.c @@ -36,7 +36,7 @@ #include "qapi-event.h" void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs, - int64_t speed, BlockDriverCompletionFunc *cb, + int64_t speed, BlockCompletionFunc *cb, void *opaque, Error **errp) { BlockJob *job; @@ -155,7 +155,7 @@ void block_job_iostatus_reset(BlockJob *job) struct BlockCancelData { BlockJob *job; - BlockDriverCompletionFunc *cb; + BlockCompletionFunc *cb; void *opaque; bool cancelled; int ret; diff --git a/dma-helpers.c b/dma-helpers.c index 499b52b..e7bea06 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -67,9 +67,9 @@ void qemu_sglist_destroy(QEMUSGList *qsg) } typedef struct { - BlockDriverAIOCB common; + BlockAIOCB common; BlockDriverState *bs; - BlockDriverAIOCB *acb; + BlockAIOCB *acb; QEMUSGList *sg; uint64_t sector_num; DMADirection dir; @@ -179,14 +179,14 @@ static void dma_bdrv_cb(void *opaque, int ret) assert(dbs->acb); } -static void dma_aio_cancel(BlockDriverAIOCB *acb) +static void dma_aio_cancel(BlockAIOCB *acb) { DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common); trace_dma_aio_cancel(dbs); if (dbs->acb) { - BlockDriverAIOCB *acb = dbs->acb; + BlockAIOCB *acb = dbs->acb; dbs->acb = NULL; dbs->in_cancel = true; bdrv_aio_cancel(acb); @@ -201,9 +201,9 @@ static const AIOCBInfo dma_aiocb_info = { .cancel = dma_aio_cancel, }; -BlockDriverAIOCB *dma_bdrv_io( +BlockAIOCB *dma_bdrv_io( BlockDriverState *bs, QEMUSGList *sg, uint64_t sector_num, - DMAIOFunc *io_func, BlockDriverCompletionFunc *cb, + DMAIOFunc *io_func, BlockCompletionFunc *cb, void *opaque, DMADirection dir) { DMAAIOCB *dbs = qemu_aio_get(&dma_aiocb_info, bs, cb, opaque); @@ -226,17 +226,17 @@ BlockDriverAIOCB *dma_bdrv_io( } -BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs, - QEMUSGList *sg, uint64_t sector, - void (*cb)(void *opaque, int ret), void *opaque) +BlockAIOCB *dma_bdrv_read(BlockDriverState *bs, + QEMUSGList *sg, uint64_t sector, + void (*cb)(void *opaque, int ret), void *opaque) { return dma_bdrv_io(bs, sg, sector, bdrv_aio_readv, cb, opaque, DMA_DIRECTION_FROM_DEVICE); } -BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs, - QEMUSGList *sg, uint64_t sector, - void (*cb)(void *opaque, int ret), void *opaque) +BlockAIOCB *dma_bdrv_write(BlockDriverState *bs, + QEMUSGList *sg, uint64_t sector, + void (*cb)(void *opaque, int ret), void *opaque) { return dma_bdrv_io(bs, sg, sector, bdrv_aio_writev, cb, opaque, DMA_DIRECTION_TO_DEVICE); diff --git a/hw/block/nvme.h b/hw/block/nvme.h index bd8fc3e..993c511 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -636,7 +636,7 @@ typedef struct NvmeAsyncEvent { typedef struct NvmeRequest { struct NvmeSQueue *sq; - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; uint16_t status; NvmeCqe cqe; BlockAcctCookie acct; diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 0ee713b..97c997c 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1104,7 +1104,7 @@ out: } static void ahci_start_dma(IDEDMA *dma, IDEState *s, - BlockDriverCompletionFunc *dma_cb) + BlockCompletionFunc *dma_cb) { #ifdef DEBUG_AHCI AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); diff --git a/hw/ide/ahci.h b/hw/ide/ahci.h index 1543df7..fe32eab 100644 --- a/hw/ide/ahci.h +++ b/hw/ide/ahci.h @@ -241,7 +241,7 @@ typedef struct AHCIDevice AHCIDevice; typedef struct NCQTransferState { AHCIDevice *drive; - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; QEMUSGList sglist; BlockAcctCookie acct; uint16_t sector_count; diff --git a/hw/ide/core.c b/hw/ide/core.c index 191f893..36df217 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -360,15 +360,15 @@ static void ide_set_signature(IDEState *s) } typedef struct TrimAIOCB { - BlockDriverAIOCB common; + BlockAIOCB common; QEMUBH *bh; int ret; QEMUIOVector *qiov; - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; int i, j; } TrimAIOCB; -static void trim_aio_cancel(BlockDriverAIOCB *acb) +static void trim_aio_cancel(BlockAIOCB *acb) { TrimAIOCB *iocb = container_of(acb, TrimAIOCB, common); @@ -440,9 +440,9 @@ static void ide_issue_trim_cb(void *opaque, int ret) } } -BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs, +BlockAIOCB *ide_issue_trim(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { TrimAIOCB *iocb; @@ -784,7 +784,7 @@ static void ide_sector_start_dma(IDEState *s, enum ide_dma_cmd dma_cmd) ide_start_dma(s, ide_dma_cb); } -void ide_start_dma(IDEState *s, BlockDriverCompletionFunc *cb) +void ide_start_dma(IDEState *s, BlockCompletionFunc *cb) { if (s->bus->dma->ops->start_dma) { s->bus->dma->ops->start_dma(s->bus->dma, s, cb); diff --git a/hw/ide/internal.h b/hw/ide/internal.h index 5c19f79..9314c80 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -319,7 +319,7 @@ typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind; typedef void EndTransferFunc(IDEState *); -typedef void DMAStartFunc(IDEDMA *, IDEState *, BlockDriverCompletionFunc *); +typedef void DMAStartFunc(IDEDMA *, IDEState *, BlockCompletionFunc *); typedef void DMAVoidFunc(IDEDMA *); typedef int DMAIntFunc(IDEDMA *, int); typedef void DMAStopFunc(IDEDMA *, bool); @@ -389,7 +389,7 @@ struct IDEState { int cd_sector_size; int atapi_dma; /* true if dma is requested for the packet cmd */ BlockAcctCookie acct; - BlockDriverAIOCB *pio_aiocb; + BlockAIOCB *pio_aiocb; struct iovec iov; QEMUIOVector qiov; /* ATA DMA state */ @@ -442,7 +442,7 @@ struct IDEDMA { const struct IDEDMAOps *ops; struct iovec iov; QEMUIOVector qiov; - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; }; struct IDEBus { @@ -521,7 +521,7 @@ void ide_bus_reset(IDEBus *bus); int64_t ide_get_sector(IDEState *s); void ide_set_sector(IDEState *s, int64_t sector_num); -void ide_start_dma(IDEState *s, BlockDriverCompletionFunc *cb); +void ide_start_dma(IDEState *s, BlockCompletionFunc *cb); void ide_dma_error(IDEState *s); void ide_atapi_cmd_ok(IDEState *s); @@ -555,9 +555,9 @@ void ide_transfer_start(IDEState *s, uint8_t *buf, int size, EndTransferFunc *end_transfer_func); void ide_transfer_stop(IDEState *s); void ide_set_inactive(IDEState *s, bool more); -BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs, +BlockAIOCB *ide_issue_trim(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); + BlockCompletionFunc *cb, void *opaque); /* hw/ide/atapi.c */ void ide_atapi_cmd(IDEState *s); diff --git a/hw/ide/macio.c b/hw/ide/macio.c index b0c0d40..371e172 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -555,7 +555,7 @@ static void ide_nop_restart(void *opaque, int x, RunState y) } static void ide_dbdma_start(IDEDMA *dma, IDEState *s, - BlockDriverCompletionFunc *cb) + BlockCompletionFunc *cb) { MACIOIDEState *m = container_of(dma, MACIOIDEState, dma); diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 2397f35..6ff1c58 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -38,7 +38,7 @@ IDE_RETRY_READ | IDE_RETRY_FLUSH) static void bmdma_start_dma(IDEDMA *dma, IDEState *s, - BlockDriverCompletionFunc *dma_cb) + BlockCompletionFunc *dma_cb) { BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma); diff --git a/hw/ide/pci.h b/hw/ide/pci.h index 517711f..2e9314a 100644 --- a/hw/ide/pci.h +++ b/hw/ide/pci.h @@ -23,7 +23,7 @@ typedef struct BMDMAState { uint32_t cur_prd_addr; uint32_t cur_prd_len; uint8_t unit; - BlockDriverCompletionFunc *dma_cb; + BlockCompletionFunc *dma_cb; int64_t sector_num; uint32_t nsector; MemoryRegion addr_ioport; diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index aff2b9a..8bdba30 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -131,7 +131,7 @@ typedef struct MACIOIDEState { MemoryRegion mem; IDEBus bus; - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; IDEDMA dma; void *dbdma; bool dma_active; diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 20587b4..5301886 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -157,7 +157,7 @@ static void scsi_cancel_io(SCSIRequest *req) static int execute_command(BlockDriverState *bdrv, SCSIGenericReq *r, int direction, - BlockDriverCompletionFunc *complete) + BlockCompletionFunc *complete) { r->io_header.interface_id = 'S'; r->io_header.dxfer_direction = direction; diff --git a/include/block/aio.h b/include/block/aio.h index 4603c0f..57619ab 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -22,23 +22,23 @@ #include "qemu/rfifolock.h" #include "qemu/timer.h" -typedef struct BlockDriverAIOCB BlockDriverAIOCB; -typedef void BlockDriverCompletionFunc(void *opaque, int ret); +typedef struct BlockAIOCB BlockAIOCB; +typedef void BlockCompletionFunc(void *opaque, int ret); typedef struct AIOCBInfo { - void (*cancel)(BlockDriverAIOCB *acb); + void (*cancel)(BlockAIOCB *acb); size_t aiocb_size; } AIOCBInfo; -struct BlockDriverAIOCB { +struct BlockAIOCB { const AIOCBInfo *aiocb_info; BlockDriverState *bs; - BlockDriverCompletionFunc *cb; + BlockCompletionFunc *cb; void *opaque; }; void *qemu_aio_get(const AIOCBInfo *aiocb_info, BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque); + BlockCompletionFunc *cb, void *opaque); void qemu_aio_release(void *p); typedef struct AioHandler AioHandler; diff --git a/include/block/block.h b/include/block/block.h index fb4fff9..15a5290 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -246,9 +246,9 @@ int bdrv_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors); int bdrv_write_zeroes(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BdrvRequestFlags flags); -BlockDriverAIOCB *bdrv_aio_write_zeroes(BlockDriverState *bs, int64_t sector_num, - int nb_sectors, BdrvRequestFlags flags, - BlockDriverCompletionFunc *cb, void *opaque); +BlockAIOCB *bdrv_aio_write_zeroes(BlockDriverState *bs, int64_t sector_num, + int nb_sectors, BdrvRequestFlags flags, + BlockCompletionFunc *cb, void *opaque); int bdrv_make_zero(BlockDriverState *bs, BdrvRequestFlags flags); int bdrv_pread(BlockDriverState *bs, int64_t offset, void *buf, int count); @@ -324,18 +324,18 @@ BlockDriverState *check_to_replace_node(const char *node_name, Error **errp); /* async block I/O */ typedef void BlockDriverDirtyHandler(BlockDriverState *bs, int64_t sector, int sector_num); -BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, - QEMUIOVector *iov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); -BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, - QEMUIOVector *iov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); -BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque); -BlockDriverAIOCB *bdrv_aio_discard(BlockDriverState *bs, - int64_t sector_num, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); -void bdrv_aio_cancel(BlockDriverAIOCB *acb); +BlockAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, + QEMUIOVector *iov, int nb_sectors, + BlockCompletionFunc *cb, void *opaque); +BlockAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, + QEMUIOVector *iov, int nb_sectors, + BlockCompletionFunc *cb, void *opaque); +BlockAIOCB *bdrv_aio_flush(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque); +BlockAIOCB *bdrv_aio_discard(BlockDriverState *bs, + int64_t sector_num, int nb_sectors, + BlockCompletionFunc *cb, void *opaque); +void bdrv_aio_cancel(BlockAIOCB *acb); typedef struct BlockRequest { /* Fields to be filled by multiwrite caller */ @@ -343,7 +343,7 @@ typedef struct BlockRequest { int nb_sectors; int flags; QEMUIOVector *qiov; - BlockDriverCompletionFunc *cb; + BlockCompletionFunc *cb; void *opaque; /* Filled by multiwrite implementation */ @@ -355,9 +355,9 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, /* sg packet commands */ int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf); -BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, +BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, unsigned long int req, void *buf, - BlockDriverCompletionFunc *cb, void *opaque); + BlockCompletionFunc *cb, void *opaque); /* Invalidate any cached metadata used by image formats */ void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp); diff --git a/include/block/block_int.h b/include/block/block_int.h index 08ccb27..b3246e7 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -127,17 +127,17 @@ struct BlockDriver { void (*bdrv_refresh_filename)(BlockDriverState *bs); /* aio */ - BlockDriverAIOCB *(*bdrv_aio_readv)(BlockDriverState *bs, + BlockAIOCB *(*bdrv_aio_readv)(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); - BlockDriverAIOCB *(*bdrv_aio_writev)(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque); + BlockAIOCB *(*bdrv_aio_writev)(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); - BlockDriverAIOCB *(*bdrv_aio_flush)(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque); - BlockDriverAIOCB *(*bdrv_aio_discard)(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque); + BlockAIOCB *(*bdrv_aio_flush)(BlockDriverState *bs, + BlockCompletionFunc *cb, void *opaque); + BlockAIOCB *(*bdrv_aio_discard)(BlockDriverState *bs, int64_t sector_num, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); + BlockCompletionFunc *cb, void *opaque); int coroutine_fn (*bdrv_co_readv)(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov); @@ -217,9 +217,9 @@ struct BlockDriver { /* to control generic scsi devices */ int (*bdrv_ioctl)(BlockDriverState *bs, unsigned long int req, void *buf); - BlockDriverAIOCB *(*bdrv_aio_ioctl)(BlockDriverState *bs, + BlockAIOCB *(*bdrv_aio_ioctl)(BlockDriverState *bs, unsigned long int req, void *buf, - BlockDriverCompletionFunc *cb, void *opaque); + BlockCompletionFunc *cb, void *opaque); /* List of options for creating images, terminated by name == NULL */ QemuOptsList *create_opts; @@ -501,7 +501,7 @@ int is_windows_drive(const char *filename); */ void stream_start(BlockDriverState *bs, BlockDriverState *base, const char *base_id, int64_t speed, BlockdevOnError on_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp); /** @@ -519,7 +519,7 @@ void stream_start(BlockDriverState *bs, BlockDriverState *base, */ void commit_start(BlockDriverState *bs, BlockDriverState *base, BlockDriverState *top, int64_t speed, - BlockdevOnError on_error, BlockDriverCompletionFunc *cb, + BlockdevOnError on_error, BlockCompletionFunc *cb, void *opaque, const char *backing_file_str, Error **errp); /** * commit_active_start: @@ -535,7 +535,7 @@ void commit_start(BlockDriverState *bs, BlockDriverState *base, void commit_active_start(BlockDriverState *bs, BlockDriverState *base, int64_t speed, BlockdevOnError on_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp); /* * mirror_start: @@ -563,7 +563,7 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, int64_t granularity, int64_t buf_size, MirrorSyncMode mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, + BlockCompletionFunc *cb, void *opaque, Error **errp); /* @@ -584,7 +584,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, MirrorSyncMode sync_mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, - BlockDriverCompletionFunc *cb, void *opaque, + BlockCompletionFunc *cb, void *opaque, Error **errp); #endif /* BLOCK_INT_H */ diff --git a/include/block/blockjob.h b/include/block/blockjob.h index 60aa835..acb399f 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -104,7 +104,7 @@ struct BlockJob { int64_t speed; /** The completion function that will be called when the job completes. */ - BlockDriverCompletionFunc *cb; + BlockCompletionFunc *cb; /** Block other operations when block job is running */ Error *blocker; @@ -132,7 +132,7 @@ struct BlockJob { * called from a wrapper that is specific to the job type. */ void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs, - int64_t speed, BlockDriverCompletionFunc *cb, + int64_t speed, BlockCompletionFunc *cb, void *opaque, Error **errp); /** diff --git a/include/block/thread-pool.h b/include/block/thread-pool.h index 4723752..42eb5e8 100644 --- a/include/block/thread-pool.h +++ b/include/block/thread-pool.h @@ -27,9 +27,9 @@ typedef struct ThreadPool ThreadPool; ThreadPool *thread_pool_new(struct AioContext *ctx); void thread_pool_free(ThreadPool *pool); -BlockDriverAIOCB *thread_pool_submit_aio(ThreadPool *pool, +BlockAIOCB *thread_pool_submit_aio(ThreadPool *pool, ThreadPoolFunc *func, void *arg, - BlockDriverCompletionFunc *cb, void *opaque); + BlockCompletionFunc *cb, void *opaque); int coroutine_fn thread_pool_submit_co(ThreadPool *pool, ThreadPoolFunc *func, void *arg); void thread_pool_submit(ThreadPool *pool, ThreadPoolFunc *func, void *arg); diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 2e3a8f9..e3e27cb 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -52,7 +52,7 @@ struct SCSIRequest { uint32_t status; size_t resid; SCSICommand cmd; - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; QEMUSGList *sg; bool dma_started; uint8_t sense[SCSI_SENSE_BUF_SIZE]; diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 78a5fc8..47606d0 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -27,10 +27,10 @@ int monitor_suspend(Monitor *mon); void monitor_resume(Monitor *mon); int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, - BlockDriverCompletionFunc *completion_cb, + BlockCompletionFunc *completion_cb, void *opaque); int monitor_read_block_device_key(Monitor *mon, const char *device, - BlockDriverCompletionFunc *completion_cb, + BlockCompletionFunc *completion_cb, void *opaque); int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp); diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 00f21f3..464f9f7 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -196,20 +196,20 @@ void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len); void qemu_sglist_destroy(QEMUSGList *qsg); #endif -typedef BlockDriverAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t sector_num, - QEMUIOVector *iov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); +typedef BlockAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t sector_num, + QEMUIOVector *iov, int nb_sectors, + BlockCompletionFunc *cb, void *opaque); -BlockDriverAIOCB *dma_bdrv_io(BlockDriverState *bs, - QEMUSGList *sg, uint64_t sector_num, - DMAIOFunc *io_func, BlockDriverCompletionFunc *cb, - void *opaque, DMADirection dir); -BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs, - QEMUSGList *sg, uint64_t sector, - BlockDriverCompletionFunc *cb, void *opaque); -BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs, - QEMUSGList *sg, uint64_t sector, - BlockDriverCompletionFunc *cb, void *opaque); +BlockAIOCB *dma_bdrv_io(BlockDriverState *bs, + QEMUSGList *sg, uint64_t sector_num, + DMAIOFunc *io_func, BlockCompletionFunc *cb, + void *opaque, DMADirection dir); +BlockAIOCB *dma_bdrv_read(BlockDriverState *bs, + QEMUSGList *sg, uint64_t sector, + BlockCompletionFunc *cb, void *opaque); +BlockAIOCB *dma_bdrv_write(BlockDriverState *bs, + QEMUSGList *sg, uint64_t sector, + BlockCompletionFunc *cb, void *opaque); uint64_t dma_buf_read(uint8_t *ptr, int32_t len, QEMUSGList *sg); uint64_t dma_buf_write(uint8_t *ptr, int32_t len, QEMUSGList *sg); diff --git a/monitor.c b/monitor.c index 4ae66df..eaa6de7 100644 --- a/monitor.c +++ b/monitor.c @@ -206,7 +206,7 @@ struct Monitor { ReadLineState *rs; MonitorControl *mc; CPUState *mon_cpu; - BlockDriverCompletionFunc *password_completion_cb; + BlockCompletionFunc *password_completion_cb; void *password_opaque; mon_cmd_t *cmd_table; QError *error; @@ -5361,7 +5361,7 @@ ReadLineState *monitor_get_rs(Monitor *mon) } int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, - BlockDriverCompletionFunc *completion_cb, + BlockCompletionFunc *completion_cb, void *opaque) { int err; @@ -5393,7 +5393,7 @@ int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, } int monitor_read_block_device_key(Monitor *mon, const char *device, - BlockDriverCompletionFunc *completion_cb, + BlockCompletionFunc *completion_cb, void *opaque) { BlockDriverState *bs; diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c index f40b7fc..acc911b 100644 --- a/tests/test-thread-pool.c +++ b/tests/test-thread-pool.c @@ -10,7 +10,7 @@ static ThreadPool *pool; static int active; typedef struct { - BlockDriverAIOCB *aiocb; + BlockAIOCB *aiocb; int n; int ret; } WorkerTestData; diff --git a/thread-pool.c b/thread-pool.c index bc07d7a..f9e9901 100644 --- a/thread-pool.c +++ b/thread-pool.c @@ -35,7 +35,7 @@ enum ThreadState { }; struct ThreadPoolElement { - BlockDriverAIOCB common; + BlockAIOCB common; ThreadPool *pool; ThreadPoolFunc *func; void *arg; @@ -201,7 +201,7 @@ restart: } } -static void thread_pool_cancel(BlockDriverAIOCB *acb) +static void thread_pool_cancel(BlockAIOCB *acb) { ThreadPoolElement *elem = (ThreadPoolElement *)acb; ThreadPool *pool = elem->pool; @@ -235,9 +235,9 @@ static const AIOCBInfo thread_pool_aiocb_info = { .cancel = thread_pool_cancel, }; -BlockDriverAIOCB *thread_pool_submit_aio(ThreadPool *pool, +BlockAIOCB *thread_pool_submit_aio(ThreadPool *pool, ThreadPoolFunc *func, void *arg, - BlockDriverCompletionFunc *cb, void *opaque) + BlockCompletionFunc *cb, void *opaque) { ThreadPoolElement *req; -- 1.9.3