mirror of
https://github.com/xemu-project/xemu.git
synced 2025-02-08 13:17:52 +00:00
null: Switch to .bdrv_co_block_status()
We are gradually moving away from sector-based interfaces, towards byte-based. Update the null driver accordingly. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
92809c3600
commit
05c33f1021
23
block/null.c
23
block/null.c
@ -223,22 +223,23 @@ static int null_reopen_prepare(BDRVReopenState *reopen_state,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t coroutine_fn null_co_get_block_status(BlockDriverState *bs,
|
static int coroutine_fn null_co_block_status(BlockDriverState *bs,
|
||||||
int64_t sector_num,
|
bool want_zero, int64_t offset,
|
||||||
int nb_sectors, int *pnum,
|
int64_t bytes, int64_t *pnum,
|
||||||
BlockDriverState **file)
|
int64_t *map,
|
||||||
|
BlockDriverState **file)
|
||||||
{
|
{
|
||||||
BDRVNullState *s = bs->opaque;
|
BDRVNullState *s = bs->opaque;
|
||||||
off_t start = sector_num * BDRV_SECTOR_SIZE;
|
int ret = BDRV_BLOCK_OFFSET_VALID;
|
||||||
|
|
||||||
*pnum = nb_sectors;
|
*pnum = bytes;
|
||||||
|
*map = offset;
|
||||||
*file = bs;
|
*file = bs;
|
||||||
|
|
||||||
if (s->read_zeroes) {
|
if (s->read_zeroes) {
|
||||||
return BDRV_BLOCK_OFFSET_VALID | start | BDRV_BLOCK_ZERO;
|
ret |= BDRV_BLOCK_ZERO;
|
||||||
} else {
|
|
||||||
return BDRV_BLOCK_OFFSET_VALID | start;
|
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void null_refresh_filename(BlockDriverState *bs, QDict *opts)
|
static void null_refresh_filename(BlockDriverState *bs, QDict *opts)
|
||||||
@ -270,7 +271,7 @@ static BlockDriver bdrv_null_co = {
|
|||||||
.bdrv_co_flush_to_disk = null_co_flush,
|
.bdrv_co_flush_to_disk = null_co_flush,
|
||||||
.bdrv_reopen_prepare = null_reopen_prepare,
|
.bdrv_reopen_prepare = null_reopen_prepare,
|
||||||
|
|
||||||
.bdrv_co_get_block_status = null_co_get_block_status,
|
.bdrv_co_block_status = null_co_block_status,
|
||||||
|
|
||||||
.bdrv_refresh_filename = null_refresh_filename,
|
.bdrv_refresh_filename = null_refresh_filename,
|
||||||
};
|
};
|
||||||
@ -290,7 +291,7 @@ static BlockDriver bdrv_null_aio = {
|
|||||||
.bdrv_aio_flush = null_aio_flush,
|
.bdrv_aio_flush = null_aio_flush,
|
||||||
.bdrv_reopen_prepare = null_reopen_prepare,
|
.bdrv_reopen_prepare = null_reopen_prepare,
|
||||||
|
|
||||||
.bdrv_co_get_block_status = null_co_get_block_status,
|
.bdrv_co_block_status = null_co_block_status,
|
||||||
|
|
||||||
.bdrv_refresh_filename = null_refresh_filename,
|
.bdrv_refresh_filename = null_refresh_filename,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user