From nobody Sat Feb 7 05:57:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635139626; cv=none; d=zohomail.com; s=zohoarc; b=AxeRr85BmDw3SiLmWMqgbAXUXEHHafIixhGfvZqI3P+dFvBndF37ISXpML3VBIplYlE2Xvk8LtIOTpwbYSgfxDj7R2cVXiHDRYsoIM/hgYbN+hEtJSlaxhbIVs2LhaCchmgqMpdYf9ZnuMvIrxFtn+dj8Qv8d5F1wlPsuyRhy+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635139626; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QaSqOtQSZ3U6D/KP50cN1j58gfn+YZlEzo2vi3miaOk=; b=cGjMDSthgD1YEMbhLflhhehcpP3s0h7i3cj7x+Mm6vfDijNWYcWCrCZKg09FR7kee00vJIT+UG6yYB5nbwpD7Nop30A0ENFXRgydsYugxaUR1gdTLdIlgrDkWlCt+RPQWcRkDM+V/onf4ObXmshE3/BOAvAlTMY2zAfiAm8Msu8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1635139626366597.4903266534682; Sun, 24 Oct 2021 22:27:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-28-yjPAKZ6_NA6vJgQUVqEGsA-1; Mon, 25 Oct 2021 01:26:20 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B16828026AD; Mon, 25 Oct 2021 05:26:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8FC5C19D9D; Mon, 25 Oct 2021 05:26:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5427C4EA42; Mon, 25 Oct 2021 05:26:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19P5PmZ9019903 for ; Mon, 25 Oct 2021 01:25:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7264D5BAE6; Mon, 25 Oct 2021 05:25:48 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 498E160862; Mon, 25 Oct 2021 05:25:34 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id DB7B911380C3; Mon, 25 Oct 2021 07:25:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635139625; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=QaSqOtQSZ3U6D/KP50cN1j58gfn+YZlEzo2vi3miaOk=; b=d7BIqKDBAPjulupKGvo+kpwHGh4XygpDG21KI6j6Wo4T6eg3n6eeLdsRdEv4ghFBNc/5DZ zl5La3RAYUjtpeYmdMh7e6wGwhxWtil0gjl4zN7xKhY7qnxjmEiFjWqMNFdnla1/UHpsn8 PV+rPpxQGGXxLUhjmvaHEt4acYF1Pts= X-MC-Unique: yjPAKZ6_NA6vJgQUVqEGsA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 4/9] qapi: Tools for sets of special feature flags in generated code Date: Mon, 25 Oct 2021 07:25:27 +0200 Message-Id: <20211025052532.3859634-5-armbru@redhat.com> In-Reply-To: <20211025052532.3859634-1-armbru@redhat.com> References: <20211025052532.3859634-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, libvir-list@redhat.com, eblake@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, jsnow@redhat.com, libguestfs@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635139628338100005 Content-Type: text/plain; charset="utf-8" New enum QapiSpecialFeature enumerates the special feature flags. New helper gen_special_features() returns code to represent a collection of special feature flags as a bitset. The next few commits will put them to use. Signed-off-by: Markus Armbruster Reviewed-by: John Snow --- include/qapi/util.h | 4 ++++ scripts/qapi/gen.py | 13 +++++++++++++ scripts/qapi/schema.py | 3 +++ 3 files changed, 20 insertions(+) diff --git a/include/qapi/util.h b/include/qapi/util.h index 257c600f99..7a8d5c7d72 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -11,6 +11,10 @@ #ifndef QAPI_UTIL_H #define QAPI_UTIL_H =20 +typedef enum { + QAPI_DEPRECATED, +} QapiSpecialFeature; + /* QEnumLookup flags */ #define QAPI_ENUM_DEPRECATED 1 =20 diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 2ec1e7b3b6..9d07b88cf6 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -29,6 +29,7 @@ mcgen, ) from .schema import ( + QAPISchemaFeature, QAPISchemaIfCond, QAPISchemaModule, QAPISchemaObjectType, @@ -37,6 +38,18 @@ from .source import QAPISourceInfo =20 =20 +def gen_special_features(features: QAPISchemaFeature): + ret =3D '' + sep =3D '' + + for feat in features: + if feat.is_special(): + ret +=3D ('%s1u << QAPI_%s' % (sep, feat.name.upper())) + sep =3D ' | ' + + return ret or '0' + + class QAPIGen: def __init__(self, fname: str): self.fname =3D fname diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 6d5f46509a..55f82d7389 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -725,6 +725,9 @@ def connect_doc(self, doc): class QAPISchemaFeature(QAPISchemaMember): role =3D 'feature' =20 + def is_special(self): + return self.name in ('deprecated') + =20 class QAPISchemaObjectTypeMember(QAPISchemaMember): def __init__(self, name, info, typ, optional, ifcond=3DNone, features= =3DNone): --=20 2.31.1