ia64/xen-unstable

changeset 3614:10a0f6b0a996

bitkeeper revision 1.1159.238.3 (4200cd90cCW2XIYxAgdkWL28Tzf-8g)

Introduce _xmalloc for when you really want just bytes.

Signed-off-by: ian.pratt@cl.cam.ac.uk
author iap10@labyrinth.cl.cam.ac.uk
date Wed Feb 02 12:54:40 2005 +0000 (2005-02-02)
parents f98fa170a9f4
children 49103eca5edb
files xen/arch/x86/microcode.c xen/arch/x86/pci-pc.c xen/arch/x86/shadow.c xen/common/sched_bvt.c xen/common/slab.c xen/include/asm-x86/shadow.h xen/include/xen/slab.h
line diff
     1.1 --- a/xen/arch/x86/microcode.c	Wed Feb 02 12:43:34 2005 +0000
     1.2 +++ b/xen/arch/x86/microcode.c	Wed Feb 02 12:54:40 2005 +0000
     1.3 @@ -84,7 +84,7 @@
     1.4  #define DECLARE_MUTEX(_m) spinlock_t _m = SPIN_LOCK_UNLOCKED
     1.5  #define down(_m) spin_lock(_m)
     1.6  #define up(_m) spin_unlock(_m)
     1.7 -#define vmalloc(_s) xmalloc(_s)
     1.8 +#define vmalloc(_s) _xmalloc(_s)
     1.9  #define vfree(_p) xfree(_p)
    1.10  #define num_online_cpus() smp_num_cpus
    1.11  static inline int on_each_cpu(
     2.1 --- a/xen/arch/x86/pci-pc.c	Wed Feb 02 12:43:34 2005 +0000
     2.2 +++ b/xen/arch/x86/pci-pc.c	Wed Feb 02 12:54:40 2005 +0000
     2.3 @@ -1036,7 +1036,7 @@ struct irq_routing_table * __devinit pci
     2.4  	if (ret & 0xff00)
     2.5  		printk(KERN_ERR "PCI: Error %02x when fetching IRQ routing table.\n", (ret >> 8) & 0xff);
     2.6  	else if (opt.size) {
     2.7 -		rt = xmalloc(sizeof(struct irq_routing_table) + opt.size);
     2.8 +		rt = _xmalloc(sizeof(struct irq_routing_table) + opt.size);
     2.9  		if (rt) {
    2.10  			memset(rt, 0, sizeof(struct irq_routing_table));
    2.11  			rt->size = opt.size + sizeof(struct irq_routing_table);
     3.1 --- a/xen/arch/x86/shadow.c	Wed Feb 02 12:43:34 2005 +0000
     3.2 +++ b/xen/arch/x86/shadow.c	Wed Feb 02 12:54:40 2005 +0000
     3.3 @@ -185,7 +185,7 @@ int shadow_mode_enable(struct domain *p,
     3.4      {
     3.5          m->shadow_dirty_bitmap_size = (p->max_pages + 63) & ~63;
     3.6          m->shadow_dirty_bitmap = 
     3.7 -            xmalloc(m->shadow_dirty_bitmap_size/8);
     3.8 +            _xmalloc(m->shadow_dirty_bitmap_size/8);
     3.9          if ( m->shadow_dirty_bitmap == NULL )
    3.10          {
    3.11              m->shadow_dirty_bitmap_size = 0;
     4.1 --- a/xen/common/sched_bvt.c	Wed Feb 02 12:43:34 2005 +0000
     4.2 +++ b/xen/common/sched_bvt.c	Wed Feb 02 12:54:40 2005 +0000
     4.3 @@ -171,7 +171,7 @@ int bvt_alloc_task(struct exec_domain *e
     4.4  {
     4.5      struct domain *d = ed->domain;
     4.6      if ( (d->sched_priv == NULL) ) {
     4.7 -        if ( (d->sched_priv = new(struct bvt_dom_info)) == NULL )
     4.8 +        if ( (d->sched_priv = xmalloc(struct bvt_dom_info)) == NULL )
     4.9              return -1;
    4.10          memset(d->sched_priv, 0, sizeof(struct bvt_dom_info));
    4.11      }
     5.1 --- a/xen/common/slab.c	Wed Feb 02 12:43:34 2005 +0000
     5.2 +++ b/xen/common/slab.c	Wed Feb 02 12:54:40 2005 +0000
     5.3 @@ -1449,10 +1449,10 @@ void *xmem_cache_alloc(xmem_cache_t *cac
     5.4  }
     5.5  
     5.6  /**
     5.7 - * xmalloc - allocate memory
     5.8 + * _xmalloc - allocate memory
     5.9   * @size: how many bytes of memory are required.
    5.10   */
    5.11 -void *xmalloc(size_t size)
    5.12 +void *_xmalloc(size_t size)
    5.13  {
    5.14      cache_sizes_t *csizep = cache_sizes;
    5.15  
    5.16 @@ -1548,7 +1548,7 @@ static int xmem_tune_cpucache (xmem_cach
    5.17          for (i = 0; i< smp_num_cpus; i++) {
    5.18              cpucache_t* ccnew;
    5.19  
    5.20 -            ccnew = xmalloc(sizeof(void*)*limit+sizeof(cpucache_t));
    5.21 +            ccnew = _xmalloc(sizeof(void*)*limit+sizeof(cpucache_t));
    5.22              if (!ccnew)
    5.23                  goto oom;
    5.24              ccnew->limit = limit;
     6.1 --- a/xen/include/asm-x86/shadow.h	Wed Feb 02 12:43:34 2005 +0000
     6.2 +++ b/xen/include/asm-x86/shadow.h	Wed Feb 02 12:54:40 2005 +0000
     6.3 @@ -616,7 +616,7 @@ static inline void set_shadow_status(
     6.4      {
     6.5          SH_LOG("Allocate more shadow hashtable blocks.");
     6.6  
     6.7 -        extra = xmalloc(
     6.8 +        extra = _xmalloc(
     6.9              sizeof(void *) + (shadow_ht_extra_size * sizeof(*x)));
    6.10  
    6.11          /* XXX Should be more graceful here. */
     7.1 --- a/xen/include/xen/slab.h	Wed Feb 02 12:43:34 2005 +0000
     7.2 +++ b/xen/include/xen/slab.h	Wed Feb 02 12:54:40 2005 +0000
     7.3 @@ -46,7 +46,7 @@ extern int xmem_cache_shrink(xmem_cache_
     7.4  extern void *xmem_cache_alloc(xmem_cache_t *);
     7.5  extern void xmem_cache_free(xmem_cache_t *, void *);
     7.6  
     7.7 -extern void *xmalloc(size_t);
     7.8 +extern void *_xmalloc(size_t);
     7.9  extern void xfree(const void *);
    7.10  
    7.11  extern int xmem_cache_reap(void);
    7.12 @@ -54,15 +54,15 @@ extern int xmem_cache_reap(void);
    7.13  extern void dump_slabinfo();
    7.14  
    7.15  /* Nicely typesafe for you. */
    7.16 -#define xmalloc(type) ((type *)xmalloc(sizeof(type)))
    7.17 -#define xmalloc_array(type, num) ((type *)xmalloc_array(sizeof(type), (num)))
    7.18 +#define xmalloc(type) ((type *)_xmalloc(sizeof(type)))
    7.19 +#define xmalloc_array(type, num) ((type *)_xmalloc_array(sizeof(type), (num)))
    7.20  
    7.21 -static inline void *xmalloc_array(size_t size, size_t num)
    7.22 +static inline void *_xmalloc_array(size_t size, size_t num)
    7.23  {
    7.24  	/* Check for overflow. */
    7.25  	if (size && num > UINT_MAX / size)
    7.26  		return NULL;
    7.27 -	return xmalloc(size * num);
    7.28 +	return _xmalloc(size * num);
    7.29  }
    7.30  #endif /* __ARCH_HAS_SLAB_ALLOCATOR */
    7.31