From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: Michal Privoznik <mprivozn@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 2/3] watchdog.h: Drop local redefinition of actions enum
Date: Wed, 06 Sep 2017 19:25:58 +0200 [thread overview]
Message-ID: <87zia7rb6h.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <6ac4f80c-3e80-297b-a4d6-2f4ae0b70d66@redhat.com> (Eric Blake's message of "Wed, 6 Sep 2017 10:37:48 -0500")
Eric Blake <eblake@redhat.com> writes:
> On 09/06/2017 06:24 AM, Michal Privoznik wrote:
>> We already have enum that enumerates all the action that a
>
> s/action/actions/
>
>> watchdog can take when hitting its timeout: WatchdogAction.
>> Use that instead of inventing our own.
>>
>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>> ---
>
>> @@ -77,27 +77,16 @@ int select_watchdog(const char *p)
>>
>> int select_watchdog_action(const char *p)
>> {
>> - if (strcasecmp(p, "reset") == 0)
>> - watchdog_action = WDT_RESET;
>
> The old code was case-insensitive,
>
>> + action = qapi_enum_parse(&WatchdogAction_lookup, p, -1, NULL);
>
> the new code is not. Do we care? (I don't, but we could be breaking
> someone's control flow). Should qapi_enum_parse be taught to be
> case-insensitive? Or perhaps we answer related questions first: Do we
> have any QAPI enums that have values differing only in case? Do we
> prevent such QAPI definitions, to give us the potential of making the
> parsing insensitive?
Case-sensitive everywhere is fine. Case-insensitive everywhere also
fine, just not my personal preference. What's not fine is "guess
whether this part of the interface is case-sensitive or not".
QMP is case-sensitive. Let's keep it that way.
The -watchdog-action option has a case-insensitive argument. The
obvious way to remain misfeature-^Wbackwards compatible is converting
the argument to lower case before handing it off to qapi_enum_parse. I
doubt it matters, but just doing it is less work than debating how far
exactly we want to bend over backwards.
g_ascii_strdown() should do. It only converts ASCII characters, but
anything else is going to fail in qapi_enum_parse() anyway.
next prev parent reply other threads:[~2017-09-06 17:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 11:24 [Qemu-devel] [PATCH v4 0/3] watchdog: Allow setting action on the fly Michal Privoznik
2017-09-06 11:24 ` [Qemu-devel] [PATCH v4 1/3] qapi: Rename WatchdogExpirationAction enum Michal Privoznik
2017-09-06 15:34 ` Eric Blake
2017-09-06 11:24 ` [Qemu-devel] [PATCH v4 2/3] watchdog.h: Drop local redefinition of actions enum Michal Privoznik
2017-09-06 15:37 ` Eric Blake
2017-09-06 17:25 ` Markus Armbruster [this message]
2017-09-07 7:56 ` Michal Privoznik
2017-09-07 9:02 ` Markus Armbruster
2017-09-06 11:24 ` [Qemu-devel] [PATCH v4 3/3] watchdog: Allow setting action on the fly Michal Privoznik
2017-09-06 15:39 ` Eric Blake
2017-09-06 17:15 ` Markus Armbruster
2017-09-06 15:32 ` [Qemu-devel] [PATCH v4 0/3] " Markus Armbruster
2017-09-06 15:37 ` Richard W.M. Jones
2017-09-06 15:41 ` Michal Privoznik
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=87zia7rb6h.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=mprivozn@redhat.com \
--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 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.