From: Zhao Liu <zhao1.liu@intel.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Markus Armbruster" <armbru@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
"Michael S . Tsirkin" <mst@redhat.com>,
BALATON Zoltan <balaton@eik.bme.hu>,
Mark Cave-Ayland <mark.caveayland@nutanix.com>,
devel@lists.libvirt.org, Zhao Liu <zhao1.liu@intel.com>
Subject: [RFC 03/10] qom: Check property deprecation flag for global property
Date: Wed, 3 Dec 2025 01:04:55 +0800 [thread overview]
Message-ID: <20251202170502.3228625-4-zhao1.liu@intel.com> (raw)
In-Reply-To: <20251202170502.3228625-1-zhao1.liu@intel.com>
Global properties can be set up in these cases:
1) external global properties:
* -global command line option.
* -cpu command line features.
* suger properties from object_compat_props[2]
2) internal global properties:
* compat properties from object_compat_props[0,1].
In principle, when a compat property is marked as deprecated, it should
not be added to any object_compat_props[] as a compat "fix". Therefore,
internal compat "global" property use cases should also be considered.
All of these global cases are using object_property_parse() to parse and
set propertyies, ao add a object_property_parse_with_check() to enable
deprecation checks for global properties.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
include/qom/object.h | 20 ++++++++++++++++++++
qom/object.c | 13 ++++++++++++-
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/include/qom/object.h b/include/qom/object.h
index 8f4c2f44d835..bdeba113f40f 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -1555,6 +1555,26 @@ bool object_property_set_full(Object *obj, const char *name,
bool object_property_parse(Object *obj, const char *name,
const char *string, Error **errp);
+/**
+ * object_property_parse_with_check:
+ *
+ * Same as object_property_parse() with extra check over property flags
+ * (ObjectPropertyFlags). This interface should be used to handle
+ * property settings for external users or internal legacy or compatibility
+ * cases.
+ *
+ * @obj: the object
+ * @name: the name of the property
+ * @string: the string that will be used to parse the property value.
+ * @errp: returns an error if this function fails
+ *
+ * Parses a string and writes the result into a property of an object.
+ *
+ * Returns: %true on success, %false on failure.
+ */
+bool object_property_parse_with_check(Object *obj, const char *name,
+ const char *string, Error **errp);
+
/**
* object_property_print:
* @obj: the object
diff --git a/qom/object.c b/qom/object.c
index 184afc6730dd..2973d8876555 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -460,7 +460,8 @@ bool object_apply_global_props(Object *obj, const GPtrArray *props,
continue;
}
p->used = true;
- if (!object_property_parse(obj, p->property, p->value, &err)) {
+ if (!object_property_parse_with_check(obj, p->property,
+ p->value, &err)) {
error_prepend(&err, "can't apply global %s.%s=%s: ",
p->driver, p->property, p->value);
/*
@@ -1745,6 +1746,16 @@ bool object_property_parse(Object *obj, const char *name,
return ok;
}
+bool object_property_parse_with_check(Object *obj, const char *name,
+ const char *string, Error **errp)
+{
+ Visitor *v = string_input_visitor_new(string);
+ bool ok = object_property_set_full(obj, name, v, true, errp);
+
+ visit_free(v);
+ return ok;
+}
+
char *object_property_print(Object *obj, const char *name, bool human,
Error **errp)
{
--
2.34.1
next prev parent reply other threads:[~2025-12-02 16:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-02 17:04 [RFC 00/10] qom: Support marking object properties as deprecated Zhao Liu
2025-12-02 17:04 ` [RFC 01/10] qom: Rename ObjectPropertyFlags to ObjectPropertyAccessorFlags Zhao Liu
2025-12-02 17:04 ` [RFC 02/10] qom: Add basic object property deprecation hint support Zhao Liu
2025-12-02 17:04 ` Zhao Liu [this message]
2025-12-02 17:04 ` [RFC 04/10] qom: Check property deprecation flag for properities from qdict Zhao Liu
2025-12-02 17:04 ` [RFC 05/10] system/vl: Check property deprecation flag for properities of accelerator Zhao Liu
2025-12-02 17:04 ` [RFC 06/10] qom/qom-hmp-cmd: Check property deprecation flag for "qom-set" command Zhao Liu
2025-12-02 17:04 ` [RFC 07/10] hw/core/qdev-properties: Allow to mark qdev property as deprecated Zhao Liu
2025-12-02 17:05 ` [RFC 08/10] target/i386: Deprecate fill-mtrr-mask property Zhao Liu
2025-12-02 17:05 ` [RFC 09/10] target/i386: Deprecate cpuid-0xb property Zhao Liu
2025-12-02 17:05 ` [RFC 10/10] hw/intc/ioapic: Deprecate version property Zhao Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251202170502.3228625-4-zhao1.liu@intel.com \
--to=zhao1.liu@intel.com \
--cc=armbru@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=berrange@redhat.com \
--cc=devel@lists.libvirt.org \
--cc=eduardo@habkost.net \
--cc=imammedo@redhat.com \
--cc=mark.caveayland@nutanix.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).