Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Enumerations | Functions
zsmalloc.h File Reference
#include <linux/types.h>

Go to the source code of this file.

Enumerations

enum  zs_mapmode { ZS_MM_RW, ZS_MM_RO, ZS_MM_WO }
 

Functions

struct zs_poolzs_create_pool (const char *name, gfp_t flags)
 
void zs_destroy_pool (struct zs_pool *pool)
 
unsigned long zs_malloc (struct zs_pool *pool, size_t size)
 
void zs_free (struct zs_pool *pool, unsigned long obj)
 
voidzs_map_object (struct zs_pool *pool, unsigned long handle, enum zs_mapmode mm)
 
void zs_unmap_object (struct zs_pool *pool, unsigned long handle)
 
u64 zs_get_total_size_bytes (struct zs_pool *pool)
 

Enumeration Type Documentation

enum zs_mapmode
Enumerator:
ZS_MM_RW 
ZS_MM_RO 
ZS_MM_WO 

Definition at line 23 of file zsmalloc.h.

Function Documentation

struct zs_pool* zs_create_pool ( const char name,
gfp_t  flags 
)
read

Definition at line 801 of file zsmalloc-main.c.

void zs_destroy_pool ( struct zs_pool pool)

Definition at line 837 of file zsmalloc-main.c.

void zs_free ( struct zs_pool pool,
unsigned long  obj 
)

Definition at line 916 of file zsmalloc-main.c.

u64 zs_get_total_size_bytes ( struct zs_pool pool)

Definition at line 1048 of file zsmalloc-main.c.

unsigned long zs_malloc ( struct zs_pool pool,
size_t  size 
)

zs_malloc - Allocate block of given size from pool. : pool to allocate from : size of block to allocate

On success, handle to the allocated object is returned, otherwise 0. Allocation requests with size > ZS_MAX_ALLOC_SIZE will fail.

Definition at line 866 of file zsmalloc-main.c.

void* zs_map_object ( struct zs_pool pool,
unsigned long  handle,
enum zs_mapmode  mm 
)

zs_map_object - get address of allocated object from handle. : pool from which the object was allocated : handle returned from zs_malloc

Before using an object allocated from zs_malloc, it must be mapped using this function. When done with the object, it must be unmapped using zs_unmap_object.

Only one object can be mapped per cpu at a time. There is no protection against nested mappings.

This function returns with preemption and page faults disabled.

Definition at line 972 of file zsmalloc-main.c.

void zs_unmap_object ( struct zs_pool pool,
unsigned long  handle 
)

Definition at line 1015 of file zsmalloc-main.c.