Skip to content

Commit 9beccc2

Browse files
committed
Merge tag 'pull-qapi-2025-03-14' of https://repo.or.cz/qemu/armbru into staging
QAPI patches patches for 2025-03-14 # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmfT/U0SHGFybWJydUBy # ZWRoYXQuY29tAAoJEDhwtADrkYZThb4P/i2FNedYYeU+qOAtjKwCE0bnbtxWdthj # Zd+0u0LOXxkK7+nqgva+2+Szl4Ee0rYrbwVjd26nYRtB/m1/q1Glj1GTTAO+Xzpb # 3q4/ByFTDG3/mFktfVkE5HAJ7RGbjI3toRFWbpw1C4RabkX+dyZZ0MVwkfBwiyY7 # bEW7cW9OZlIXbMS867n7gURqEsD+LWXzxX5ozeWZGQVTp5nbQdubulYTkxJTXK+A # as2Q+RJhfB2lVJHAY3xN6R+gjHUNCBfwzfSFGMTMr+tYPeHZVssWeypXJJ9Qh7aA # dVLfVCY6PbstrGD1dGybIY1HfUTjJQNiyZ3qIoRfkxsfZcO7ru6Q5CMfEgxwcu53 # FaXLB3ra3R5cmYKFVeasEKHo/xsXeb3MAKCGLLqp7gC2GGdGvZAyHJevFZJslC+Q # /AbGtbmNYOYCkJdbT3r8bu9Qc7p2llw24Pjw/9I/qvwkKy3xdDyZQS+lT/vyYZvS # zc/hnlJR8UQvGXtzf0OrNCf8lDswNP6r51eTpno0OCQatrDi0ZjZqIOxHUUOn1pr # AE4JRDjtDoOqw8ltZxrulsiySSHewM4ouS3MXylpMk1PoWNq/6v8nUYL7p2RGgMq # FKyEdInExe1dWEjwaqPABBHdAWpZbmH0wmRLgeFaDvgmqqrOqFFeBKbgLFC2xcX5 # pgR35cz28GUh # =0HX3 # -----END PGP SIGNATURE----- # gpg: Signature made Fri 14 Mar 2025 05:56:29 EDT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "[email protected]" # gpg: Good signature from "Markus Armbruster <[email protected]>" [full] # gpg: aka "Markus Armbruster <[email protected]>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * tag 'pull-qapi-2025-03-14' of https://repo.or.cz/qemu/armbru: docs: enable transmogrifier for QSD and QGA docs: disambiguate references in qapi-domain.rst docs: add QAPI namespace "QMP" to qemu-qmp-ref docs/qapi-domain: add namespaced index support docs/qapi_domain: add namespace support to cross-references docs/qapidoc: add :namespace: option to qapi-doc directive docs/qapi-domain: add qapi:namespace directive docs/qapi-domain: add :namespace: override option docs/qapi_domain: add namespace support to FQN docs/qapi-domain: always store fully qualified name in signode docs/qapi_domain: isolate TYPE_CHECKING imports qapi/block-core: Improve x-blockdev-change documentation Signed-off-by: Stefan Hajnoczi <[email protected]>
2 parents 0462a32 + a6af544 commit 9beccc2

File tree

11 files changed

+315
-117
lines changed

11 files changed

+315
-117
lines changed

docs/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@
161161
"see also",
162162
}
163163

164+
# Due to a limitation in Sphinx, we need to know which indices to
165+
# generate in advance. Adding a namespace here allows that generation.
166+
qapi_namespaces = {
167+
"QGA",
168+
"QMP",
169+
"QSD",
170+
}
164171

165172
# -- Options for HTML output ----------------------------------------------
166173

docs/devel/qapi-domain.rst

Lines changed: 58 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -385,13 +385,13 @@ Type names in references can be surrounded by brackets, like
385385
``[typename]``, to indicate an array of that type. The cross-reference
386386
will apply only to the type name between the brackets. For example;
387387
``:qapi:type:`[Qcow2BitmapInfoFlags]``` renders to:
388-
:qapi:type:`[Qcow2BitmapInfoFlags]`
388+
:qapi:type:`[QMP:Qcow2BitmapInfoFlags]`
389389

390390
To indicate an optional argument/member in a field list, the type name
391391
can be suffixed with ``?``. The cross-reference will be transformed to
392392
"type, Optional" with the link applying only to the type name. For
393393
example; ``:qapi:type:`BitmapSyncMode?``` renders to:
394-
:qapi:type:`BitmapSyncMode?`
394+
:qapi:type:`QMP:BitmapSyncMode?`
395395

396396

