qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, kwolf@redhat.com, pkrempa@redhat.com,
	eblake@redhat.com, mdroth@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH v2 23/24] docs/qapi-code-gen.txt: Clarify naming rules
Date: Tue, 28 Feb 2017 22:27:09 +0100	[thread overview]
Message-ID: <1488317230-26248-24-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1488317230-26248-1-git-send-email-armbru@redhat.com>

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
---
 docs/qapi-code-gen.txt | 61 ++++++++++++++++++++++++++++++++------------------
 1 file 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
-- 
2.7.4

  parent reply	other threads:[~2017-02-28 21:27 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 21:26 [Qemu-devel] [PATCH v2 00/24] block: Command line option -blockdev Markus Armbruster
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 01/24] test-qemu-opts: Cover qemu_opts_parse() of "no" Markus Armbruster
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 02/24] tests: Fix gcov-files-test-qemu-opts-y, gcov-files-test-logging-y Markus Armbruster
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 03/24] keyval: New keyval_parse() Markus Armbruster
2017-02-28 21:48   ` Eric Blake
2017-02-28 22:01     ` Markus Armbruster
2017-03-05 10:07       ` Markus Armbruster
2017-02-28 22:03   ` Kevin Wolf
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 04/24] qapi: qobject input visitor variant for use with keyval_parse() Markus Armbruster
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 05/24] test-keyval: Cover use with qobject input visitor Markus Armbruster
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 06/24] qapi: Factor out common part of qobject input visitor creation Markus Armbruster
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 07/24] qapi: Factor out common qobject_input_get_keyval() Markus Armbruster
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 08/24] qobject: Propagate parse errors through qobject_from_jsonv() Markus Armbruster
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 09/24] libqtest: Fix qmp() & friends to abort on JSON parse errors Markus Armbruster
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 10/24] qjson: Abort earlier on qobject_from_jsonf() misuse Markus Armbruster
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 11/24] test-qobject-input-visitor: Abort earlier on bad test input Markus Armbruster
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 12/24] qobject: Propagate parse errors through qobject_from_json() Markus Armbruster
2017-02-28 21:26 ` [Qemu-devel] [PATCH v2 13/24] block: More detailed syntax error reporting for JSON filenames Markus Armbruster
2017-02-28 21:27 ` [Qemu-devel] [PATCH v2 14/24] check-qjson: Test errors from qobject_from_json() Markus Armbruster
2017-02-28 21:27 ` [Qemu-devel] [PATCH v2 15/24] test-visitor-serialization: Pass &error_abort to qobject_from_json() Markus Armbruster
2017-02-28 21:27 ` [Qemu-devel] [PATCH v2 16/24] monitor: Assert qmp_schema_json[] is sane Markus Armbruster
2017-02-28 21:27 ` [Qemu-devel] [PATCH v2 17/24] test-qapi-util: New, covering qapi/qapi-util.c Markus Armbruster
2017-02-28 21:27 ` [Qemu-devel] [PATCH v2 18/24] qapi: New parse_qapi_name() Markus Armbruster
2017-02-28 22:04   ` Kevin Wolf
2017-02-28 21:27 ` [Qemu-devel] [PATCH v2 19/24] keyval: Restrict key components to valid QAPI names Markus Armbruster
2017-02-28 21:27 ` [Qemu-devel] [PATCH v2 20/24] qapi: New qobject_input_visitor_new_str() for convenience Markus Armbruster
2017-02-28 22:05   ` Kevin Wolf
2017-02-28 21:27 ` [Qemu-devel] [PATCH v2 21/24] block: Initial implementation of -blockdev Markus Armbruster
2017-02-28 22:05   ` Kevin Wolf
2017-02-28 21:27 ` [Qemu-devel] [PATCH v2 22/24] qapi: Improve how keyval input visitor reports unexpected dicts Markus Armbruster
2017-02-28 21:27 ` Markus Armbruster [this message]
2017-02-28 21:27 ` [Qemu-devel] [PATCH v2 24/24] keyval: Support lists Markus Armbruster
2017-02-28 22:02   ` Kevin Wolf
2017-02-28 22:11     ` Markus Armbruster
2017-02-28 22:17       ` Kevin Wolf
2017-02-28 22:56   ` Eric Blake
2017-03-01  5:47     ` Markus Armbruster
2017-02-28 21:55 ` [Qemu-devel] [PATCH v2 00/24] block: Command line option -blockdev Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488317230-26248-24-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).