ia64/xen-unstable

changeset 12682:2a17ff9b8ffc

[XEN] kexec: use parse_size_and_unit() when parsing crashkernel
command line parameter.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Thu Nov 30 12:39:35 2006 +0000 (2006-11-30)
parents b19922790440
children 5d6be0099bdf
files xen/common/kexec.c
line diff
     1.1 --- a/xen/common/kexec.c	Thu Nov 30 12:38:51 2006 +0000
     1.2 +++ b/xen/common/kexec.c	Thu Nov 30 12:39:35 2006 +0000
     1.3 @@ -138,32 +138,21 @@ static __init int register_crashdump_tri
     1.4  
     1.5  void machine_kexec_reserved(xen_kexec_reserve_t *reservation)
     1.6  {
     1.7 -    unsigned long val[2];
     1.8 +    unsigned long start, size;
     1.9      char *str = opt_crashkernel;
    1.10 -    int k = 0;
    1.11  
    1.12      memset(reservation, 0, sizeof(*reservation));
    1.13  
    1.14 -    while (k < ARRAY_SIZE(val)) {
    1.15 -        if (*str == '\0') {
    1.16 -            break;
    1.17 -        }
    1.18 -        val[k] = simple_strtoul(str, &str, 0);
    1.19 -        switch (toupper(*str)) {
    1.20 -        case 'G': val[k] <<= 10;
    1.21 -        case 'M': val[k] <<= 10;
    1.22 -        case 'K': val[k] <<= 10;
    1.23 -            str++;
    1.24 -        }
    1.25 -        if (*str == '@') {
    1.26 -            str++;
    1.27 -        }
    1.28 -        k++;
    1.29 -    }
    1.30 +    size = parse_size_and_unit(str, &str);
    1.31 +    if ( *str == '@' )
    1.32 +        start = parse_size_and_unit(str+1, NULL);
    1.33 +    else
    1.34 +        start = 0;
    1.35  
    1.36 -    if (k == ARRAY_SIZE(val)) {
    1.37 -        reservation->size = val[0];
    1.38 -        reservation->start = val[1];
    1.39 +    if ( start && size )
    1.40 +    {
    1.41 +        reservation->start = start;
    1.42 +        reservation->size = size;
    1.43      }
    1.44  }
    1.45