block: make BlockConf size props 32bit and accept size suffixes

Convert all size-related properties in BlockConf to 32bit.  This will
accommodate bigger block sizes (in a followup patch).  This also allows
to make them all accept size suffixes, either via DEFINE_PROP_BLOCKSIZE
or via DEFINE_PROP_SIZE32.

Also, since min_io_size is exposed to the guest by scsi and virtio-blk
devices as an uint16_t in units of logical blocks, introduce an
additional check in blkconf_blocksizes to prevent its silent truncation.

Signed-off-by: Roman Kagan <rvkagan@yandex-team.ru>
Message-Id: <20200528225516.1676602-7-rvkagan@yandex-team.ru>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Roman Kagan 2020-05-29 01:55:14 +03:00 committed by Kevin Wolf
parent 645b55d1c2
commit 4f44bbc5bb
4 changed files with 19 additions and 9 deletions

View file

@ -782,7 +782,7 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
uint16_t *ptr = qdev_get_prop_ptr(dev, prop);
uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
uint64_t value;
Error *local_err = NULL;
@ -821,7 +821,7 @@ const PropertyInfo qdev_prop_blocksize = {
.name = "size",
.description = "A power of two between " MIN_BLOCK_SIZE_STR
" and " MAX_BLOCK_SIZE_STR,
.get = get_uint16,
.get = get_uint32,
.set = set_blocksize,
.set_default_value = set_default_value_uint,
};