[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v7 4/8] qdev-properties: add size32 property type
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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |