qemu/docs/devel
John Snow 7127e14f15 docs/qapi_domain: add namespace support to cross-references
This patch does three things:

1. Record the current namespace context in pending_xrefs so it can be
   used for link resolution later,
2. Pass that recorded namespace context to find_obj() when resolving a
   reference, and
3. Wildly and completely rewrite find_obj().

cross-reference support is expanded to tolerate the presence or absence
of either namespace or module, and to cope with the presence or absence
of contextual information for either.

References now work like this:

1. If the explicit reference target is recorded in the domain's object
   registry, we link to that target and stop looking. We do this lookup
   regardless of how fully qualified the target is, which allows direct
   references to modules (which don't have a module component to their
   names) or direct references to definitions that may or may not belong
   to a namespace or module.

2. If contextual information is available from qapi:namespace or
   qapi:module directives, try using those components to find a direct
   match to the implied target name.

3. If both prior lookups fail, generate a series of regular expressions
   looking for wildcard matches in order from most to least
   specific. Any explicitly provided components (namespace, module)
   *must* match exactly, but both contextual and entirely omitted
   components are allowed to differ from the search result. Note that if
   more than one result is found, Sphinx will emit a warning (a build
   error for QEMU) and list all of the candidate references.

The practical upshot is that in the large majority of cases, namespace
and module information is not required when creating simple `references`
to definitions from within the same context -- even when identical
definitions exist in other contexts.

Even when using simple `references` from elsewhere in the QEMU
documentation manual, explicit namespace info is not required if there
is only one definition by that name.

Disambiguation *will* be required from outside of the QAPI documentation
when referencing e.g. block-core definitions, which are shared between
QEMU QMP and the QEMU Storage Daemon. In that case, there are two
options:

A: References can be made partially or fully explicit,
   e.g. `QMP:block-dirty-bitmap-add` will link to the QEMU version of
   the definition, while `QSD:block-dirty-bitmap-add` would link to the
   QSD version.

B: If all of the references in a document are intended to go to the same
   place, you can insert a "qapi:namespace:: QMP" directive to influence
   the fuzzy-searching for later references.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20250313044312.189276-8-jsnow@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
