ia64/xen-unstable

changeset 6271:eb7486b93df5

Default unit for all Xen memory parameters is kilobytes.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Aug 19 09:16:56 2005 +0000 (2005-08-19)
parents 071412a64fb9
children 2de42ce9ffff
files docs/src/user.tex xen/arch/x86/domain_build.c xen/common/lib.c
line diff
     1.1 --- a/docs/src/user.tex	Fri Aug 19 09:05:04 2005 +0000
     1.2 +++ b/docs/src/user.tex	Fri Aug 19 09:16:56 2005 +0000
     1.3 @@ -1763,7 +1763,7 @@ editing \path{grub.conf}.
     1.4   physical address in the memory map will be ignored. This parameter
     1.5   may be specified with a B, K, M or G suffix, representing bytes,
     1.6   kilobytes, megabytes and gigabytes respectively. The
     1.7 - default unit, if no suffix is specified, is bytes.
     1.8 + default unit, if no suffix is specified, is kilobytes.
     1.9  
    1.10  \item [dom0\_mem=xxx ] 
    1.11   Set the amount of memory to be allocated to domain0. In Xen 3.x the parameter
     2.1 --- a/xen/arch/x86/domain_build.c	Fri Aug 19 09:05:04 2005 +0000
     2.2 +++ b/xen/arch/x86/domain_build.c	Fri Aug 19 09:16:56 2005 +0000
     2.3 @@ -22,16 +22,11 @@
     2.4  #include <asm/i387.h>
     2.5  #include <asm/shadow.h>
     2.6  
     2.7 -/* opt_dom0_mem: memory allocated to domain 0. */
     2.8 -static unsigned int opt_dom0_mem;
     2.9 +static unsigned long dom0_nrpages;
    2.10  static void parse_dom0_mem(char *s)
    2.11  {
    2.12      unsigned long long bytes = parse_size_and_unit(s);
    2.13 -    /* If no unit is specified we default to kB units, not bytes. */
    2.14 -    if ( isdigit(s[strlen(s)-1]) )
    2.15 -        opt_dom0_mem = (unsigned int)bytes;
    2.16 -    else
    2.17 -        opt_dom0_mem = (unsigned int)(bytes >> 10);
    2.18 +    dom0_nrpages = bytes >> PAGE_SHIFT;
    2.19  }
    2.20  custom_param("dom0_mem", parse_dom0_mem);
    2.21  
    2.22 @@ -139,7 +134,7 @@ int construct_dom0(struct domain *d,
    2.23  
    2.24      /* By default DOM0 is allocated all available memory. */
    2.25      d->max_pages = ~0U;
    2.26 -    if ( (nr_pages = opt_dom0_mem >> (PAGE_SHIFT - 10)) == 0 )
    2.27 +    if ( (nr_pages = dom0_nrpages) == 0 )
    2.28          nr_pages = avail_domheap_pages() +
    2.29              ((initrd_len + PAGE_SIZE - 1) >> PAGE_SHIFT) +
    2.30              ((image_len  + PAGE_SIZE - 1) >> PAGE_SHIFT);
     3.1 --- a/xen/common/lib.c	Fri Aug 19 09:05:04 2005 +0000
     3.2 +++ b/xen/common/lib.c	Fri Aug 19 09:16:56 2005 +0000
     3.3 @@ -450,8 +450,10 @@ unsigned long long parse_size_and_unit(c
     3.4  		ret <<= 10;
     3.5  	case 'M': case 'm':
     3.6  		ret <<= 10;
     3.7 -	case 'K': case 'k':
     3.8 +	case 'K': case 'k': default:
     3.9  		ret <<= 10;
    3.10 +	case 'B': case 'b':
    3.11 +		break;
    3.12  	}
    3.13  
    3.14  	return ret;