From nobody Mon Nov 25 08:48:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1717068501; cv=none; d=zohomail.com; s=zohoarc; b=naOV0CDgeE+/M/CUlD4dQXN+AZw99aph8OWZH7AOU5o518LW4EDu9dVI6OWedyWSgWlSs/ZawTQMP7i6CpoBJjYA4zrwC7hu5V6QpT0VmbbVmT8t6WAb22SXL8AMiWKa1TDk627vpWxrVzg8lvFE1VrqtI0eKHSo6OfFPPfhEmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717068501; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Md1MVArHUd05WOeyAIhNVCIfQzrbfrJLv5muxML0fkM=; b=bUIU0uYDLJYwEbvcIeFPGWpY1LV6K98KRMozpQ0NW/IdaO1fq4TyNfcXuItv01XgILUivbHukbB8jfjvKsNcHCm/8sA3qbvO2Ocjmarr0XofZ8VgJf4scCb8tzi+PDD8cOrtr38DXQ/aHhgP15NmH05cNDT7nYK2L7Bgd98Y57s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717068501401535.2012552449478; Thu, 30 May 2024 04:28:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCdwU-0006P6-W8; Thu, 30 May 2024 07:27:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCdwP-0006LV-9a for qemu-devel@nongnu.org; Thu, 30 May 2024 07:27:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCdwK-0003cF-Mi for qemu-devel@nongnu.org; Thu, 30 May 2024 07:27:28 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-396-e5_-femtMe2HQbxkt-J_LQ-1; Thu, 30 May 2024 07:27:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8A92A29AA381; Thu, 30 May 2024 11:27:20 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.101]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D7C5103A3AA; Thu, 30 May 2024 11:27:19 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4FE1E18000B2; Thu, 30 May 2024 13:27:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717068444; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Md1MVArHUd05WOeyAIhNVCIfQzrbfrJLv5muxML0fkM=; b=O2AMqvyldhulwzSe59aB5YpPbM0/tN4J/rBgz3H+G9fFSWxGX2q+yU8qrVSU9RkuFj/ejI WEOnnBQlzyXpJWRMFKejbBrzmA+HI4BbIW9ZgmifBb5Ep5BCPjlRwT0mjlKrurUhiJNUCX 9+82+FVFT0YPkQR1JtIa6/BtvEjYev4= X-MC-Unique: e5_-femtMe2HQbxkt-J_LQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Gerd Hoffmann , Eric Blake , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 1/4] qom: allow to mark objects (including devices) as deprecated. Date: Thu, 30 May 2024 13:27:14 +0200 Message-ID: <20240530112718.1752905-2-kraxel@redhat.com> In-Reply-To: <20240530112718.1752905-1-kraxel@redhat.com> References: <20240530112718.1752905-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.085, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1717068502915100006 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Eric Blake --- 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; =20 GHashTable *properties; + const char *deprecation_note; }; =20 /** 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, v= oid *data) if (parent) { info->parent =3D g_strdup(object_class_get_name(parent)); } + if (klass->deprecation_note) { + info->has_deprecated =3D true; + info->deprecated =3D true; + } =20 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) =20 static void qdev_print_devinfo(DeviceClass *dc) { + ObjectClass *klass =3D 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"); } =20 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', '*deprec= ated': 'bool' } } =20 ## # @qom-list-types: --=20 2.45.1