diff options
author | Eric Blake <eblake@redhat.com> | 2018-02-13 14:26:54 -0600 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-03-02 18:39:07 +0100 |
commit | d41aa7e36f442cba9c3841f87856454fca96288e (patch) | |
tree | fb11fe948f4eb097a4f040044df43aa987ca730a | |
parent | b8d739fd6fb295a7562c506c65f2137199a509f9 (diff) | |
download | qemu-d41aa7e36f442cba9c3841f87856454fca96288e.zip qemu-d41aa7e36f442cba9c3841f87856454fca96288e.tar.gz qemu-d41aa7e36f442cba9c3841f87856454fca96288e.tar.bz2 |
raw: Switch to .bdrv_co_block_status()
We are gradually moving away from sector-based interfaces, towards
byte-based. Update the raw 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>
-rw-r--r-- | block/raw-format.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/block/raw-format.c b/block/raw-format.c index ab552c0..830243a 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -250,17 +250,17 @@ fail: return ret; } -static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, - int64_t sector_num, - int nb_sectors, int *pnum, +static int coroutine_fn raw_co_block_status(BlockDriverState *bs, + bool want_zero, int64_t offset, + int64_t bytes, int64_t *pnum, + int64_t *map, BlockDriverState **file) { BDRVRawState *s = bs->opaque; - *pnum = nb_sectors; + *pnum = bytes; *file = bs->file->bs; - sector_num += s->offset / BDRV_SECTOR_SIZE; - return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID | - (sector_num << BDRV_SECTOR_BITS); + *map = offset + s->offset; + return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID; } static int coroutine_fn raw_co_pwrite_zeroes(BlockDriverState *bs, @@ -496,7 +496,7 @@ BlockDriver bdrv_raw = { .bdrv_co_pwritev = &raw_co_pwritev, .bdrv_co_pwrite_zeroes = &raw_co_pwrite_zeroes, .bdrv_co_pdiscard = &raw_co_pdiscard, - .bdrv_co_get_block_status = &raw_co_get_block_status, + .bdrv_co_block_status = &raw_co_block_status, .bdrv_truncate = &raw_truncate, .bdrv_getlength = &raw_getlength, .has_variable_length = true, |