#include <rsbac/types.h>
#include <rsbac/rkmem.h>
#include <rsbac/debug.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/timer.h>
Go to the source code of this file.
Typedefs | |
typedef rsbac_cache_sizes | rsbac_cache_sizes_t |
Functions | |
void __init | rsbac_kmem_cache_sizes_init (void) |
void * | rsbac_kmalloc (size_t size) |
void * | rsbac_vkmalloc (size_t size, rsbac_boolean_t *vmalloc_used_p) |
void | rsbac_kfree (const void *objp) |
static void | wakeup_kfree (u_long dk_dummy) |
void | rsbac_delayed_kfree (void *objp, rsbac_time_t delay) |
void | rsbac_vkfree (void *objp, rsbac_boolean_t vmalloc_used) |
Variables | |
static rsbac_cache_sizes_t | rsbac_cache_sizes [] |
|
|
|
Definition at line 181 of file rkmem.c. References rsbac_kmalloc(), and wakeup_kfree(). 00182 { 00183 struct rsbac_delayed_kfree_t * dk_p; 00184 00185 if(!objp) 00186 return; 00187 dk_p = rsbac_kmalloc(sizeof(*dk_p)); 00188 if(!dk_p) 00189 return; 00190 00191 dk_p->objp = objp; 00192 init_timer(&dk_p->timer); 00193 dk_p->timer.function = wakeup_kfree; 00194 dk_p->timer.data = (u_long) dk_p; 00195 dk_p->timer.expires = jiffies + delay * HZ; 00196 add_timer(&dk_p->timer); 00197 }
|
|
|
|
Definition at line 67 of file rkmem.c. References rsbac_cache_sizes::cs_cachep, rsbac_cache_sizes::cs_size, rsbac_cache_sizes::name, and NULL. Referenced by rsbac_do_init(). 00069 { 00070 rsbac_cache_sizes_t *sizes = rsbac_cache_sizes; 00071 00072 while (sizes->cs_size) { 00073 sizes->cs_cachep = kmem_cache_create( 00074 sizes->name, sizes->cs_size, 00075 0, SLAB_HWCACHE_ALIGN, NULL, NULL); 00076 if (!sizes->cs_cachep) 00077 BUG(); 00078 00079 sizes++; 00080 } 00081 }
|
|
Definition at line 202 of file rkmem.c. Referenced by rsbac_list_write_buffers(), and rsbac_list_write_lol_buffers().
|
|
Definition at line 122 of file rkmem.c. References rsbac_cache_sizes::cs_cachep, rsbac_cache_sizes::cs_size, FALSE, NULL, and TRUE. Referenced by fill_buffer(), and fill_lol_buffer(). 00123 { 00124 rsbac_cache_sizes_t *csizep = rsbac_cache_sizes; 00125 void * result; 00126 00127 if(!size) 00128 return NULL; 00129 for (; csizep->cs_size; csizep++) { 00130 if (size > csizep->cs_size) 00131 continue; 00132 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 00133 result = kmem_cache_alloc(csizep->cs_cachep, GFP_ATOMIC); 00134 #else 00135 result = kmem_cache_alloc(csizep->cs_cachep, GFP_KERNEL); 00136 #endif 00137 if(result) 00138 { 00139 if(vmalloc_used_p) 00140 *vmalloc_used_p = FALSE; 00141 return result; 00142 } 00143 } 00144 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 00145 return NULL; 00146 #else 00147 if(vmalloc_used_p) 00148 *vmalloc_used_p = TRUE; 00149 return vmalloc(size); 00150 #endif 00151 }
|
|
Definition at line 170 of file rkmem.c. References rsbac_delayed_kfree_t::objp. Referenced by rsbac_delayed_kfree(). 00171 { 00172 struct rsbac_delayed_kfree_t * dk_p = (struct rsbac_delayed_kfree_t *) dk_dummy; 00173 00174 kfree(dk_p->objp); 00175 kfree(dk_p); 00176 }
|
|
|