397397
Namespaces
@@ -400,17 +400,38 @@ Namespaces
400400
Mimicking the `Python domain target specification syntax
401401
<https://www.sphinx-doc.org/en/master/usage/domains/python.html#target-specification>`_,
402402
QAPI allows you to specify the fully qualified path for a data
403-
type. QAPI enforces globally unique names, so it's unlikely you'll need
404-
this specific feature, but it may be extended in the near future to
405-
allow referencing identically named commands and data types from
406-
different utilities; i.e. QEMU Storage Daemon vs QMP.
403+
type.
407404

405+
* A namespace can be explicitly provided;
406+
e.g. ``:qapi:type:`QMP:BitmapSyncMode``
408407
* A module can be explicitly provided;
409-
``:qapi:type:`block-core.BitmapSyncMode``` will render to:
410-
:qapi:type:`block-core.BitmapSyncMode`
408+
``:qapi:type:`QMP:block-core.BitmapSyncMode``` will render to:
409+
:qapi:type:`QMP:block-core.BitmapSyncMode`
411410
* If you don't want to display the "fully qualified" name, it can be
412-
prefixed with a tilde; ``:qapi:type:`~block-core.BitmapSyncMode```
413-
will render to: :qapi:type:`~block-core.BitmapSyncMode`
411+
prefixed with a tilde; ``:qapi:type:`~QMP:block-core.BitmapSyncMode```
412+
will render to: :qapi:type:`~QMP:block-core.BitmapSyncMode`
413+
414+
415+
Target resolution
416+
-----------------
417+
418+
Any cross-reference to a QAPI type, whether using the ```any``` style of
419+
reference or the more explicit ```:qapi:any:`target``` syntax, allows
420+
for the presence or absence of either the namespace or module
421+
information.
422+
423+
When absent, their value will be inferred from context by the presence
424+
of any ``qapi:namespace`` or ``qapi:module`` directives preceding the
425+
cross-reference.
426+
427+
If no results are found when using the inferred values, other
428+
namespaces/modules will be searched as a last resort; but any explicitly
429+
provided values must always match in order to succeed.
430+
431+
This allows for efficient cross-referencing with a minimum of syntax in
432+
the large majority of cases, but additional context or namespace markup
433+
may be required outside of the QAPI reference documents when linking to
434+
items that share a name across multiple documented QAPI schema.
414435

415436

416437
Custom link text
@@ -423,7 +444,7 @@ using the ``custom text <target>`` syntax.
423444

424445
For example, ``:qapi:cmd:`Merge dirty bitmaps
425446
<block-dirty-bitmap-merge>``` will render as: :qapi:cmd:`Merge dirty
426-
bitmaps <block-dirty-bitmap-merge>`
447+
bitmaps <QMP:block-dirty-bitmap-merge>`
427448

428449

429450
Directives
@@ -464,8 +485,11 @@ removed in a future version.
464485
QAPI standard options
465486
---------------------
466487

467-
All QAPI directives -- *except* for module -- support these common options.
488+
All QAPI directives -- *except* for namespace and module -- support
489+
these common options.
468490

491+
* ``:namespace: name`` -- This option allows you to override the
492+
namespace association of a given definition.
469493
* ``:module: modname`` -- Borrowed from the Python domain, this option allows
470494
you to override the module association of a given definition.
471495
* ``:since: x.y`` -- Allows the documenting of "Since" information, which is
@@ -480,6 +504,28 @@ All QAPI directives -- *except* for module -- support these common options.
480504
production code.
481505

482506

507+
qapi:namespace
508+
--------------
509+
510+
The ``qapi:namespace`` directive marks the start of a QAPI namespace. It
511+
does not take a content body, nor any options. All subsequent QAPI
512+
directives are associated with the most recent namespace. This affects
513+
the definition's "fully qualified name", allowing two different
514+
namespaces to create an otherwise identically named definition.
515+
516+
This directive also influences how reference resolution works for any
517+
references that do not explicity specify a namespace, so this directive
518+
can be used to nudge references into preferring targets from within that
519+
namespace.
520+
521+
Example::
522+
523+
.. qapi:namespace:: QMP
524+
525+
526+
This directive has no visible effect.
527+
528+
483529
qapi:module
484530
-----------
485531

docs/interop/qemu-ga-ref.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ QEMU Guest Agent Protocol Reference
55
:depth: 3
66

77
.. qapi-doc:: qga/qapi-schema.json
8+
:transmogrify:
9+
:namespace: QGA

docs/interop/qemu-qmp-ref.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ QEMU QMP Reference Manual
88

99
.. qapi-doc:: qapi/qapi-schema.json
1010
:transmogrify:
11+
:namespace: QMP

docs/interop/qemu-storage-daemon-qmp-ref.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ QEMU Storage Daemon QMP Reference Manual
55
:depth: 3
66

77
.. qapi-doc:: storage-daemon/qapi/qapi-schema.json
8+
:transmogrify:
9+
:namespace: QSD

0 commit comments

Comments
 (0)