debuggers.hg

view xen/include/xen/slab.h @ 3515:d331c6994d28

bitkeeper revision 1.1159.223.12 (41f14d3cE4GADmEAEr6XE9nXX4dyGw)

Common-code cleanups. Moved arch-specific code out into arch/x86
and asm-x86.
author kaf24@scramble.cl.cam.ac.uk
date Fri Jan 21 18:43:08 2005 +0000 (2005-01-21)
parents dae98734f12e
children 46c14b1a4351
line source
1 /*
2 * Written by Mark Hemment, 1996.
3 * (markhe@nextd.demon.co.uk)
4 */
6 #ifndef __SLAB_H__
7 #define __SLAB_H__
9 #include <xen/config.h>
11 #ifdef __ARCH_HAS_SLAB_ALLOCATOR
13 #include <asm/slab.h>
15 #else
17 typedef struct xmem_cache_s xmem_cache_t;
19 #include <xen/mm.h>
20 #include <xen/cache.h>
22 /* Flags to pass to xmem_cache_create(). */
23 /* NB. The first 3 are only valid when built with SLAB_DEBUG_SUPPORT. */
24 #define SLAB_DEBUG_INITIAL 0x00000200UL /* Call constructor */
25 #define SLAB_RED_ZONE 0x00000400UL /* Red zone objs in a cache */
26 #define SLAB_POISON 0x00000800UL /* Poison objects */
27 #define SLAB_NO_REAP 0x00001000UL /* never reap from the cache */
28 #define SLAB_HWCACHE_ALIGN 0x00002000UL /* align obj on a cache line */
30 /* Flags passed to a constructor function. */
31 #define SLAB_CTOR_CONSTRUCTOR 0x001UL /* if not set, then deconstructor */
32 #define SLAB_CTOR_ATOMIC 0x002UL /* tell cons. it can't sleep */
33 #define SLAB_CTOR_VERIFY 0x004UL /* tell cons. it's a verify call */
35 extern void xmem_cache_init(void);
36 extern void xmem_cache_sizes_init(unsigned long);
38 extern xmem_cache_t *xmem_find_general_cachep(size_t);
39 extern xmem_cache_t *xmem_cache_create(
40 const char *, size_t, size_t, unsigned long,
41 void (*)(void *, xmem_cache_t *, unsigned long),
42 void (*)(void *, xmem_cache_t *, unsigned long));
43 extern int xmem_cache_destroy(xmem_cache_t *);
44 extern int xmem_cache_shrink(xmem_cache_t *);
45 extern void *xmem_cache_alloc(xmem_cache_t *);
46 extern void xmem_cache_free(xmem_cache_t *, void *);
48 extern void *xmalloc(size_t);
49 extern void xfree(const void *);
51 extern int xmem_cache_reap(void);
53 extern void dump_slabinfo();
55 #endif /* __ARCH_HAS_SLAB_ALLOCATOR */
57 #endif /* __SLAB_H__ */