We are gradually moving away from sector-based interfaces, towards byte-based. Update the vvfat driver accordingly.
Signed-off-by: Eric Blake <ebl...@redhat.com> --- block/vvfat.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/block/vvfat.c b/block/vvfat.c index bef2056..825fe72 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2961,13 +2961,13 @@ vvfat_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, return ret; } -static int64_t coroutine_fn vvfat_co_get_block_status(BlockDriverState *bs, - int64_t sector_num, int nb_sectors, int *n, BlockDriverState **file) +static int64_t coroutine_fn vvfat_co_block_status(BlockDriverState *bs, + int64_t offset, int64_t bytes, int64_t *n, BlockDriverState **file) { BDRVVVFATState* s = bs->opaque; - *n = s->sector_count - sector_num; - if (*n > nb_sectors) { - *n = nb_sectors; + *n = s->sector_count * BDRV_SECTOR_SIZE - offset; + if (*n > bytes) { + *n = bytes; } else if (*n < 0) { return 0; } @@ -3124,7 +3124,7 @@ static BlockDriver bdrv_vvfat = { .bdrv_co_preadv = vvfat_co_preadv, .bdrv_co_pwritev = vvfat_co_pwritev, - .bdrv_co_get_block_status = vvfat_co_get_block_status, + .bdrv_co_block_status = vvfat_co_block_status, }; static void bdrv_vvfat_init(void) -- 2.9.3