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

[Xen-changelog] [xen-unstable] [XEN] kexec: use parse_size_and_unit() when parsing crashkernel



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
# Node ID 2a17ff9b8ffc7e8d52092b57bd48ab42876fab2d
# Parent  b199227904405d628beaa575c638f935552e0d6d
[XEN] kexec: use parse_size_and_unit() when parsing crashkernel
command line parameter.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
---
 xen/common/kexec.c |   33 +++++++++++----------------------
 1 files changed, 11 insertions(+), 22 deletions(-)

diff -r b19922790440 -r 2a17ff9b8ffc xen/common/kexec.c
--- a/xen/common/kexec.c        Thu Nov 30 12:38:51 2006 +0000
+++ b/xen/common/kexec.c        Thu Nov 30 12:39:35 2006 +0000
@@ -138,32 +138,21 @@ __initcall(register_crashdump_trigger);
 
 void machine_kexec_reserved(xen_kexec_reserve_t *reservation)
 {
-    unsigned long val[2];
+    unsigned long start, size;
     char *str = opt_crashkernel;
-    int k = 0;
 
     memset(reservation, 0, sizeof(*reservation));
 
-    while (k < ARRAY_SIZE(val)) {
-        if (*str == '\0') {
-            break;
-        }
-        val[k] = simple_strtoul(str, &str, 0);
-        switch (toupper(*str)) {
-        case 'G': val[k] <<= 10;
-        case 'M': val[k] <<= 10;
-        case 'K': val[k] <<= 10;
-            str++;
-        }
-        if (*str == '@') {
-            str++;
-        }
-        k++;
-    }
-
-    if (k == ARRAY_SIZE(val)) {
-        reservation->size = val[0];
-        reservation->start = val[1];
+    size = parse_size_and_unit(str, &str);
+    if ( *str == '@' )
+        start = parse_size_and_unit(str+1, NULL);
+    else
+        start = 0;
+
+    if ( start && size )
+    {
+        reservation->start = start;
+        reservation->size = size;
     }
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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