[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 4/8] qdev-properties: add size32 property type
- To: Roman Kagan <rvkagan@xxxxxxxxxxxxxx>, qemu-devel@xxxxxxxxxx
- From: Eric Blake <eblake@xxxxxxxxxx>
- Date: Thu, 28 May 2020 16:45:19 -0500
- Cc: Kevin Wolf <kwolf@xxxxxxxxxx>, Fam Zheng <fam@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Daniel P. Berrangé <berrange@xxxxxxxxxx>, Eduardo Habkost <ehabkost@xxxxxxxxxx>, qemu-block@xxxxxxxxxx, Paul Durrant <paul@xxxxxxx>, Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Laurent Vivier <laurent@xxxxxxxxx>, Max Reitz <mreitz@xxxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, Stefan Hajnoczi <stefanha@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Keith Busch <kbusch@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, John Snow <jsnow@xxxxxxxxxx>
- Delivery-date: Thu, 28 May 2020 21:45:54 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 5/28/20 4:39 PM, Roman Kagan wrote:
Introduce size32 property type which handles size suffixes (k, m) just
like size property, but is uint32_t rather than uint64_t.
Does it handle 'g' as well? (even though the set of valid 32-bit sizes
with a g suffix is rather small ;)
It's going to
be useful for properties that are byte sizes but are inherently 32bit,
like BlkConf.opt_io_size or .discard_granularity (they are switched to
this new property type in a followup commit).
The getter for size32 is left out for a separate patch as its benefit is
less obvious, and it affects test output; for now the regular uint32
getter is used.
Signed-off-by: Roman Kagan <rvkagan@xxxxxxxxxxxxxx>
---
+static void set_size32(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
+{
+ DeviceState *dev = DEVICE(obj);
+ Property *prop = opaque;
+ uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint64_t value;
+ Error *local_err = NULL;
+
+ if (dev->realized) {
+ qdev_prop_set_after_realize(dev, name, errp);
+ return;
+ }
+
+ visit_type_size(v, name, &value, &local_err);
Yes, it does.
Whether or not the commit message is tweaked,
Reviewed-by: Eric Blake <eblake@xxxxxxxxxx>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
|