From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, berrange@redhat.com,
qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com,
Markus Armbruster <armbru@redhat.com>,
libvir-list@redhat.com, pkrempa@redhat.com,
marcandre.lureau@redhat.com, jsnow@redhat.com,
libguestfs@redhat.com
Subject: Re: [PATCH v2 4/5] qapi: Implement deprecated-input={reject,crash} for enum values
Date: Thu, 21 Oct 2021 11:40:58 +0200 [thread overview]
Message-ID: <87a6j2emvp.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20211011185323.ajhqe4qyvvi3bke4@redhat.com> (Eric Blake's message of "Mon, 11 Oct 2021 13:53:23 -0500")
Eric Blake <eblake@redhat.com> writes:
> On Sat, Oct 09, 2021 at 02:09:43PM +0200, Markus Armbruster wrote:
>> This copies the code implementing the policy from qapi/qmp-dispatch.c
>> to qapi/qobject-input-visitor.c. Tolerable, but if we acquire more
>> copes, we should look into factoring them out.
>
> copies
Fixing, thanks!
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>> docs/devel/qapi-code-gen.rst | 6 ++++--
>> qapi/compat.json | 3 ++-
>> include/qapi/util.h | 6 +++++-
>> qapi/qapi-visit-core.c | 18 +++++++++++++++---
>> scripts/qapi/types.py | 17 ++++++++++++++++-
>> 5 files changed, 42 insertions(+), 8 deletions(-)
>>
>> diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst
>> index 00334e9fb8..006a6f4a9a 100644
>> --- a/docs/devel/qapi-code-gen.rst
>> +++ b/docs/devel/qapi-code-gen.rst
>> @@ -708,8 +708,10 @@ QEMU shows a certain behaviour.
>> Special features
>> ~~~~~~~~~~~~~~~~
>>
>> -Feature "deprecated" marks a command, event, or struct member as
>> -deprecated. It is not supported elsewhere so far.
>> +Feature "deprecated" marks a command, event, struct or enum member as
>
> Do we want the comma before the conjunction? (I've seen style guides
> that recommend it, and style guides that discourage it; while I tend
> to write by the former style, I usually don't care about the latter.
> Rather, switching styles mid-patch caught my attention).
With a comma there, we claim structs can be marked, which is actually
wrong. Correct is "command, event, struct member, or enum member".
I'll rephrase to "marks a command, event, enum value, or struct member
deprecated."
>> +deprecated. It is not supported elsewhere so far. Interfaces so
>> +marked may be withdrawn in future releases in accordance with QEMU's
>> +deprecation policy.
>>
>>
>> +++ b/qapi/qapi-visit-core.c
>> @@ -393,7 +393,7 @@ static bool input_type_enum(Visitor *v, const char *name, int *obj,
>> const QEnumLookup *lookup, Error **errp)
>> {
>> int64_t value;
>> - char *enum_str;
>> + g_autofree char *enum_str = NULL;
>
> Nice change while touching the code. Is it worth mentioning in the
> commit message?
I figure it would be more distracting than useful.
>>
>> if (!visit_type_str(v, name, &enum_str, errp)) {
>> return false;
>> @@ -402,11 +402,23 @@ static bool input_type_enum(Visitor *v, const char *name, int *obj,
>> value = qapi_enum_parse(lookup, enum_str, -1, NULL);
>> if (value < 0) {
>> error_setg(errp, QERR_INVALID_PARAMETER, enum_str);
>> - g_free(enum_str);
>> return false;
>> }
>>
>> - g_free(enum_str);
>> + if (lookup->flags && (lookup->flags[value] & QAPI_ENUM_DEPRECATED)) {
>> + switch (v->compat_policy.deprecated_input) {
>> + case COMPAT_POLICY_INPUT_ACCEPT:
>> + break;
>> + case COMPAT_POLICY_INPUT_REJECT:
>> + error_setg(errp, "Deprecated value '%s' disabled by policy",
>> + enum_str);
>> + return false;
>> + case COMPAT_POLICY_INPUT_CRASH:
>> + default:
>> + abort();
>> + }
>> + }
>> +
>> *obj = value;
>> return true;
>> }
>
> Grammar fixes are minor, so:
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
Thanks!
next prev parent reply other threads:[~2021-10-21 9:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-09 12:09 [PATCH v2 0/5] qapi: Add feature flags to enum members Markus Armbruster
2021-10-09 12:09 ` [PATCH v2 1/5] qapi: Enable enum member introspection to show more than name Markus Armbruster
2021-10-11 18:37 ` Eric Blake
2021-10-12 10:08 ` Kevin Wolf
2021-10-21 7:45 ` Markus Armbruster
2021-10-09 12:09 ` [PATCH v2 2/5] qapi: Add feature flags to enum members Markus Armbruster
2021-10-12 10:41 ` Kevin Wolf
2021-10-21 8:48 ` Markus Armbruster
2021-10-09 12:09 ` [PATCH v2 3/5] qapi: Move compat policy from QObject to generic visitor Markus Armbruster
2021-10-09 12:09 ` [PATCH v2 4/5] qapi: Implement deprecated-input={reject, crash} for enum values Markus Armbruster
2021-10-11 18:53 ` [PATCH v2 4/5] qapi: Implement deprecated-input={reject,crash} " Eric Blake
2021-10-21 9:40 ` Markus Armbruster [this message]
2021-10-09 12:09 ` [PATCH RFC v2 5/5] block: Deprecate transaction type drive-backup Markus Armbruster
2021-10-11 18:58 ` Eric Blake
2021-10-12 10:52 ` Kevin Wolf
2021-10-21 9:47 ` Markus Armbruster
2021-10-12 12:39 ` [PATCH v2 0/5] qapi: Add feature flags to enum members Peter Krempa
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=87a6j2emvp.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=libguestfs@redhat.com \
--cc=libvir-list@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=pkrempa@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.