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

[Xen-devel] [PATCH 2/3] xen/console: Better handing of console_timestamps as a boolean_param



In order to handle all the old ways, change to use parse_bool().

Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>
---
 xen/drivers/char/console.c | 39 +++++++++++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index ec871c0..44d6a2b 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -557,17 +557,36 @@ static int printk_prefix_check(char *p, char **pp)
             ((loglvl < upper_thresh) && printk_ratelimit()));
 } 
 
-static void __init parse_console_timestamps(char *s)
+static void __init parse_console_timestamps(char *s, int bool_assert)
 {
-    if ( *s == '\0' || /* Compat for old booleanparam() */
-         !strcmp(s, "date") )
-        opt_con_timestamp_mode = TSM_DATE;
-    else if ( !strcmp(s, "datems") )
-        opt_con_timestamp_mode = TSM_DATE_MS;
-    else if ( !strcmp(s, "boot") )
-        opt_con_timestamp_mode = TSM_BOOT;
-    else if ( !strcmp(s, "none") )
-        opt_con_timestamp_mode = TSM_NONE;
+    switch ( parse_bool(s) )
+    {
+    case 0:
+        bool_assert = !bool_assert;
+        /* fall through */
+    case 1:
+        if ( bool_assert )
+            opt_con_timestamp_mode = TSM_DATE;
+        else
+            opt_con_timestamp_mode = TSM_NONE;
+        break;
+    default:
+        if ( *s == '\0' ) /* Compat for old booleanparam() */
+        {
+            if ( bool_assert )
+                opt_con_timestamp_mode = TSM_DATE;
+            else
+                opt_con_timestamp_mode = TSM_NONE;
+        }
+        else if ( !strcmp(s, "date") )
+            opt_con_timestamp_mode = TSM_DATE;
+        else if ( !strcmp(s, "datems") )
+            opt_con_timestamp_mode = TSM_DATE_MS;
+        else if ( !strcmp(s, "boot") )
+            opt_con_timestamp_mode = TSM_BOOT;
+        else if ( !strcmp(s, "none") )
+            opt_con_timestamp_mode = TSM_NONE;
+    }
 }
 
 static void printk_start_of_line(const char *prefix)
-- 
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®.