ia64/xen-unstable

changeset 3629:07d5c9548534

bitkeeper revision 1.1159.212.76 (4201eac5AlEp4jSQYKA8-oSf0N15pQ)

Add xmalloc_bytes() to the allocator API.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Thu Feb 03 09:11:33 2005 +0000 (2005-02-03)
parents e922aa58971a
children d55d523078f7
files xen/arch/x86/microcode.c xen/arch/x86/pci-pc.c xen/include/asm-x86/shadow.h xen/include/xen/slab.h
line diff
     1.1 --- a/xen/arch/x86/microcode.c	Thu Feb 03 09:01:35 2005 +0000
     1.2 +++ b/xen/arch/x86/microcode.c	Thu Feb 03 09:11:33 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) ((void *)xmalloc(u8[_s]))
     1.8 +#define vmalloc(_s) xmalloc_bytes(_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	Thu Feb 03 09:01:35 2005 +0000
     2.2 +++ b/xen/arch/x86/pci-pc.c	Thu Feb 03 09:11:33 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 = (struct irq_routing_table *)xmalloc(u8[sizeof(struct irq_routing_table) + opt.size]);
     2.8 +		rt = xmalloc_bytes(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/include/asm-x86/shadow.h	Thu Feb 03 09:01:35 2005 +0000
     3.2 +++ b/xen/include/asm-x86/shadow.h	Thu Feb 03 09:11:33 2005 +0000
     3.3 @@ -616,8 +616,8 @@ static inline void set_shadow_status(
     3.4      {
     3.5          SH_LOG("Allocate more shadow hashtable blocks.");
     3.6  
     3.7 -        extra = (struct shadow_status *)xmalloc(
     3.8 -            u8[sizeof(void *) + (shadow_ht_extra_size * sizeof(*x))]);
     3.9 +        extra = xmalloc_bytes(
    3.10 +            sizeof(void *) + (shadow_ht_extra_size * sizeof(*x)));
    3.11  
    3.12          /* XXX Should be more graceful here. */
    3.13          if ( extra == NULL )
     4.1 --- a/xen/include/xen/slab.h	Thu Feb 03 09:01:35 2005 +0000
     4.2 +++ b/xen/include/xen/slab.h	Thu Feb 03 09:11:33 2005 +0000
     4.3 @@ -53,11 +53,17 @@ extern int xmem_cache_reap(void);
     4.4  
     4.5  extern void dump_slabinfo();
     4.6  
     4.7 -/* Nicely typesafe for you. */
     4.8 -#define xmalloc(_type) ((typeof(_type) *)_xmalloc(sizeof(_type)))
     4.9 +/* Allocate space for typed object. */
    4.10 +#define xmalloc(_type) ((_type *)_xmalloc(sizeof(_type)))
    4.11 +
    4.12 +/* Allocate space for array of typed objects. */
    4.13  #define xmalloc_array(_type, _num)                 \
    4.14  ((_type *)(((_num) > (UINT_MAX / sizeof(_type))) ? \
    4.15             NULL : _xmalloc((_num) * sizeof(_type))))
    4.16 +
    4.17 +/* Allocate untyped storage. */
    4.18 +#define xmalloc_bytes(_bytes) (_xmalloc(_bytes))
    4.19 +
    4.20  #endif /* __ARCH_HAS_SLAB_ALLOCATOR */
    4.21  
    4.22  #endif /* __SLAB_H__ */