diff options
-rw-r--r-- | block.c | 3 | ||||
-rw-r--r-- | block/blkdebug.c | 4 | ||||
-rw-r--r-- | block/qcow.c | 2 | ||||
-rw-r--r-- | block/qcow2.c | 2 | ||||
-rw-r--r-- | block/vdi.c | 2 |
5 files changed, 7 insertions, 6 deletions
@@ -2108,7 +2108,8 @@ typedef struct BlockDriverAIOCBSync { static void bdrv_aio_cancel_em(BlockDriverAIOCB *blockacb) { - BlockDriverAIOCBSync *acb = (BlockDriverAIOCBSync *)blockacb; + BlockDriverAIOCBSync *acb = + container_of(blockacb, BlockDriverAIOCBSync, common); qemu_bh_delete(acb->bh); acb->bh = NULL; qemu_aio_release(acb); diff --git a/block/blkdebug.c b/block/blkdebug.c index bb4a91abc7..8325f75f80 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -320,7 +320,7 @@ static void error_callback_bh(void *opaque) static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb) { - BlkdebugAIOCB *acb = (BlkdebugAIOCB*) blockacb; + BlkdebugAIOCB *acb = container_of(blockacb, BlkdebugAIOCB, common); qemu_aio_release(acb); } @@ -347,7 +347,7 @@ static BlockDriverAIOCB *inject_error(BlockDriverState *bs, acb->bh = bh; qemu_bh_schedule(bh); - return (BlockDriverAIOCB*) acb; + return &acb->common; } static BlockDriverAIOCB *blkdebug_aio_readv(BlockDriverState *bs, diff --git a/block/qcow.c b/block/qcow.c index 2883c40f87..449858fa47 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -502,7 +502,7 @@ typedef struct QCowAIOCB { static void qcow_aio_cancel(BlockDriverAIOCB *blockacb) { - QCowAIOCB *acb = (QCowAIOCB *)blockacb; + QCowAIOCB *acb = container_of(blockacb, QCowAIOCB, common); if (acb->hd_aiocb) bdrv_aio_cancel(acb->hd_aiocb); qemu_aio_release(acb); diff --git a/block/qcow2.c b/block/qcow2.c index ebad4e10ae..0ce71507e9 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -338,7 +338,7 @@ typedef struct QCowAIOCB { static void qcow_aio_cancel(BlockDriverAIOCB *blockacb) { - QCowAIOCB *acb = (QCowAIOCB *)blockacb; + QCowAIOCB *acb = container_of(blockacb, QCowAIOCB, common); if (acb->hd_aiocb) bdrv_aio_cancel(acb->hd_aiocb); qemu_aio_release(acb); diff --git a/block/vdi.c b/block/vdi.c index 1d257b4838..2b4d2c218d 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -469,7 +469,7 @@ static int vdi_is_allocated(BlockDriverState *bs, int64_t sector_num, static void vdi_aio_cancel(BlockDriverAIOCB *blockacb) { /* TODO: This code is untested. How can I get it executed? */ - VdiAIOCB *acb = (VdiAIOCB *)blockacb; + VdiAIOCB *acb = container_of(blockacb, VdiAIOCB, common); logout("\n"); if (acb->hd_aiocb) { bdrv_aio_cancel(acb->hd_aiocb); |