docs: convert qapi-code-gen.txt to qapi-code-gen.rst
cover docs: convert qapi-code-gen.txt to qapi-code-gen.rst
Patch 1 does (roughly) the bare minimum, patch 2 adds some formatting, and patch 3 adds cross-references.
John Snow (3):
docs: convert qapi-code-gen.txt to ReST
docs/qapi-code-gen: Beautify formatting
docs/qapi-code-gen: add cross-references
docs/devel/index.rst | 1 +
.../{qapi-code-gen.txt => qapi-code-gen.rst} | 800 ++++++++++--------
2 files changed, 441 insertions(+), 360 deletions(-)
rename docs/devel/{qapi-code-gen.txt => qapi-code-gen.rst} (76%)Signature · 1 line
2.31.1
PATCH 1/3 docs: convert qapi-code-gen.txt to ReST
This is a very rudimentary conversion from .txt to .rst changing as little as possible, but getting it to render somewhat nicely; without using any Sphinx directives. (It is 'native' ReST.)
Further patches will add cross-references and Sphinx-specific extensions to make it sparkle.
---
docs/devel/index.rst | 1 +
.../{qapi-code-gen.txt => qapi-code-gen.rst} | 559 ++++++++++--------
2 files changed, 312 insertions(+), 248 deletions(-)
rename docs/devel/{qapi-code-gen.txt => qapi-code-gen.rst} (86%)docs/devel/index.rst +1 -0
@@ -42,3 +42,4 @@ modifying QEMU's source code. multi-process ebpf_rss vfio-migration + qapi-code-gen
docs/devel/qapi-code-gen.rst renamed from docs/devel/qapi-code-gen.txt +311 -248
1,174 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH 2/3 docs/qapi-code-gen: Beautify formatting
In reply to John SnowMostly, add ``literal`` markers to a lot of things like C types, add code blocks, and fix the way a few things render.
--- docs/devel/qapi-code-gen.rst | 172 ++++++++++++++++++----------------- 1 file changed, 90 insertions(+), 82 deletions(-)
docs/devel/qapi-code-gen.rst +90 -82
@@ -40,7 +40,7 @@ by any commands or events, for the side effect of generated C code used internally. There are several kinds of types: simple types (a number of built-in -types, such as 'int' and 'str'; as well as enumerations), arrays, +types, such as ``int`` and ``str``; as well as enumerations), arrays, complex types (structs and two flavors of unions), and alternate types (a choice between other types).
@@ -51,37 +51,37 @@ Schema syntax Syntax is loosely based on `JSON <http://www.ietf.org/rfc/rfc8259.txt>`_. Differences: -* Comments: start with a hash character (#) that is not part of a +* Comments: start with a hash character (``#``) that is not part of a string, and extend to the end of the line. -* Strings are enclosed in 'single quotes', not "double quotes". +* Strings are enclosed in ``'single quotes'``, not ``"double quotes"``. * Strings are restricted to printable ASCII, and escape sequences to - just '\\'. + just ``\\``. -* Numbers and null are not supported. +* Numbers and ``null`` are not supported. A second layer of syntax defines the sequences of JSON texts that are a correctly structured QAPI schema. We provide a grammar for this syntax in an EBNF-like notation: -* Production rules look like non-terminal = expression -* Concatenation: expression A B matches expression A, then B -* Alternation: expression A | B matches expression A or B -* Repetition: expression A... matches zero or more occurrences of - expression A -* Repetition: expression A, ... matches zero or more occurrences of - expression A separated by , -* Grouping: expression ( A ) matches expression A -* JSON's structural characters are terminals: { } [ ] : , -* JSON's literal names are terminals: false true -* String literals enclosed in 'single quotes' are terminal, and match - this JSON string, with a leading '*' stripped off -* When JSON object member's name starts with '*', the member is +* Production rules look like ``non-terminal = expression`` +* Concatenation: expression ``A B`` matches expression ``A``, then ``B`` +* Alternation: expression ``A | B`` matches expression ``A`` or ``B`` +* Repetition: expression ``A...`` matches zero or more occurrences of + expression ``A`` +* Repetition: expression ``A, ...`` matches zero or more occurrences of + expression ``A`` separated by ``,`` +* Grouping: expression ``( A )`` matches expression ``A`` +* JSON's structural characters are terminals: ``{ } [ ] : ,`` +* JSON's literal names are terminals: ``false true`` +* String literals enclosed in ``'single quotes'`` are terminal, and match + this JSON string, with a leading ``*`` stripped off +* When JSON object member's name starts with ``*``, the member is optional. -* The symbol STRING is a terminal, and matches any JSON string -* The symbol BOOL is a terminal, and matches JSON false or true -* ALL-CAPS words other than STRING are non-terminals +* The symbol ``STRING`` is a terminal, and matches any JSON string +* The symbol ``BOOL`` is a terminal, and matches JSON ``false`` or ``true`` +* ALL-CAPS words other than ``STRING`` are non-terminals The order of members within JSON objects does not matter unless explicitly noted.
@@ -109,27 +109,30 @@ These are discussed in detail below. Built-in Types -------------- -The following types are predefined, and map to C as follows:: +The following types are predefined, and map to C as follows: - Schema C JSON - str char * any JSON string, UTF-8 - number double any JSON number - int int64_t a JSON number without fractional part - that fits into the C integer type - int8 int8_t likewise - int16 int16_t likewise - int32 int32_t likewise - int64 int64_t likewise - uint8 uint8_t likewise - uint16 uint16_t likewise - uint32 uint32_t likewise - uint64 uint64_t likewise - size uint64_t like uint64_t, except StringInputVisitor - accepts size suffixes - bool bool JSON true or false - null QNull * JSON null - any QObject * any JSON value - QType QType JSON string matching enum QType values + ============= ============== ============================================ + Schema C JSON + ============= ============== ============================================ + ``str`` ``char *`` any JSON string, UTF-8 + ``number`` ``double`` any JSON number + ``int`` ``int64_t`` a JSON number without fractional part + that fits into the C integer type + ``int8`` ``int8_t`` likewise + ``int16`` ``int16_t`` likewise + ``int32`` ``int32_t`` likewise + ``int64`` ``int64_t`` likewise + ``uint8`` ``uint8_t`` likewise + ``uint16`` ``uint16_t`` likewise + ``uint32`` ``uint32_t`` likewise + ``uint64`` ``uint64_t`` likewise + ``size`` ``uint64_t`` like ``uint64_t``, except + ``StringInputVisitor`` accepts size suffixes + ``bool`` ``bool`` JSON ``true`` or ``false`` + ``null`` ``QNull *`` JSON ``null`` + ``any`` ``QObject *`` any JSON value + ``QType`` ``QType`` JSON string matching enum ``QType`` values + ============= ============== ============================================ Include directives
@@ -174,14 +177,14 @@ Pragma 'doc-required' takes a boolean value. If true, documentation is required. Default is false. Pragma 'command-name-exceptions' takes a list of commands whose names -may contain '_' instead of '-'. Default is none. +may contain ``"_"`` instead of ``"-"``. Default is none. Pragma 'command-returns-exceptions' takes a list of commands that may violate the rules on permitted return types. Default is none. Pragma 'member-name-exceptions' takes a list of types whose member -names may contain uppercase letters, and '_' instead of '-'. Default -is none. +names may contain uppercase letters, and ``"_"`` instead of ``"-"``. +Default is none. Enumeration types
@@ -200,7 +203,7 @@ Syntax:: Member 'enum' names the enum type. Each member of the 'data' array defines a value of the enumeration -type. The form STRING is shorthand for { 'name': STRING }. The +type. The form STRING is shorthand for :code:`{ 'name': STRING }`. The 'name' values must be be distinct. Example::
@@ -243,7 +246,7 @@ Syntax:: A string denotes the type named by the string. A one-element array containing a string denotes an array of the type -named by the string. Example: ['int'] denotes an array of 'int'. +named by the string. Example: ``['int']`` denotes an array of ``int``. Struct types
@@ -266,11 +269,11 @@ Member 'struct' names the struct type. Each MEMBER of the 'data' object defines a member of the struct type. -The MEMBER's STRING name consists of an optional '*' prefix and the -struct member name. If '*' is present, the member is optional. +The MEMBER's STRING name consists of an optional ``*`` prefix and the +struct member name. If ``*`` is present, the member is optional. The MEMBER's value defines its properties, in particular its type. -The form TYPE-REF is shorthand for { 'type': TYPE-REF }. +The form TYPE-REF is shorthand for :code:`{ 'type': TYPE-REF }`. Example::
@@ -334,7 +337,7 @@ union must have at least one branch. The BRANCH's STRING name is the branch name. The BRANCH's value defines the branch's properties, in particular its -type. The form TYPE-REF is shorthand for { 'type': TYPE-REF }. +type. The form TYPE-REF is shorthand for :code:`{ 'type': TYPE-REF }`. A simple union type defines a mapping from automatic discriminator values to data types like in this example::
@@ -381,7 +384,7 @@ struct. The following example enhances the above simple union example by adding an optional common member 'read-only', renaming the discriminator to something more applicable than the simple union's -default of 'type', and reducing the number of {} required on the wire:: +default of 'type', and reducing the number of ``{}`` required on the wire:: { 'enum': 'BlockdevDriver', 'data': [ 'file', 'qcow2' ] } { 'union': 'BlockdevOptions',
@@ -450,7 +453,7 @@ alternate. An alternate must have at least one branch. The ALTERNATIVE's STRING name is the branch name. The ALTERNATIVE's value defines the branch's properties, in particular -its type. The form STRING is shorthand for { 'type': STRING }. +its type. The form STRING is shorthand for :code:`{ 'type': STRING }`. Example::
@@ -515,7 +518,7 @@ If 'data' is a MEMBERS object, then MEMBERS defines arguments just like a struct type's 'data' defines struct type members. If 'data' is a STRING, then STRING names a complex type whose members -are the arguments. A union type requires 'boxed': true. +are the arguments. A union type requires ``'boxed': true``. Member 'returns' defines the command's return type. It defaults to an empty struct type. It must normally be a complex type or an array of
@@ -555,7 +558,7 @@ section "Code generated for commands" for examples. The function returns the return type. When member 'boxed' is absent, it takes the command arguments as arguments one by one, in QAPI schema order. Else it takes them wrapped in the C struct generated for the -complex argument type. It takes an additional Error ** argument in +complex argument type. It takes an additional ``Error **`` argument in either case. The generator also emits a marshalling function that extracts
@@ -638,11 +641,11 @@ blocking the guest and other background operations. Coroutine safety can be hard to prove, similar to thread safety. Common pitfalls are: -- The global mutex isn't held across qemu_coroutine_yield(), so +- The global mutex isn't held across ``qemu_coroutine_yield()``, so operations that used to assume that they execute atomically may have to be more careful to protect against changes in the global state. -- Nested event loops (AIO_WAIT_WHILE() etc.) are problematic in +- Nested event loops (``AIO_WAIT_WHILE()`` etc.) are problematic in coroutine context and can easily lead to deadlocks. They should be replaced by yielding and reentering the coroutine when the condition becomes false.
@@ -650,9 +653,9 @@ pitfalls are: Since the command handler may assume coroutine context, any callers other than the QMP dispatcher must also call it in coroutine context. In particular, HMP commands calling such a QMP command handler must be -marked .coroutine = true in hmp-commands.hx. +marked ``.coroutine = true`` in hmp-commands.hx. -It is an error to specify both 'coroutine': true and 'allow-oob': true +It is an error to specify both ``'coroutine': true`` and ``'allow-oob': true`` for a command. We don't currently have a use case for both together and without a use case, it's not entirely clear what the semantics should be.
@@ -689,7 +692,7 @@ If 'data' is a MEMBERS object, then MEMBERS defines event-specific data just like a struct type's 'data' defines struct type members. If 'data' is a STRING, then STRING names a complex type whose members -are the event-specific data. A union type requires 'boxed': true. +are the event-specific data. A union type requires ``'boxed': true``. An example event is::
@@ -763,16 +766,16 @@ digits, hyphen, and underscore. There are two exceptions: enum values may start with a digit, and names that are downstream extensions (see section Downstream extensions) start with underscore. -Names beginning with 'q\_' are reserved for the generator, which uses +Names beginning with ``q_`` are reserved for the generator, which uses them for munging QMP names that resemble C keywords or other -problematic strings. For example, a member named "default" in qapi -becomes "q_default" in the generated C code. +problematic strings. For example, a member named ``default`` in qapi +becomes ``q_default`` in the generated C code. Types, commands, and events share a common namespace. Therefore, generally speaking, type definitions should always use CamelCase for user-defined type names, while built-in types are lowercase. -Type names ending with 'Kind' or 'List' are reserved for the +Type names ending with ``Kind`` or ``List`` are reserved for the generator, which uses them for implicit union enums and array types, respectively.
@@ -783,15 +786,15 @@ consistency is preferred over blindly avoiding underscore. Event names should be ALL_CAPS with words separated by underscore. -Member name 'u' and names starting with 'has-' or 'has\_' are reserved +Member name ``u`` and names starting with ``has-`` or ``has_`` are reserved for the generator, which uses them for unions and for tracking optional members. Any name (command, event, type, member, or enum value) beginning with -"x-" is marked experimental, and may be withdrawn or changed +``x-`` is marked experimental, and may be withdrawn or changed incompatibly in a future release. -Pragmas 'command-name-exceptions' and 'member-name-exceptions' let you +Pragmas ``command-name-exceptions`` and ``member-name-exceptions`` let you violate naming rules. Use for new code is strongly discouraged.
@@ -805,7 +808,7 @@ who controls the valid, reverse fully qualified domain name RFQDN. RFQDN may only contain ASCII letters, digits, hyphen and period. Example: Red Hat, Inc. controls redhat.com, and may therefore add a -downstream command __com.redhat_drive-mirror. +downstream command ``__com.redhat_drive-mirror``. Configuring the schema
@@ -879,7 +882,7 @@ this particular build. Documentation comments ---------------------- -A multi-line comment that starts and ends with a '##' line is a +A multi-line comment that starts and ends with a ``##`` line is a documentation comment. If the documentation comment starts like ::
@@ -887,7 +890,7 @@ If the documentation comment starts like :: ## # @SYMBOL: -it documents the definition if SYMBOL, else it's free-form +it documents the definition of SYMBOL, else it's free-form documentation. See below for more on definition documentation.
@@ -900,7 +903,7 @@ Headings and subheadings ~~~~~~~~~~~~~~~~~~~~~~~~ A free-form documentation comment containing a line which starts with -some '=' symbols and then a space defines a section heading:: +some ``=`` symbols and then a space defines a section heading:: ## # = This is a top level heading
@@ -924,22 +927,22 @@ Documentation markup ~~~~~~~~~~~~~~~~~~~~ Documentation comments can use most rST markup. In particular, -a '::' literal block can be used for examples:: +a ``::`` literal block can be used for examples:: # :: # # Text of the example, may span # multiple lines -'*' starts an itemized list:: +``*`` starts an itemized list:: # * First item, may span # multiple lines # * Second item -You can also use '-' instead of '*'. +You can also use ``-`` instead of ``*``. -A decimal number followed by '.' starts a numbered list:: +A decimal number followed by ``.`` starts a numbered list:: # 1. First item, may span # multiple lines
@@ -952,11 +955,11 @@ If a list item's text spans multiple lines, then the second and subsequent lines must be correctly indented to line up with the first character of the first line. -The usual '**strong**', '*emphasised*' and '``literal``' markup should -be used. If you need a single literal '*' you will need to +The usual ****strong****, *\*emphasized\** and ````literal```` markup +should be used. If you need a single literal ``*``, you will need to backslash-escape it. As an extension beyond the usual rST syntax, you -can also use '@foo' to reference a name in the schema; this is -rendered the same way as '``foo``'. +can also use ``@foo`` to reference a name in the schema; this is rendered +the same way as ````foo````. Example::
@@ -991,9 +994,9 @@ alternates), or value (for enums), and finally optional tagged sections. Descriptions of arguments can span multiple lines. The description -text can start on the line following the '@argname:', in which case it +text can start on the line following the '\@argname:', in which case it must not be indented at all. It can also start on the same line as -the '@argname:'. In this case if it spans multiple lines then second +the '\@argname:'. In this case if it spans multiple lines then second and subsequent lines must be indented to line up with the first character of the first line of the description::
@@ -1006,8 +1009,13 @@ character of the first line of the description:: The number of spaces between the ':' and the text is not significant. -FIXME: the parser accepts these things in almost any order. -FIXME: union branches should be described, too. +.. admonition:: FIXME + + The parser accepts these things in almost any order. + +.. admonition:: FIXME + + union branches should be described, too. Extensions added after the definition was first released carry a '(since x.y.z)' comment.
Signature · 1 line
2.31.1
PATCH 3/3 docs/qapi-code-gen: add cross-references
In reply to John SnowAdd clickables to many places.
--- docs/devel/qapi-code-gen.rst | 107 +++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 49 deletions(-)
docs/devel/qapi-code-gen.rst +58 -49
@@ -156,6 +156,7 @@ from making a forward reference to a type that is only introduced by an outer file. The parser may be made stricter in the future to prevent incomplete include files. +.. _pragma: Pragma directives -----------------
@@ -186,6 +187,7 @@ Pragma 'member-name-exceptions' takes a list of types whose member names may contain uppercase letters, and ``"_"`` instead of ``"-"``. Default is none. +.. _ENUM-VALUE: Enumeration types -----------------
@@ -228,13 +230,15 @@ additional enumeration constant PREFIX__MAX with value N. Do not use string or an integer type when an enumeration type can do the job satisfactorily. -The optional 'if' member specifies a conditional. See "Configuring -the schema" below for more on this. +The optional 'if' member specifies a conditional. See `Configuring the +schema`_ below for more on this. -The optional 'features' member specifies features. See "Features" +The optional 'features' member specifies features. See Features_ below for more on this. +.. _TYPE-REF: + Type references and array types -------------------------------
@@ -269,11 +273,13 @@ Member 'struct' names the struct type. Each MEMBER of the 'data' object defines a member of the struct type. +.. _MEMBERS: + The MEMBER's STRING name consists of an optional ``*`` prefix and the struct member name. If ``*`` is present, the member is optional. The MEMBER's value defines its properties, in particular its type. -The form TYPE-REF is shorthand for :code:`{ 'type': TYPE-REF }`. +The form TYPE-REF_ is shorthand for :code:`{ 'type': TYPE-REF }`. Example::
@@ -300,10 +306,10 @@ both members like this:: { "file": "/some/place/my-image", "backing": "/some/place/my-backing-file" } -The optional 'if' member specifies a conditional. See "Configuring -the schema" below for more on this. +The optional 'if' member specifies a conditional. See `Configuring +the schema`_ below for more on this. -The optional 'features' member specifies features. See "Features" +The optional 'features' member specifies features. See Features_ below for more on this.
@@ -337,7 +343,7 @@ union must have at least one branch. The BRANCH's STRING name is the branch name. The BRANCH's value defines the branch's properties, in particular its -type. The form TYPE-REF is shorthand for :code:`{ 'type': TYPE-REF }`. +type. The form TYPE-REF_ is shorthand for :code:`{ 'type': TYPE-REF }`. A simple union type defines a mapping from automatic discriminator values to data types like in this example::
@@ -368,12 +374,12 @@ Flat unions permit arbitrary common members that occur in all variants of the union, not just a discriminator. Their discriminators need not be named 'type'. They also avoid nesting on the wire. -The 'base' member defines the common members. If it is a MEMBERS +The 'base' member defines the common members. If it is a MEMBERS_ object, it defines common members just like a struct type's 'data' member defines struct type members. If it is a STRING, it names a struct type whose members are the common members. -All flat union branches must be of struct type. +All flat union branches must be `Struct types`_. In the Client JSON Protocol, a flat union is represented by an object with the common members (from the base type) and the selected branch's
@@ -425,10 +431,10 @@ is identical on the wire to:: { 'union': 'Flat', 'base': { 'type': 'Enum' }, 'discriminator': 'type', 'data': { 'one': 'Branch1', 'two': 'Branch2' } } -The optional 'if' member specifies a conditional. See "Configuring -the schema" below for more on this. +The optional 'if' member specifies a conditional. See `Configuring +the schema`_ below for more on this. -The optional 'features' member specifies features. See "Features" +The optional 'features' member specifies features. See Features_ below for more on this.
@@ -481,10 +487,10 @@ following example objects:: "read-only": false, "filename": "/tmp/mydisk.qcow2" } } -The optional 'if' member specifies a conditional. See "Configuring -the schema" below for more on this. +The optional 'if' member specifies a conditional. See `Configuring +the schema`_ below for more on this. -The optional 'features' member specifies features. See "Features" +The optional 'features' member specifies features. See Features_ below for more on this.
@@ -511,10 +517,10 @@ Syntax:: Member 'command' names the command. -Member 'data' defines the arguments. It defaults to an empty MEMBERS +Member 'data' defines the arguments. It defaults to an empty MEMBERS_ object. -If 'data' is a MEMBERS object, then MEMBERS defines arguments just +If 'data' is a MEMBERS_ object, then MEMBERS defines arguments just like a struct type's 'data' defines struct type members. If 'data' is a STRING, then STRING names a complex type whose members
@@ -553,7 +559,7 @@ which would validate this Client JSON Protocol transaction:: The generator emits a prototype for the C function implementing the command. The function itself needs to be written by hand. See -section "Code generated for commands" for examples. +section `Code generated for commands`_ for examples. The function returns the return type. When member 'boxed' is absent, it takes the command arguments as arguments one by one, in QAPI schema
@@ -660,10 +666,10 @@ for a command. We don't currently have a use case for both together and without a use case, it's not entirely clear what the semantics should be. -The optional 'if' member specifies a conditional. See "Configuring -the schema" below for more on this. +The optional 'if' member specifies a conditional. See `Configuring +the schema`_ below for more on this. -The optional 'features' member specifies features. See "Features" +The optional 'features' member specifies features. See Features_ below for more on this.
@@ -708,15 +714,17 @@ Resulting in this JSON object:: The generator emits a function to send the event. When member 'boxed' is absent, it takes event-specific data one by one, in QAPI schema order. Else it takes them wrapped in the C struct generated for the -complex type. See section "Code generated for events" for examples. +complex type. See section `Code generated for events`_ for examples. -The optional 'if' member specifies a conditional. See "Configuring -the schema" below for more on this. +The optional 'if' member specifies a conditional. See `Configuring +the schema`_ below for more on this. -The optional 'features' member specifies features. See "Features" +The optional 'features' member specifies features. See Features_ below for more on this. +.. _FEATURE: + Features --------
@@ -735,8 +743,8 @@ For this purpose, a list of features can be specified for a command or struct type. Each list member can either be ``{ 'name': STRING, '*if': COND }``, or STRING, which is shorthand for ``{ 'name': STRING }``. -The optional 'if' member specifies a conditional. See "Configuring -the schema" below for more on this. +The optional 'if' member specifies a conditional. See `Configuring +the schema`_ below for more on this. Example::
@@ -745,7 +753,7 @@ Example:: 'features': [ 'allow-negative-numbers' ] } The feature strings are exposed to clients in introspection, as -explained in section "Client JSON Protocol introspection". +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.
@@ -764,7 +772,7 @@ Naming rules and reserved names All names must begin with a letter, and contain only ASCII letters, digits, hyphen, and underscore. There are two exceptions: enum values may start with a digit, and names that are downstream extensions (see -section Downstream extensions) start with underscore. +section `Downstream extensions`_) start with underscore. Names beginning with ``q_`` are reserved for the generator, which uses them for munging QMP names that resemble C keywords or other
@@ -794,8 +802,9 @@ Any name (command, event, type, member, or enum value) beginning with ``x-`` is marked experimental, and may be withdrawn or changed incompatibly in a future release. -Pragmas ``command-name-exceptions`` and ``member-name-exceptions`` let you -violate naming rules. Use for new code is strongly discouraged. +Pragmas ``command-name-exceptions`` and ``member-name-exceptions`` let +you violate naming rules. Use for new code is strongly discouraged. See +`Pragma directives`_ for details. Downstream extensions
@@ -851,7 +860,7 @@ member 'bar' :: A union's discriminator may not be conditional. Likewise, individual enumeration values be conditional. This requires -the longhand form of ENUM-VALUE. +the longhand form of ENUM-VALUE_. Example: an enum type with unconditional value 'foo' and conditional value 'bar' ::
@@ -861,7 +870,7 @@ value 'bar' :: { 'name' : 'bar', 'if': 'defined(IFCOND)' } ] } Likewise, features can be conditional. This requires the longhand -form of FEATURE. +form of FEATURE_. Example: a struct with conditional feature 'allow-negative-numbers' ::
@@ -893,7 +902,7 @@ If the documentation comment starts like :: it documents the definition of SYMBOL, else it's free-form documentation. -See below for more on definition documentation. +See below for more on `Definition documentation`_. Free-form documentation may be used to provide additional text and structuring content.
@@ -984,7 +993,7 @@ Definition documentation Definition documentation, if present, must immediately precede the definition it documents. -When documentation is required (see pragma 'doc-required'), every +When documentation is required (see pragma_ 'doc-required'), every definition must have documentation. Definition documentation starts with a line naming the definition,
@@ -1181,7 +1190,7 @@ the wire then. Each command or event defined with 'data' as MEMBERS object in the QAPI schema implicitly defines an object type. -Example: the SchemaInfo for EVENT_C from section Events :: +Example: the SchemaInfo for EVENT_C from section Events_ :: { "name": "EVENT_C", "meta-type": "event", "arg-type": "q_obj-EVENT_C-arg" }
@@ -1205,7 +1214,7 @@ extensions. The "members" array is in no particular order; clients must search the entire object when learning whether a particular member is supported. -Example: the SchemaInfo for MyType from section Struct types :: +Example: the SchemaInfo for MyType from section `Struct types`_ :: { "name": "MyType", "meta-type": "object", "members": [
@@ -1216,7 +1225,7 @@ Example: the SchemaInfo for MyType from section Struct types :: "features" exposes the command's feature strings as a JSON array of strings. -Example: the SchemaInfo for TestType from section Features:: +Example: the SchemaInfo for TestType from section Features_:: { "name": "TestType", "meta-type": "object", "members": [
@@ -1232,7 +1241,7 @@ that provides the variant members for this type tag value). The list cases in the same order as the corresponding "tag" enum type. Example: the SchemaInfo for flat union BlockdevOptions from section -Union types :: +`Union types`_ :: { "name": "BlockdevOptions", "meta-type": "object", "members": [
@@ -1247,13 +1256,13 @@ Note that base types are "flattened": its members are included in the "members" array. A simple union implicitly defines an enumeration type for its implicit -discriminator (called "type" on the wire, see section Union types). +discriminator (called "type" on the wire, see section `Union types`_). A simple union implicitly defines an object type for each of its variants. Example: the SchemaInfo for simple union BlockdevOptionsSimple from section -Union types :: +`Union types`_ :: { "name": "BlockdevOptionsSimple", "meta-type": "object", "members": [
@@ -1273,7 +1282,7 @@ a JSON object with member "type", which names a type. Values of the alternate type conform to exactly one of its member types. There is no guarantee on the order in which "members" will be listed. -Example: the SchemaInfo for BlockdevRef from section Alternate types :: +Example: the SchemaInfo for BlockdevRef from section `Alternate types`_ :: { "name": "BlockdevRef", "meta-type": "alternate", "members": [
@@ -1297,13 +1306,13 @@ variant member "values". The values are listed in no particular order; clients must search the entire enum when learning whether a particular value is supported. -Example: the SchemaInfo for MyEnum from section Enumeration types :: +Example: the SchemaInfo for MyEnum from section `Enumeration types`_ :: { "name": "MyEnum", "meta-type": "enum", "values": [ "value1", "value2", "value3" ] } The SchemaInfo for a built-in type has the same name as the type in -the QAPI schema (see section Built-in Types), with one exception +the QAPI schema (see section `Built-in Types`_), with one exception detailed below. It has variant member "json-type" that shows how values of this type are encoded on the wire.
@@ -1505,7 +1514,7 @@ Example:: [Uninteresting stuff omitted...] -For a modular QAPI schema (see section Include directives), code for +For a modular QAPI schema (see section `Include directives`_), code for each sub-module SUBDIR/SUBMODULE.json is actually generated into :: SUBDIR/$(prefix)qapi-types-SUBMODULE.h
@@ -1636,7 +1645,7 @@ Example:: [Uninteresting stuff omitted...] -For a modular QAPI schema (see section Include directives), code for +For a modular QAPI schema (see section `Include directives`_), code for each sub-module SUBDIR/SUBMODULE.json is actually generated into :: SUBDIR/$(prefix)qapi-visit-SUBMODULE.h
@@ -1764,7 +1773,7 @@ Example:: } [Uninteresting stuff omitted...] -For a modular QAPI schema (see section Include directives), code for +For a modular QAPI schema (see section `Include directives`_), code for each sub-module SUBDIR/SUBMODULE.json is actually generated into:: SUBDIR/$(prefix)qapi-commands-SUBMODULE.h
@@ -1853,7 +1862,7 @@ Example:: [Uninteresting stuff omitted...] -For a modular QAPI schema (see section Include directives), code for +For a modular QAPI schema (see section `Include directives`_), code for each sub-module SUBDIR/SUBMODULE.json is actually generated into :: SUBDIR/$(prefix)qapi-events-SUBMODULE.h
Signature · 1 line
2.31.1
Quoted 8 lines · John Snow
Patch 1 does (roughly) the bare minimum, patch 2 adds some formatting, and patch 3 adds cross-references.
John Snow (3):
docs: convert qapi-code-gen.txt to ReST
docs/qapi-code-gen: Beautify formatting
docs/qapi-code-gen: add cross-references
thanks
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 8 lines · John Snow
Patch 1 does (roughly) the bare minimum, patch 2 adds some formatting, and patch 3 adds cross-references.
John Snow (3):
docs: convert qapi-code-gen.txt to ReST
docs/qapi-code-gen: Beautify formatting
docs/qapi-code-gen: add cross-referencesReviewed-by Peter Maydell <[email protected]>
Let's queue this after my "[PATCH] docs/devel/qapi-code-gen: Update examples to match current code".
For 6.1, or "don't rock the boat now"?
Quoted 12 lines · Markus Armbruster
Quoted 10 lines · Peter Maydell
Quoted 8 lines · John Snow
Patch 1 does (roughly) the bare minimum, patch 2 adds some formatting, and patch 3 adds cross-references.
John Snow (3):
docs: convert qapi-code-gen.txt to ReST
docs/qapi-code-gen: Beautify formatting
docs/qapi-code-gen: add cross-references
Quoted 6 lines
Quoted 1 line
Reviewed-by Peter Maydell <[email protected]>Let's queue this after my "[PATCH] docs/devel/qapi-code-gen: Update examples to match current code".
Sure. Do you need a rebase? (I don't see that patch in origin/master right now.)
Quoted 2 lines
For 6.1, or "don't rock the boat now"?
No preference. In response to the same question on the other doc conversion patch, "No preference."
Quoted 9 lines · John Snow
Quoted 2 lines · Markus Armbruster
For 6.1, or "don't rock the boat now"?
No preference. In response to the same question on the other doc conversion patch, "No preference."
I have no strong preference either. Docs changes are about as safe as it gets so I don't mind them in rc3.
-- PMM