include/linux/slab.h
17341 /*
17342 * linux/mm/slab.h
17343 * Written by Mark Hemment, 1996.
17344 * (markhe@nextd.demon.co.uk)
17345 */
17346
17347 #if !defined(_LINUX_SLAB_H)
17348 #define _LINUX_SLAB_H
17349
17350 #if defined(__KERNEL__)
17351
17352 typedef struct kmem_cache_s kmem_cache_t;
17353
17354 #include <linux/mm.h>
17355 #include <asm/cache.h>
17356
17357 /* flags for kmem_cache_alloc() */
17358 #define SLAB_BUFFER GFP_BUFFER
17359 #define SLAB_ATOMIC GFP_ATOMIC
17360 #define SLAB_USER GFP_USER
17361 #define SLAB_KERNEL GFP_KERNEL
17362 #define SLAB_NFS GFP_NFS
17363 #define SLAB_DMA GFP_DMA
17364
17365 #define SLAB_LEVEL_MASK 0x0000007fUL
17366 /* don't grow a cache */
17367 #define SLAB_NO_GROW 0x00001000UL
17368
17369 /* flags to pass to kmem_cache_create(). The first 3 are
17370 * only valid when the allocator as been build
17371 * SLAB_DEBUG_SUPPORT. */
17372 /* Peform (expensive) checks on free */
17373 #define SLAB_DEBUG_FREE 0x00000100UL
17374 /* Call constructor (as verifier) */
17375 #define SLAB_DEBUG_INITIAL 0x00000200UL
17376 /* Red zone objs in a cache */
17377 #define SLAB_RED_ZONE 0x00000400UL
17378 /* Poison objects */
17379 #define SLAB_POISON 0x00000800UL
17380 /* never reap from the cache */
17381 #define SLAB_NO_REAP 0x00001000UL
17382 /* align objs on a h/w cache lines */
17383 #define SLAB_HWCACHE_ALIGN 0x00002000UL
17384 #if 0
17385 #define SLAB_HIGH_PACK 0x00004000UL /* XXX */
17386 #endif
17387
17388 /* flags passed to a constructor func */
17389 /* if not set, then deconstructor */
17390 #define SLAB_CTOR_CONSTRUCTOR 0x001UL
17391 /* tell constructor it can't sleep */
17392 #define SLAB_CTOR_ATOMIC 0x002UL
17393 /* tell constructor it's a verify call */
17394 #define SLAB_CTOR_VERIFY 0x004UL
17395
17396 /* prototypes */
17397 extern long kmem_cache_init(long, long);
17398 extern void kmem_cache_sizes_init(void);
17399 extern kmem_cache_t *kmem_find_general_cachep(size_t);
17400 extern kmem_cache_t *kmem_cache_create(const char *,
17401 size_t, size_t, unsigned long,
17402 void (*)(void *, kmem_cache_t *, unsigned long),
17403 void (*)(void *, kmem_cache_t *, unsigned long));
17404 extern int kmem_cache_shrink(kmem_cache_t *);
17405 extern void *kmem_cache_alloc(kmem_cache_t *, int);
17406 extern void kmem_cache_free(kmem_cache_t *, void *);
17407
17408 extern void *kmalloc(size_t, int);
17409 extern void kfree(const void *);
17410 extern void kfree_s(const void *, size_t);
17411
17412 extern void kmem_cache_reap(int);
17413 extern int get_slabinfo(char *);
17414
17415 /* System wide caches */
17416 extern kmem_cache_t *vm_area_cachep;
17417 extern kmem_cache_t *mm_cachep;
17418
17419 #endif /* __KERNEL__ */
17420
17421 #endif /* _LINUX_SLAB_H */
Сайт управляется системой
uCoz