00001
00002
00003
00004
00005
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 #include <linux/timer.h>
00015
00016 #ifdef CONFIG_RSBAC_INIT_DELAY
00017 void rsbac_kmem_cache_sizes_init(void);
00018 #else
00019 void __init rsbac_kmem_cache_sizes_init(void);
00020 #endif
00021
00022
00023
00024 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
00025
00026 #ifdef CONFIG_MMU
00027 #define RSBAC_MAX_KMALLOC 131072
00028 #else
00029 #ifndef CONFIG_LARGE_ALLOCS
00030 #define RSBAC_MAX_KMALLOC 1048576
00031 #else
00032 #define RSBAC_MAX_KMALLOC 33554432
00033 #endif
00034 #endif
00035
00036 #define rsbac_vmalloc(x) kmalloc(x, GFP_ATOMIC)
00037 #define rsbac_vfree(x) kfree(x)
00038
00039
00040 #else
00041 #define RSBAC_MAX_KMALLOC 8192
00042 #define rsbac_vmalloc(x) vmalloc(x)
00043 #define rsbac_vfree(x) vfree(x)
00044 #endif
00045
00046 struct rsbac_delayed_kfree_t
00047 {
00048 struct timer_list timer;
00049 void * objp;
00050 };
00051
00052 extern void * rsbac_kmalloc (size_t size);
00053
00054
00055
00056
00057 extern void * rsbac_vkmalloc (size_t size, rsbac_boolean_t * vmalloc_used_p);
00058
00059 extern void rsbac_kfree (const void *objp);
00060
00061 extern void rsbac_delayed_kfree(void *objp, rsbac_time_t delay);
00062
00063
00064
00065 extern void rsbac_vkfree (void *objp, rsbac_boolean_t vmalloc_used);
00066
00067 #endif