/daten/src/linux-2.4.27-rsbac-v1.2.3/include/rsbac/rkmem.h

Go to the documentation of this file.
00001 /*************************************************** */ 00002 /* Rule Set Based Access Control */ 00003 /* Author and (c) 1999-2004: Amon Ott <ao@rsbac.org> */ 00004 /* Memory allocation */ 00005 /* Last modified: 29/Apr/2004 */ 00006 /*************************************************** */ 00007 00008 #ifndef __RSBAC_RKMEM_H 00009 #define __RSBAC_RKMEM_H 00010 00011 #include <linux/init.h> 00012 #include <linux/slab.h> 00013 #include <linux/vmalloc.h> 00014 00015 #ifdef CONFIG_RSBAC_INIT_DELAY 00016 void rsbac_kmem_cache_sizes_init(void); 00017 #else 00018 void __init rsbac_kmem_cache_sizes_init(void); 00019 #endif 00020 00021 /* if you might need more than this in 2.4, use rsbac_vkmalloc! */ 00022 /* In 2.6, this is the maximum to allocate, more will fail! */ 00023 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 00024 00025 #ifdef CONFIG_MMU 00026 #define RSBAC_MAX_KMALLOC 131072 00027 #else 00028 #ifndef CONFIG_LARGE_ALLOCS 00029 #define RSBAC_MAX_KMALLOC 1048576 00030 #else 00031 #define RSBAC_MAX_KMALLOC 33554432 00032 #endif 00033 #endif 00034 00035 #define rsbac_vmalloc(x) kmalloc(x, GFP_ATOMIC) 00036 #define rsbac_vfree(x) kfree(x) 00037 00038 /* < 2.6 */ 00039 #else 00040 #define RSBAC_MAX_KMALLOC 8192 00041 #define rsbac_vmalloc(x) vmalloc(x) 00042 #define rsbac_vfree(x) vfree(x) 00043 #endif 00044 00045 extern void * rsbac_kmalloc (size_t size); 00046 00047 /* Allocate memory. This function decides which alloc type (kmalloc or vmalloc) */ 00048 /* to use and returns the decision as boolean value (TRUE = vmalloc), */ 00049 /* if vmalloc_used_p is not NULL (what it should rather be...) */ 00050 extern void * rsbac_vkmalloc (size_t size, boolean * vmalloc_used_p); 00051 00052 extern void rsbac_kfree (const void *objp); 00053 00054 /* Free the allocated mem. Needs old returned mem type value, */ 00055 /* or FALSE, if no type stored (kmalloc type assumed) */ 00056 extern void rsbac_vkfree (void *objp, boolean vmalloc_used); 00057 00058 #endif

Generated on Tue Aug 31 10:05:22 2004 for RSBAC by doxygen 1.3.8