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

[Xen-devel] [PATCH v2 1/2] cmdline_parse: Convert no- prefix into =no for OPT_CUSTOM



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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.