diff options
author | Eric Blake | 2017-10-12 05:46:59 +0200 |
---|---|---|
committer | Kevin Wolf | 2017-10-26 14:45:57 +0200 |
commit | 7cfd527525a7d6b1c904890a6b84c1227846415e (patch) | |
tree | 55d25498a379476b045ac7c681387cf759babfd8 /include/block/block.h | |
parent | block: Add flag to avoid wasted work in bdrv_is_allocated() (diff) | |
download | qemu-7cfd527525a7d6b1c904890a6b84c1227846415e.tar.gz qemu-7cfd527525a7d6b1c904890a6b84c1227846415e.tar.xz qemu-7cfd527525a7d6b1c904890a6b84c1227846415e.zip |
block: Make bdrv_round_to_clusters() signature more useful
In the process of converting sector-based interfaces to bytes,
I'm finding it easier to represent a byte count as a 64-bit
integer at the block layer (even if we are internally capped
by SIZE_MAX or even INT_MAX for individual transactions, it's
still nicer to not have to worry about truncation/overflow
issues on as many variables). Update the signature of
bdrv_round_to_clusters() to uniformly use int64_t, matching
the signature already chosen for bdrv_is_allocated and the
fact that off_t is also a signed type, then adjust clients
according to the required fallout (even where the result could
now exceed 32 bits, no client is directly assigning the result
into a 32-bit value without breaking things into a loop first).
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/block/block.h')
-rw-r--r-- | include/block/block.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/block/block.h b/include/block/block.h index d5c2731a03..440f3e9e39 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -474,9 +474,9 @@ int bdrv_get_flags(BlockDriverState *bs); int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi); ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs); void bdrv_round_to_clusters(BlockDriverState *bs, - int64_t offset, unsigned int bytes, + int64_t offset, int64_t bytes, int64_t *cluster_offset, - unsigned int *cluster_bytes); + int64_t *cluster_bytes); const char *bdrv_get_encrypted_filename(BlockDriverState *bs); void bdrv_get_backing_filename(BlockDriverState *bs, |