qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 2/3] watchdog.h: Drop local redefinition of a


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v4 2/3] watchdog.h: Drop local redefinition of actions enum
Date: Wed, 6 Sep 2017 10:37:48 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

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 <address@hidden>
> ---

> @@ -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?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]