xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: xen-devel@lists.xen.org
Cc: Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Don Slutz <dslutz@verizon.com>, Tim Deegan <tim@xen.org>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v2 1/2] cmdline_parse: Convert no- prefix into =no for OPT_CUSTOM
Date: Tue, 29 Jul 2014 15:57:48 -0400	[thread overview]
Message-ID: <1406663869-31522-2-git-send-email-dslutz@verizon.com> (raw)
In-Reply-To: <1406663869-31522-1-git-send-email-dslutz@verizon.com>

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);
+                        ((void (*)(const char *))param->var)(optval);
+                    }
+                    else
+                        ((void (*)(const char *))param->var)("no");
+                }
+                else
+                    ((void (*)(const char *))param->var)(optval);
                 break;
             default:
                 BUG();
-- 
1.8.4

  reply	other threads:[~2014-07-29 19:57 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 ` Don Slutz [this message]
2014-07-30  7:58   ` [PATCH v2 1/2] cmdline_parse: Convert no- prefix into =no for OPT_CUSTOM Jan Beulich
2014-07-31  0:59     ` Don Slutz
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=1406663869-31522-2-git-send-email-dslutz@verizon.com \
    --to=dslutz@verizon.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.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).