aboutsummaryrefslogtreecommitdiff
path: root/docs/qapi-code-gen.txt
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-03-07 17:06:48 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-03-07 17:06:48 +0000
commit87467097f8811258cd91d42c141a7bd8492ed08a (patch)
tree4c9f130fca163f66038c12af9b3416860bad6338 /docs/qapi-code-gen.txt
parent43c227f9dd7945bb4a895f841ecdb957bd8a12da (diff)
parent0b2c1beea4358e40d1049b8ee019408ce96b37ce (diff)
downloadqemu-87467097f8811258cd91d42c141a7bd8492ed08a.zip
qemu-87467097f8811258cd91d42c141a7bd8492ed08a.tar.gz
qemu-87467097f8811258cd91d42c141a7bd8492ed08a.tar.bz2
Merge remote-tracking branch 'remotes/armbru/tags/pull-block-2017-02-28-v4' into staging
block: Command line option -blockdev # gpg: Signature made Tue 07 Mar 2017 15:07:59 GMT # gpg: using RSA key 0x3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-block-2017-02-28-v4: (24 commits) keyval: Support lists docs/qapi-code-gen.txt: Clarify naming rules qapi: Improve how keyval input visitor reports unexpected dicts block: Initial implementation of -blockdev qapi: New qobject_input_visitor_new_str() for convenience keyval: Restrict key components to valid QAPI names qapi: New parse_qapi_name() test-qapi-util: New, covering qapi/qapi-util.c monitor: Assert qmp_schema_json[] is sane test-visitor-serialization: Pass &error_abort to qobject_from_json() check-qjson: Test errors from qobject_from_json() block: More detailed syntax error reporting for JSON filenames qobject: Propagate parse errors through qobject_from_json() test-qobject-input-visitor: Abort earlier on bad test input qjson: Abort earlier on qobject_from_jsonf() misuse libqtest: Fix qmp() & friends to abort on JSON parse errors qobject: Propagate parse errors through qobject_from_jsonv() qapi: Factor out common qobject_input_get_keyval() qapi: Factor out common part of qobject input visitor creation test-keyval: Cover use with qobject input visitor ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'docs/qapi-code-gen.txt')
-rw-r--r--docs/qapi-code-gen.txt61
1 files changed, 39 insertions, 22 deletions
diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt
index 6746c10..9514d93 100644
--- a/docs/qapi-code-gen.txt
+++ b/docs/qapi-code-gen.txt
@@ -216,33 +216,38 @@ single-dimension array of that type; multi-dimension arrays are not
directly supported (although an array of a complex struct that
contains an array member is possible).
+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.
+
+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.
+
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
-definitions should not end in 'Kind', as this namespace is used for
-creating implicit C enums for visiting union types, or in 'List', as
-this namespace is used for creating array types. Command names,
-and member names within a type, should be all lower case with words
-separated by a hyphen. However, some existing older commands and
-complex types use underscore; when extending such expressions,
-consistency is preferred over blindly avoiding underscore. Event
-names should be ALL_CAPS with words separated by underscore. Member
-names cannot start with 'has-' or 'has_', as this is reserved for
-tracking optional members.
+user-defined type names, while built-in types are lowercase.
+
+Type names ending with 'Kind' or 'List' are reserved for the
+generator, which uses them for implicit union enums and array types,
+respectively.
+
+Command names, and member names within a type, should be all lower
+case with words separated by a hyphen. However, some existing older
+commands and complex types use underscore; when extending such
+expressions, consistency is preferred over blindly avoiding
+underscore.
+
+Event names should be ALL_CAPS with words separated by underscore.
+
+Member names starting with 'has-' or 'has_' are reserved for the
+generator, which uses them 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
-incompatibly in a future release. All names must begin with a letter,
-and contain only ASCII letters, digits, dash, and underscore. There
-are two exceptions: enum values may start with a digit, and any
-extensions added by downstream vendors should start with a prefix
-matching "__RFQDN_" (for the reverse-fully-qualified-domain-name of
-the vendor), even if the rest of the name uses dash (example:
-__com.redhat_drive-mirror). Names beginning with 'q_' are reserved
-for the generator: QMP names that resemble C keywords or other
-problematic strings will be munged in C to use this prefix. For
-example, a member named "default" in qapi becomes "q_default" in the
-generated C code.
+incompatibly in a future release.
In the rest of this document, usage lines are given for each
expression type, with literal strings written in lower case and
@@ -643,6 +648,18 @@ any non-empty complex type (struct, union, or alternate), and a
pointer to that QAPI type is passed as a single argument.
+=== Downstream extensions ===
+
+QAPI schema names that are externally visible, say in the Client JSON
+Protocol, need to be managed with care. Names starting with a
+downstream prefix of the form __RFQDN_ are reserved for the downstream
+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.
+
+
== Client JSON Protocol introspection ==
Clients of a Client JSON Protocol commonly need to figure out what