[Commit message typo fixed]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2025-03-14 07:32:21 +01:00
..
migration vfio/migration: Add x-migration-multifd-transfer VFIO property 2025-03-06 06:47:34 +01:00
testing doc: add missing 'Asset' type in function test doc 2025-03-07 09:24:00 +01:00
atomics.rst docs: use consistent markup for footnotes 2024-10-11 13:48:42 +02:00
bitops.rst docs: Create bitops.rst as example of kernel-docs 2019-12-17 19:36:57 +01:00
block-coroutine-wrapper.rst block-coroutine-wrapper.py: introduce co_wrapper 2022-12-15 16:07:43 +01:00
build-environment.rst docs/devel: add information on how to setup build environments 2025-01-17 10:45:44 +00:00
build-system.rst docs: Rename default-configs to configs 2025-03-12 18:14:50 +01:00
clocks.rst hw/clock: Expose 'qtest-clock-period' QOM property for QTests 2024-10-15 11:29:45 +01:00
code-of-conduct.rst docs/devel: add a maintainers section to development process 2022-11-22 09:49:07 +00:00
codebase.rst docs: disambiguate cross-references 2025-03-11 10:26:52 +01:00
conflict-resolution.rst docs: Add a QEMU Code of Conduct and Conflict Resolution Policy document 2021-04-01 13:21:02 +02:00
control-flow-integrity.rst docs: add a glossary 2025-01-17 10:45:54 +00:00
crypto.rst docs/devel: Add introduction to LUKS volume with detached header 2024-07-24 10:39:10 +01:00
decodetree.rst docs/devel: add a codebase section 2025-01-17 10:45:49 +00:00
docs.rst docs: correct typos 2024-02-20 22:20:48 +03:00
ebpf_rss.rst docs/devel: add a codebase section 2025-01-17 10:45:49 +00:00
index-api.rst docs/devel/lockcnt: Convert to rST format 2024-10-15 15:16:17 +01:00
index-build.rst docs: add qapi-domain syntax documentation 2025-03-11 10:26:52 +01:00
index-internals.rst docs: add uefi variable service documentation 2025-03-04 12:07:05 +01:00
index-process.rst rust: add docs 2025-02-07 15:50:59 +01:00
index-tcg.rst docs/devel: add some front matter to the devel index 2023-07-03 12:52:08 +01:00
index.rst docs/devel: add a codebase section 2025-01-17 10:45:49 +00:00
kconfig.rst docs: Rename default-configs to configs 2025-03-12 18:14:50 +01:00
loads-stores.rst docs: use consistent markup for footnotes 2024-10-11 13:48:42 +02:00
lockcnt.rst docs/devel/lockcnt: Include kernel-doc API documentation 2024-10-15 15:16:17 +01:00
luks-detached-header.rst docs/devel: Add introduction to LUKS volume with detached header 2024-07-24 10:39:10 +01:00
maintainers.rst docs: use consistent markup for footnotes 2024-10-11 13:48:42 +02:00
memory.rst docs/devel: add some clarifying text for aliases 2022-01-18 12:56:29 +01:00
modules.rst docs: Spell QEMU all caps 2021-11-19 10:16:58 +01:00
multi-process.rst docs: Don't mention "-mem-path" in multi-process.rst 2023-09-19 10:23:21 +02:00
multi-thread-tcg.rst tcg: Remove TCG_OVERSIZED_GUEST 2025-02-18 07:33:42 -08:00
multiple-iothreads.rst docs/devel/multiple-iothreads: Convert to rST format 2024-10-15 15:16:17 +01:00
pci.rst hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
qapi-code-gen.rst docs/devel/qapi-code-gen: Discourage use of 'prefix' 2025-03-06 10:33:05 +01:00
qapi-domain.rst docs/qapi_domain: add namespace support to cross-references 2025-03-14 07:32:21 +01:00
qdev-api.rst docs/devel: split qom-api reference into new file 2023-07-03 12:52:22 +01:00
qom-api.rst docs/devel: split qom-api reference into new file 2023-07-03 12:52:22 +01:00
qom.rst include/qom/object.h: New OBJECT_DEFINE_SIMPLE_TYPE{, _WITH_INTERFACES} macros 2024-02-27 13:01:42 +00:00
rcu.rst docs/devel/rcu: Convert to rST format 2024-10-15 15:16:17 +01:00
replay.rst docs/devel: Mention post_load hook restrictions where we document the hook 2024-10-04 18:54:55 +03:00
reset.rst docs/devel/reset: Document reset expectations for DMA and IOMMU 2025-02-21 07:21:25 -05:00
rust.rst rust: qemu_api_macros: add Wrapper derive macro 2025-03-06 12:44:46 +01:00
s390-cpu-topology.rst docs/s390: Fix wrong command example in s390-cpu-topology.rst 2023-11-28 14:27:18 +01:00
s390-dasd-ipl.rst docs: rstfy s390 dasd ipl documentation 2020-02-26 18:57:07 +01:00
secure-coding-practices.rst docs/secure-coding-practices: Describe how to use 'null-co' block driver 2021-06-02 14:29:14 +02:00
stable-process.rst docs: Fix botched rST conversion of 'submitting-a-patch.rst' 2021-11-22 15:02:38 +01:00
style.rst docs/devel/style: add a section about bitfield, and disallow them for packed structures 2025-01-17 10:45:27 +00:00
submitting-a-patch.rst docs/devel: add b4 for patch retrieval 2025-01-17 10:45:41 +00:00
submitting-a-pull-request.rst docs/devel: add a maintainers section to development process 2022-11-22 09:49:07 +00:00
tcg-icount.rst accel/tcg: Remove CF_LAST_IO 2023-11-14 10:40:54 -08:00
tcg-ops.rst tcg: Introduce the 'z' constraint for a hardware zero register 2025-02-18 08:29:03 -08:00
tcg-plugins.rst docs/devel: update tcg-plugins page 2024-08-16 14:13:07 +01:00
tcg.rst docs/devel: add some front matter to the devel index 2023-07-03 12:52:08 +01:00
tracing.rst tracetool: remove redundant --target-type / --target-name args 2024-03-12 14:52:07 -04:00
trivial-patches.rst docs: Fix botched rST conversion of 'submitting-a-patch.rst' 2021-11-22 15:02:38 +01:00
uefi-vars.rst docs: add uefi variable service documentation 2025-03-04 12:07:05 +01:00
ui.rst docs: Spell QEMU all caps 2021-11-19 10:16:58 +01:00
vfio-iommufd.rst docs/devel: Add VFIO iommufd backend documentation 2023-12-19 19:03:38 +01:00
virtio-backends.rst include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
writing-monitor-commands.rst docs/devel/writing-monitor-commands: Minor improvements 2024-03-04 07:12:40 +01:00
zoned-storage.rst docs/zoned-storage:add zoned emulation use case 2023-05-15 08:19:04 -04:00