qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2] qapi, qemu-options: make all parsing visitors parse boole


From: Paolo Bonzini
Subject: Re: [PATCH v2] qapi, qemu-options: make all parsing visitors parse boolean options the same
Date: Wed, 4 Nov 2020 12:34:15 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1

On 04/11/20 08:35, Markus Armbruster wrote:
+               "boolean (on/off, yes/no, true/false, y/n)");
Recommend to have the error message only mention the preferred form.  I
like the laconic "'on' or 'off'".  It's really all the user needs to
know.


I went for "boolean (on/off) value".


Avoiding the full_name() on success isn't hard:

       if (!qapi_bool_parse(name, str, obj, NULL)) {
           error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
                      full_name(qiv, name), "'on' or 'off'");
           return false;
       }
       return true;

Can't refuse.


     case QEMU_OPT_BOOL:
-        return parse_option_bool(opt->name, opt->str, &opt->value.boolean,
-                                 errp);
+        return qapi_bool_parse(opt->name, opt->str, &opt->value.boolean, errp);

Please break the line the same way as before.

Why? It's not even 80 characters.

Paolo




reply via email to

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