[SLOF] [PATCH v4 01/23] virtio-blk: fix gcc warnings (-Wextra)

Thomas Huth thuth at redhat.com
Fri Jan 29 03:43:06 AEDT 2016


On 28.01.2016 11:24, Nikunj A Dadhania wrote:
> Change variable type of capacity
> 
> Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
> ---
>  lib/libvirtio/virtio-blk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/libvirtio/virtio-blk.c b/lib/libvirtio/virtio-blk.c
> index 826f2ea..1e01c14 100644
> --- a/lib/libvirtio/virtio-blk.c
> +++ b/lib/libvirtio/virtio-blk.c
> @@ -93,7 +93,7 @@ virtioblk_read(struct virtio_device *dev, char *buf, long blocknum, long cnt)
>  	int id;
>  	static struct virtio_blk_req blkhdr;
>  	//struct virtio_blk_config *blkconf;
> -	uint64_t capacity;
> +	long capacity;
>  	uint32_t vq_size, time;
>  	struct vring_desc *vq_desc;		/* Descriptor vring */
>  	struct vring_avail *vq_avail;		/* "Available" vring */

Have you considered changing "blocknum" to "unsigned long" or "uint64_t"
instead? Both blocknum and capacity should never be negative, so using
an unsigned type for both of them sounds better to me.

 Thomas




More information about the SLOF mailing list