From nobody Fri Nov 14 03:47:36 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584446314; cv=none; d=zohomail.com; s=zohoarc; b=OnbuTJ9l3e25NTd3XqULMpBm5tqCpVMtV9NWZA3VQ6ROMJXZghLwXSRm+IRYWST3kgOOhYICz22uyH5XDnqEAGyzFeVojujaIepcNkv27BqkB/k/yDW05tO4Npd3KCuDp+aBu0xo4c1ynlHvcfkmrJ8v4iWNbqLJvDO7FkK4Dmw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584446314; 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=BMAiTQHwLDlJaV8j1xo9Y/A4zk6T4gUIm/WSSe4QRmQ=; b=VC2MH5UOALGeuMjxn/zTXBRYr9xjZdVNqqHlg04Xo5r3PiJVqBopyitPzngb1tBCaoib9GwolEKs4IoqPnKDbU+q3AY0u93/7BlIw/7vHdnWgLfxBegPJme3/FR6HZBhvvfLn3aCWjLPnk/ULVPp3beyFuLGvjRSLbd8agnnZNI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158444631405439.927221605025125; Tue, 17 Mar 2020 04:58:34 -0700 (PDT) Received: from localhost ([::1]:59658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEArg-0004fJ-Uq for importer@patchew.org; Tue, 17 Mar 2020 07:58:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56569) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEAoN-0007j9-Jb for qemu-devel@nongnu.org; Tue, 17 Mar 2020 07:55:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEAoL-0005F5-LF for qemu-devel@nongnu.org; Tue, 17 Mar 2020 07:55:07 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:51833) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jEAoL-0005EX-Ec for qemu-devel@nongnu.org; Tue, 17 Mar 2020 07:55:05 -0400 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-421-j2MJDn5ANzCkn5EERTjlGg-1; Tue, 17 Mar 2020 07:55:03 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 57B23192203D; Tue, 17 Mar 2020 11:55:02 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-130.ams2.redhat.com [10.36.112.130]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 78AD010372D5; Tue, 17 Mar 2020 11:55:01 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 034C211366D1; Tue, 17 Mar 2020 12:55:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584446105; h=from:from: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; bh=BMAiTQHwLDlJaV8j1xo9Y/A4zk6T4gUIm/WSSe4QRmQ=; b=hu5Bos8/HwBy7G/Z4WrhzatAdy3SubWtJucQWQf99h92DQ3U+OtS/MfWLYa0z9PXq7/MjP 1FR1M49gEm5RNKW3FvOdAfZZuiG8yTimakHrRZ9x7uhRCIZk4QiFQwyn+R1+sVRtJWGvPk kura0KgIfiXD8Al3hdWoDQyRHVQSBX4= X-MC-Unique: j2MJDn5ANzCkn5EERTjlGg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v4 04/34] docs/devel/qapi-code-gen: Document 'features' introspection Date: Tue, 17 Mar 2020 12:54:29 +0100 Message-Id: <20200317115459.31821-5-armbru@redhat.com> In-Reply-To: <20200317115459.31821-1-armbru@redhat.com> References: <20200317115459.31821-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@gmail.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Commit 6a8c0b5102 "qapi: Add feature flags to struct types" neglected to update section "Client JSON Protocol introspection", and commit 23394b4c39 "qapi: Add feature flags to commands" didn't either. Make up for that. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- docs/devel/qapi-code-gen.txt | 43 +++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index 5906602504..297a725084 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -642,13 +642,8 @@ that previously resulted in an error). QMP clients ma= y still need to know whether the extension is available. =20 For this purpose, a list of features can be specified for a command or -struct type. This is exposed to the client as a list of strings, -where each string signals that this build of QEMU shows a certain -behaviour. - -Each member of the 'features' array defines a feature. It can either -be { 'name': STRING, '*if': COND }, or STRING, which is shorthand for -{ 'name': STRING }. +struct type. Each list member can either be { 'name': STRING, '*if': +COND }, or STRING, which is shorthand for { 'name': STRING }. =20 The optional 'if' member specifies a conditional. See "Configuring the schema" below for more on this. @@ -659,6 +654,12 @@ Example: 'data': { 'number': 'int' }, 'features': [ 'allow-negative-numbers' ] } =20 +The feature strings are exposed to clients in introspection, as +explained in section "Client JSON Protocol introspection". + +Intended use is to have each feature string signal that this build of +QEMU shows a certain behaviour. + =20 =3D=3D=3D Naming rules and reserved names =3D=3D=3D =20 @@ -965,7 +966,7 @@ schema, along with the SchemaInfo type. This text atte= mpts to give an overview how things work. For details you need to consult the QAPI schema. =20 -SchemaInfo objects have common members "name" and "meta-type", and +SchemaInfo objects have common members "name", "meta-type", and additional variant members depending on the value of meta-type. =20 Each SchemaInfo object describes a wire ABI entity of a certain @@ -985,12 +986,13 @@ references by name. QAPI schema definitions not reachable that way are omitted. =20 The SchemaInfo for a command has meta-type "command", and variant -members "arg-type", "ret-type" and "allow-oob". On the wire, the -"arguments" member of a client's "execute" command must conform to the -object type named by "arg-type". The "return" member that the server -passes in a success response conforms to the type named by "ret-type". -When "allow-oob" is true, it means the command supports out-of-band -execution. It defaults to false. +members "arg-type", "ret-type", "allow-oob", and "features". On the +wire, the "arguments" member of a client's "execute" command must +conform to the object type named by "arg-type". The "return" member +that the server passes in a success response conforms to the type +named by "ret-type". When "allow-oob" is true, it means the command +supports out-of-band execution. It defaults to false. "features" +exposes the command's feature strings as a JSON array of strings. =20 If the command takes no arguments, "arg-type" names an object type without members. Likewise, if the command returns nothing, "ret-type" @@ -1025,7 +1027,8 @@ Example: the SchemaInfo for EVENT_C from section Even= ts =20 The SchemaInfo for struct and union types has meta-type "object". =20 -The SchemaInfo for a struct type has variant member "members". +The SchemaInfo for a struct type has variant members "members" and +"features". =20 The SchemaInfo for a union type additionally has variant members "tag" and "variants". @@ -1047,6 +1050,16 @@ Example: the SchemaInfo for MyType from section Stru= ct types { "name": "member2", "type": "int" }, { "name": "member3", "type": "str", "default": null } ] } =20 +"features" exposes the command's feature strings as a JSON array of +strings. + +Example: the SchemaInfo for TestType from section Features: + + { "name": "TestType", "meta-type": "object", + "members": [ + { "name": "number", "type": "int" } ], + "features": ["allow-negative-numbers"] } + "tag" is the name of the common member serving as type tag. "variants" is a JSON array describing the object's variant members. Each element is a JSON object with members "case" (the value of type --=20 2.21.1