]> git.proxmox.com Git - mirror_qemu.git/commit - qemu-img.c
block: Switch transfer length bounds to byte-based
authorEric Blake <eblake@redhat.com>
Thu, 23 Jun 2016 22:37:19 +0000 (16:37 -0600)
committerKevin Wolf <kwolf@redhat.com>
Tue, 5 Jul 2016 14:46:25 +0000 (16:46 +0200)
commit5def6b80e1eca696c1fc6099e7f4d36729686402
tree5948b16242a3b57bb1dffa6c650ef05e9154f59e
parent79ba8c986adb9ca07f52abd0b3d33c3aee8e6ff9
block: Switch transfer length bounds to byte-based

Sector-based limits are awkward to think about; in our on-going
quest to move to byte-based interfaces, convert max_transfer_length
and opt_transfer_length.  Rename them (dropping the _length suffix)
so that the compiler will help us catch the change in semantics
across any rebased code, and improve the documentation.  Use unsigned
values, so that we don't have to worry about negative values and
so that bit-twiddling is easier; however, we are still constrained
by 2^31 of signed int in most APIs.

When a value comes from an external source (iscsi and raw-posix),
sanitize the results to ensure that opt_transfer is a power of 2.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/block-backend.c
block/io.c
block/iscsi.c
block/nbd.c
block/raw-posix.c
hw/block/virtio-blk.c
hw/scsi/scsi-generic.c
include/block/block_int.h
include/sysemu/block-backend.h
qemu-img.c