[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/56] qdev-properties: PropertyInfo: add realized_set_allowed fie
From: |
Hanna Reitz |
Subject: |
[PULL 23/56] qdev-properties: PropertyInfo: add realized_set_allowed field |
Date: |
Wed, 1 Sep 2021 17:15:46 +0200 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Add field, so property can declare support for setting the property
when device is realized. To be used in the following commit.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210824083856.17408-4-vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
include/hw/qdev-properties.h | 1 +
hw/core/qdev-properties.c | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 0ef97d60ce..f7925f67d0 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -32,6 +32,7 @@ struct PropertyInfo {
const char *name;
const char *description;
const QEnumLookup *enum_table;
+ bool realized_set_allowed; /* allow setting property on realized device */
int (*print)(Object *obj, Property *prop, char *dest, size_t len);
void (*set_default_value)(ObjectProperty *op, const Property *prop);
ObjectProperty *(*create)(ObjectClass *oc, const char *name,
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 50f40949f5..c34aac6ebc 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -26,11 +26,11 @@ void qdev_prop_set_after_realize(DeviceState *dev, const
char *name,
/* returns: true if property is allowed to be set, false otherwise */
static bool qdev_prop_allow_set(Object *obj, const char *name,
- Error **errp)
+ const PropertyInfo *info, Error **errp)
{
DeviceState *dev = DEVICE(obj);
- if (dev->realized) {
+ if (dev->realized && !info->realized_set_allowed) {
qdev_prop_set_after_realize(dev, name, errp);
return false;
}
@@ -79,7 +79,7 @@ static void field_prop_set(Object *obj, Visitor *v, const
char *name,
{
Property *prop = opaque;
- if (!qdev_prop_allow_set(obj, name, errp)) {
+ if (!qdev_prop_allow_set(obj, name, prop->info, errp)) {
return;
}
--
2.31.1
- [PULL 12/56] qemu-iotests: allow valgrind to read/delete the generated log file, (continued)
- [PULL 12/56] qemu-iotests: allow valgrind to read/delete the generated log file, Hanna Reitz, 2021/09/01
- [PULL 13/56] qemu-iotests: insert valgrind command line as wrapper for qemu binary, Hanna Reitz, 2021/09/01
- [PULL 14/56] docs/devel/testing: add -valgrind option to the debug section of QEMU iotests, Hanna Reitz, 2021/09/01
- [PULL 16/56] docs/devel/testing: add -p option to the debug section of QEMU iotests, Hanna Reitz, 2021/09/01
- [PULL 17/56] block/monitor: Consolidate hmp_handle_error calls to reduce redundant code, Hanna Reitz, 2021/09/01
- [PULL 18/56] raw-format: drop WRITE and RESIZE child perms when possible, Hanna Reitz, 2021/09/01
- [PULL 15/56] qemu-iotests: add option to show qemu binary logs on stdout, Hanna Reitz, 2021/09/01
- [PULL 19/56] iotests: use with-statement for open() calls, Hanna Reitz, 2021/09/01
- [PULL 21/56] block: introduce bdrv_replace_child_bs(), Hanna Reitz, 2021/09/01
- [PULL 20/56] iotests: use subprocess.DEVNULL instead of open("/dev/null"), Hanna Reitz, 2021/09/01
- [PULL 23/56] qdev-properties: PropertyInfo: add realized_set_allowed field,
Hanna Reitz <=
- [PULL 22/56] block: introduce blk_replace_bs, Hanna Reitz, 2021/09/01
- [PULL 24/56] qdev: allow setting drive property for realized device, Hanna Reitz, 2021/09/01
- [PULL 25/56] block: rename backup-top to copy-before-write, Hanna Reitz, 2021/09/01
- [PULL 26/56] block-copy: move detecting fleecing scheme to block-copy, Hanna Reitz, 2021/09/01
- [PULL 28/56] block/backup: set copy_range and compress after filter insertion, Hanna Reitz, 2021/09/01
- [PULL 27/56] block/block-copy: introduce block_copy_set_copy_opts(), Hanna Reitz, 2021/09/01
- [PULL 31/56] block/copy-before-write: drop extra bdrv_unref on failure path, Hanna Reitz, 2021/09/01
- [PULL 29/56] block/backup: move cluster size calculation to block-copy, Hanna Reitz, 2021/09/01
- [PULL 33/56] block/copy-before-write: bdrv_cbw_append(): replace child at last, Hanna Reitz, 2021/09/01
- [PULL 30/56] block/copy-before-write: relax permission requirements when no parents, Hanna Reitz, 2021/09/01