From c4cdf54cff933d7176083581523748d4171db6e6 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 27 Oct 2020 13:10:26 +0100 Subject: [PATCH 1/5] docs/devel/qapi-code-gen: Fix up examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Markus Armbruster Message-Id: <20201027121026.3025930-1-armbru@redhat.com> Reviewed-by: Marc-André Lureau --- docs/devel/qapi-code-gen.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index c6438c6aa9..6906a06ad2 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -393,7 +393,7 @@ is identical on the wire to: { 'enum': 'Enum', 'data': ['one', 'two'] } { 'struct': 'Branch1', 'data': { 'data': 'str' } } { 'struct': 'Branch2', 'data': { 'data': 'int' } } - { 'union': 'Flat': 'base': { 'type': 'Enum' }, 'discriminator': 'type', + { 'union': 'Flat', 'base': { 'type': 'Enum' }, 'discriminator': 'type', 'data': { 'one': 'Branch1', 'two': 'Branch2' } } The optional 'if' member specifies a conditional. See "Configuring @@ -590,6 +590,8 @@ When in doubt, do not implement OOB execution support. Member 'allow-preconfig' declares whether the command is available before the machine is built. It defaults to false. For example: + { 'enum': 'QMPCapability', + 'data': [ 'oob' ] } { 'command': 'qmp_capabilities', 'data': { '*enable': [ 'QMPCapability' ] }, 'allow-preconfig': true } @@ -824,7 +826,7 @@ Example: a struct with conditional feature 'allow-negative-numbers' { 'struct': 'TestType', 'data': { 'number': 'int' }, 'features': [ { 'name': 'allow-negative-numbers', - 'if' 'defined(IFCOND)' } ] } + 'if': 'defined(IFCOND)' } ] } Please note that you are responsible to ensure that the C code will compile with an arbitrary combination of conditions, since the From 92a3c6aac8da5f97f7ec86d12c2d0417cc3bf325 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 2 Nov 2020 09:15:49 +0100 Subject: [PATCH 2/5] MAINTAINERS: Add QAPI schema modules to their subsystems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the relevant QAPI schema modules to section Audio, QMP, Tracing, Cryptography. Cc: Gerd Hoffmann Cc: Stefan Hajnoczi Cc: Daniel P. Berrange Signed-off-by: Markus Armbruster Message-Id: <20201102081550.171061-2-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi Acked-by: Daniel P. Berrangé --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 63223e1183..30e1eccbec 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1909,6 +1909,7 @@ Rocker M: Jiri Pirko S: Maintained F: hw/net/rocker/ +F: qapi/rocker.json F: tests/rocker/ F: docs/specs/rocker.txt @@ -2111,6 +2112,7 @@ S: Maintained F: audio/ F: hw/audio/ F: include/hw/audio/ +F: qapi/audio.json F: tests/qtest/ac97-test.c F: tests/qtest/es1370-test.c F: tests/qtest/intel-hda-test.c @@ -2490,7 +2492,9 @@ F: monitor/monitor-internal.h F: monitor/qmp* F: monitor/misc.c F: monitor/monitor.c +F: qapi/control.json F: qapi/error.json +F: qapi/introspect.json F: docs/devel/*qmp-* F: docs/interop/*qmp-* F: scripts/qmp/ @@ -2551,6 +2555,7 @@ S: Maintained F: trace/ F: trace-events F: docs/qemu-option-trace.rst.inc +F: qapi/trace.json F: scripts/tracetool.py F: scripts/tracetool/ F: scripts/qemu-trace-stap* @@ -2610,6 +2615,7 @@ M: Daniel P. Berrange S: Maintained F: crypto/ F: include/crypto/ +F: qapi/crypto.json F: tests/test-crypto-* F: tests/benchmark-crypto-* F: tests/crypto-tls-* From a1d12a2148e75dc67743de9c45bf925ca6f26739 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 2 Nov 2020 09:15:50 +0100 Subject: [PATCH 3/5] qapi: Fix missing headers in QMP Reference Manual MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Audio stuff is under "Miscellanea", and authorization stuff is under "Input". Add suitable header doc comments to correct that. Cc: Gerd Hoffmann Cc: Daniel P. Berrange Signed-off-by: Markus Armbruster Message-Id: <20201102081550.171061-3-armbru@redhat.com> Acked-by: Daniel P. Berrangé --- qapi/audio.json | 4 ++++ qapi/authz.json | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/qapi/audio.json b/qapi/audio.json index 3b843878d2..072ed79def 100644 --- a/qapi/audio.json +++ b/qapi/audio.json @@ -5,6 +5,10 @@ # This work is licensed under the terms of the GNU GPL, version 2 or later. # See the COPYING file in the top-level directory. +## +# = Audio +## + ## # @AudiodevPerDirectionOptions: # diff --git a/qapi/authz.json b/qapi/authz.json index f3e9745426..42afe752d1 100644 --- a/qapi/authz.json +++ b/qapi/authz.json @@ -1,7 +1,9 @@ # -*- Mode: Python -*- # vim: filetype=python -# -# QAPI authz definitions + +## +# = User authorization +## ## # @QAuthZListPolicy: From ffb515fa50c286ec572a0dcc3923652085dd63f8 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Wed, 4 Nov 2020 17:55:12 +0100 Subject: [PATCH 4/5] qapi/block-core: Improve MapEntry documentation MapEntry and BlockDeviceMapEntry are kind of the same thing, and the latter is not used, so we want to remove it. However, the documentation it provides for some fields is better than that of MapEntry, so steal some of it for the latter. (And adjust them a bit in the process, because I feel like we can make them even clearer.) Signed-off-by: Max Reitz Message-Id: <20201104165513.72720-2-mreitz@redhat.com> Acked-by: Markus Armbruster Signed-off-by: Markus Armbruster --- qapi/block-core.json | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 1b8b4156b4..3f86675357 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -244,17 +244,25 @@ # # Mapping information from a virtual block range to a host file range # -# @start: the start byte of the mapped virtual range +# @start: virtual (guest) offset of the first byte described by this +# entry # # @length: the number of bytes of the mapped virtual range # -# @data: whether the mapped range has data +# @data: reading the image will actually read data from a file (in +# particular, if @offset is present this means that the sectors +# are not simply preallocated, but contain actual data in raw +# format) # -# @zero: whether the virtual blocks are zeroed +# @zero: whether the virtual blocks read as zeroes # -# @depth: the depth of the mapping +# @depth: number of layers (0 = top image, 1 = top image's backing +# file, ..., n - 1 = bottom image (where n is the number of +# images in the chain)) before reaching one for which the +# range is allocated # -# @offset: the offset in file that the virtual sectors are mapped to +# @offset: if present, the image file stores the data for this range +# in raw format at the given (host) offset # # @filename: filename that is referred to by @offset # From 143d51e1792ecf2c8e5b0fc3a8c6022676c723d4 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 4 Nov 2020 17:55:13 +0100 Subject: [PATCH 5/5] block: Remove unused BlockDeviceMapEntry BlockDeviceMapEntry has never been used. It was added in commit facd6e2 "so that it is published through the introspection mechanism." What exactly introspecting types that aren't used for anything could accomplish isn't clear. What "introspection mechanism" to use is also nebulous. To the best of my knowledge, there has never been one that covered this type. Certainly not query-qmp-schema, which includes only types that are actually used in QMP. Not being able to introspect BlockDeviceMapEntry hasn't bothered anyone enough to complain in almost four years. Get rid of it. Cc: Paolo Bonzini Cc: Eric Blake Reviewed-by: Eric Blake Signed-off-by: Markus Armbruster Message-Id: <20201104165513.72720-3-mreitz@redhat.com> --- qapi/block-core.json | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 3f86675357..04ad80bc1e 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -426,35 +426,6 @@ ## { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] } -## -# @BlockDeviceMapEntry: -# -# Entry in the metadata map of the device (returned by "qemu-img map") -# -# @start: Offset in the image of the first byte described by this entry -# (in bytes) -# -# @length: Length of the range described by this entry (in bytes) -# -# @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.) -# before reaching one for which the range is allocated. The value is -# in the range 0 to the depth of the image chain - 1. -# -# @zero: the sectors in this range read as zeros -# -# @data: reading the image will actually read data from a file (in particular, -# if @offset is present this means that the sectors are not simply -# preallocated, but contain actual data in raw format) -# -# @offset: if present, the image file stores the data for this range in -# raw format at the given offset. -# -# Since: 1.7 -## -{ 'struct': 'BlockDeviceMapEntry', - 'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool', - 'data': 'bool', '*offset': 'int' } } - ## # @DirtyBitmapStatus: #