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

Go to the source code of this file.

Functions

int heap_init (struct ptr_heap *heap, size_t size, gfp_t gfp_mask, int(*gt)(void *, void *))
 
void heap_free (struct ptr_heap *heap)
 
voidheap_insert (struct ptr_heap *heap, void *p)
 

Function Documentation

void heap_free ( struct ptr_heap heap)

heap_free - release a heap's storage : the heap structure whose data should be released

Definition at line 21 of file prio_heap.c.

int heap_init ( struct ptr_heap heap,
size_t  size,
gfp_t  gfp_mask,
int(*)(void *, void *)  gt 
)

heap_init - initialize an empty heap with a given memory size : the heap structure to be initialized : amount of memory to use in bytes : mask to pass to kmalloc() : comparison operator, which should implement "greater than"

Definition at line 9 of file prio_heap.c.

void* heap_insert ( struct ptr_heap heap,
void p 
)

heap_insert - insert a value into the heap and return any overflowed value : the heap to be operated on : the pointer to be inserted

Attempts to insert the given value into the priority heap. If the heap is full prior to the insertion, then the resulting heap will consist of the smallest elements of the original heap and the new element; the greatest element will be removed from the heap and returned. Note that the returned element will be the new element (i.e. no change to the heap) if the new element is greater than all elements currently in the heap.

Definition at line 26 of file prio_heap.c.