From: Don Slutz <dslutz@verizon.com>
To: Jan Beulich <JBeulich@suse.com>, Don Slutz <dslutz@verizon.com>
Cc: Keir Fraser <keir@xen.org>,
Ian Campbell <ian.campbell@citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Tim Deegan <tim@xen.org>,
xen-devel@lists.xen.org, Ian Jackson <ian.jackson@eu.citrix.com>
Subject: Re: [PATCH v2 1/2] cmdline_parse: Convert no- prefix into =no for OPT_CUSTOM
Date: Wed, 30 Jul 2014 20:59:58 -0400 [thread overview]
Message-ID: <53D9950E.1060802@terremark.com> (raw)
In-Reply-To: <53D8C1B50200007800027886@mail.emea.novell.com>
On 07/30/14 03:58, Jan Beulich wrote:
>>>> On 29.07.14 at 21:57, <dslutz@verizon.com> wrote:
>> This allows converting OPT_BOOL into OPT_CUSTOM and still do what is
>> expected.
>>
>> Note: if both no- and = provided, pass provided = if not a zero
>> length string. Also log a warning about this.
>>
>> Signed-off-by: Don Slutz <dslutz@verizon.com>
>> ---
>> xen/common/kernel.c | 15 ++++++++++++++-
>> 1 file changed, 14 insertions(+), 1 deletion(-)
>>
>> diff --git a/xen/common/kernel.c b/xen/common/kernel.c
>> index 7e83353..9857159 100644
>> --- a/xen/common/kernel.c
>> +++ b/xen/common/kernel.c
>> @@ -135,7 +135,20 @@ void __init cmdline_parse(const char *cmdline)
>> parse_size_and_unit(optval, NULL));
>> break;
>> case OPT_CUSTOM:
>> - ((void (*)(const char *))param->var)(optval);
>> + if ( !bool_assert )
>> + {
>> + if ( *optval )
>> + {
>> + printk(XENLOG_WARNING
>> + "Warning: ignored no- prefix for %s=%s\n",
>> + param->name, optval);
> Log messages printed before the consoles get initialized are of limited
> value (they would only show up in "xl dmesg" or equivalent output).
> Therefore I'm not really certain this is worthwhile.
I am happy to go either way.
>> + ((void (*)(const char *))param->var)(optval);
>> + }
>> + else
>> + ((void (*)(const char *))param->var)("no");
>> + }
>> + else
>> + ((void (*)(const char *))param->var)(optval);
> Considering this repeated cast I'd prefer coding this quite
> differently, not the least because you also can't pass a literal
> "no" to the parsing functions (as they're permitted to alter the
> string), and at once also ignoring bogus "no-<name>=<value>"
> options instead of trying to assign a (perhaps unexpected)
> meaning:
>
> convert "no-" command line option prefix into "=no" for OPT_CUSTOM
>
> ... to allow restoring/retaining previous behavior for options getting
> converted from boolean to custom.
>
> Reported-by: Don Slutz <dslutz@verizon.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/common/kernel.c
> +++ b/xen/common/kernel.c
> @@ -135,6 +135,13 @@ void __init cmdline_parse(const char *cm
> parse_size_and_unit(optval, NULL));
> break;
> case OPT_CUSTOM:
> + if ( !bool_assert )
> + {
> + if ( *optval )
> + break;
> + safe_strcpy(opt, "no");
> + optval = opt;
> + }
> ((void (*)(const char *))param->var)(optval);
> break;
> default:
>
>
Without the log message, I think it might help to include the part about
ignoring bogus "no-<name>=<value>"... aka stacked inversions in the
commit message. This is because boolean options do still support stacked
inversions, which is valid under the statement "Explicitly specifying any
value other than those listed above is undefined, as is stacking a `no-`
prefix with an explicit value."
I am happy with the actual code change.
-Don Slutz
next prev parent reply other threads:[~2014-07-31 0:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-29 19:57 [PATCH v2 0/2] parse_bool fixes Don Slutz
2014-07-29 19:57 ` [PATCH v2 1/2] cmdline_parse: Convert no- prefix into =no for OPT_CUSTOM Don Slutz
2014-07-30 7:58 ` Jan Beulich
2014-07-31 0:59 ` Don Slutz [this message]
2014-08-01 6:57 ` Jan Beulich
2014-08-01 12:36 ` Don Slutz
2014-08-04 10:58 ` Ian Campbell
2014-08-04 11:39 ` Jan Beulich
2014-07-29 19:57 ` [PATCH v2 2/2] xen/console: Better handing of console_timestamps as a boolean_param Don Slutz
2014-07-30 8:01 ` Jan Beulich
2014-07-30 8:06 ` Jan Beulich
2014-07-31 0:36 ` Don Slutz
2014-08-04 11:00 ` Ian Campbell
2014-07-29 20:10 ` [PATCH v2 0/2] parse_bool fixes Andrew Cooper
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=53D9950E.1060802@terremark.com \
--to=dslutz@verizon.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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).