From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <eduardo@habkost.net>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH v2 1/4] qom: allow to mark objects (including devices) as deprecated.
Date: Thu, 30 May 2024 13:27:14 +0200 [thread overview]
Message-ID: <20240530112718.1752905-2-kraxel@redhat.com> (raw)
In-Reply-To: <20240530112718.1752905-1-kraxel@redhat.com>
Add deprecation_note field (string) to ObjectClass.
Add deprecated bool to ObjectTypeInfo, report in 'qom-list-types'.
Print the note when listing devices via '-device help'.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
include/qom/object.h | 1 +
qom/qom-qmp-cmds.c | 4 ++++
system/qdev-monitor.c | 5 +++++
qapi/qom.json | 4 +++-
4 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/include/qom/object.h b/include/qom/object.h
index 13d3a655ddf9..6c682aa0135f 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -136,6 +136,7 @@ struct ObjectClass
ObjectUnparent *unparent;
GHashTable *properties;
+ const char *deprecation_note;
};
/**
diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c
index e91a2353472a..43de9c9ae141 100644
--- a/qom/qom-qmp-cmds.c
+++ b/qom/qom-qmp-cmds.c
@@ -101,6 +101,10 @@ static void qom_list_types_tramp(ObjectClass *klass, void *data)
if (parent) {
info->parent = g_strdup(object_class_get_name(parent));
}
+ if (klass->deprecation_note) {
+ info->has_deprecated = true;
+ info->deprecated = true;
+ }
QAPI_LIST_PREPEND(*pret, info);
}
diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
index 6af6ef7d667f..704be312e1a7 100644
--- a/system/qdev-monitor.c
+++ b/system/qdev-monitor.c
@@ -144,6 +144,8 @@ static bool qdev_class_has_alias(DeviceClass *dc)
static void qdev_print_devinfo(DeviceClass *dc)
{
+ ObjectClass *klass = OBJECT_CLASS(dc);
+
qemu_printf("name \"%s\"", object_class_get_name(OBJECT_CLASS(dc)));
if (dc->bus_type) {
qemu_printf(", bus %s", dc->bus_type);
@@ -157,6 +159,9 @@ static void qdev_print_devinfo(DeviceClass *dc)
if (!dc->user_creatable) {
qemu_printf(", no-user");
}
+ if (klass->deprecation_note) {
+ qemu_printf(", deprecated \"%s\"", klass->deprecation_note);
+ }
qemu_printf("\n");
}
diff --git a/qapi/qom.json b/qapi/qom.json
index 38dde6d785ac..bd062feabaf7 100644
--- a/qapi/qom.json
+++ b/qapi/qom.json
@@ -163,10 +163,12 @@
#
# @parent: Name of parent type, if any (since 2.10)
#
+# @deprecated: the type is deprecated (since 9.1)
+#
# Since: 1.1
##
{ 'struct': 'ObjectTypeInfo',
- 'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
+ 'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str', '*deprecated': 'bool' } }
##
# @qom-list-types:
--
2.45.1
next prev parent reply other threads:[~2024-05-30 11:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-30 11:27 [PATCH v2 0/4] allow to deprecate objects and devices Gerd Hoffmann
2024-05-30 11:27 ` Gerd Hoffmann [this message]
2024-05-30 12:42 ` [PATCH v2 1/4] qom: allow to mark objects (including devices) as deprecated Eric Blake
2024-06-03 11:42 ` Daniel P. Berrangé
2024-05-30 11:27 ` [PATCH v2 2/4] usb: add config options for the hub and hid devices Gerd Hoffmann
2024-06-03 15:12 ` Philippe Mathieu-Daudé
2024-05-30 11:27 ` [PATCH v2 3/4] usb/hub: deprecate, don't build by default Gerd Hoffmann
2024-05-30 11:27 ` [PATCH v2 4/4] vga/cirrus: " Gerd Hoffmann
2024-05-30 11:40 ` BALATON Zoltan
2024-05-30 12:22 ` Mark Cave-Ayland
2024-05-30 14:04 ` Gerd Hoffmann
2024-06-03 11:40 ` Daniel P. Berrangé
2024-06-03 11:49 ` Peter Maydell
2024-06-03 15:25 ` Philippe Mathieu-Daudé
2024-06-05 7:32 ` Gerd Hoffmann
2024-06-05 8:33 ` Daniel P. Berrangé
2024-06-04 6:50 ` Mark Cave-Ayland
2024-06-04 8:05 ` Daniel P. Berrangé
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=20240530112718.1752905-2-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).