[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 14/17] raw-posix: return get_block_status dat
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 14/17] raw-posix: return get_block_status data and flags |
Date: |
Fri, 19 Jul 2013 13:48:41 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 |
On 07/16/2013 10:29 AM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> block/raw-posix.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> +++ b/block/raw-posix.c
> @@ -1089,7 +1089,7 @@ static int64_t coroutine_fn
> raw_co_get_block_status(BlockDriverState *bs,
> int nb_sectors, int *pnum)
> {
> off_t start, data, hole;
> - int ret;
> + int64_t ret;
>
> ret = fd_open(bs);
> if (ret < 0) {
> @@ -1097,6 +1097,7 @@ static int64_t coroutine_fn
> raw_co_get_block_status(BlockDriverState *bs,
> }
>
> start = sector_num * BDRV_SECTOR_SIZE;
> + ret = BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID | start;
off_t is a signed type; if you are compiling on a platform with 32-bit
off_t, is it possible that you will get unintended sign extension for
values of 'start' between 2 and 4 GB? Or are such files already
impossible to open? [Or do we intentionally require off_t be 64-bits on
all platforms we care about?]
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v2 11/17] block: return get_block_status data and flags for formats, (continued)
- [Qemu-devel] [PATCH v2 11/17] block: return get_block_status data and flags for formats, Paolo Bonzini, 2013/07/16
- [Qemu-devel] [PATCH v2 13/17] block: use bdrv_has_zero_init to return BDRV_BLOCK_ZERO, Paolo Bonzini, 2013/07/16
- [Qemu-devel] [PATCH v2 12/17] qemu-img: add a "map" subcommand, Paolo Bonzini, 2013/07/16
- [Qemu-devel] [PATCH v2 14/17] raw-posix: return get_block_status data and flags, Paolo Bonzini, 2013/07/16
- Re: [Qemu-devel] [PATCH v2 14/17] raw-posix: return get_block_status data and flags,
Eric Blake <=
- [Qemu-devel] [PATCH v2 15/17] raw-posix: detect XFS unwritten extents, Paolo Bonzini, 2013/07/16
- [Qemu-devel] [PATCH v2 16/17] block: add default get_block_status implementation for protocols, Paolo Bonzini, 2013/07/16
- [Qemu-devel] [PATCH v2 17/17] block: look for zero blocks in bs->file, Paolo Bonzini, 2013/07/16
- Re: [Qemu-devel] [PATCH v2 17/17] block: look for zero blocks in bs->file, Eric Blake, 2013/07/19