#include <linux/kernel.h>
#include <linux/mempool.h>
#include <linux/btree-128.h>
#include <linux/btree-type.h>
Go to the source code of this file.
|
void * | btree_alloc (gfp_t gfp_mask, void *pool_data) |
|
void | btree_free (void *element, void *pool_data) |
|
void | btree_init_mempool (struct btree_head *head, mempool_t *mempool) |
|
int __must_check | btree_init (struct btree_head *head) |
|
void | btree_destroy (struct btree_head *head) |
|
void * | btree_lookup (struct btree_head *head, struct btree_geo *geo, unsigned long *key) |
|
int __must_check | btree_insert (struct btree_head *head, struct btree_geo *geo, unsigned long *key, void *val, gfp_t gfp) |
|
int | btree_update (struct btree_head *head, struct btree_geo *geo, unsigned long *key, void *val) |
|
void * | btree_remove (struct btree_head *head, struct btree_geo *geo, unsigned long *key) |
|
int | btree_merge (struct btree_head *target, struct btree_head *victim, struct btree_geo *geo, gfp_t gfp) |
|
void * | btree_last (struct btree_head *head, struct btree_geo *geo, unsigned long *key) |
|
void * | btree_get_prev (struct btree_head *head, struct btree_geo *geo, unsigned long *key) |
|
size_t | btree_visitor (struct btree_head *head, struct btree_geo *geo, unsigned long opaque, void(*func)(void *elem, unsigned long opaque, unsigned long *key, size_t index, void *func2), void *func2) |
|
size_t | btree_grim_visitor (struct btree_head *head, struct btree_geo *geo, unsigned long opaque, void(*func)(void *elem, unsigned long opaque, unsigned long *key, size_t index, void *func2), void *func2) |
|
Value:
val; \
val = btree_get_prev32(
head, &
key))
Definition at line 226 of file btree.h.
Value:
val; \
val = btree_get_prev64(
head, &
key))
Definition at line 238 of file btree.h.
#define BTREE_KEYTYPE unsigned long |
#define BTREE_KEYTYPE u32 |
#define BTREE_KEYTYPE u64 |
#define BTREE_TYPE_BITS 32 |
#define BTREE_TYPE_BITS 64 |
#define BTREE_TYPE_SUFFIX l |
#define BTREE_TYPE_SUFFIX 32 |
#define BTREE_TYPE_SUFFIX 64 |
btree_alloc - allocate function for the mempool : gfp mask for the allocation : unused
Definition at line 81 of file btree.c.
btree_free - free function for the mempool : the element to free : unused
Definition at line 87 of file btree.c.
btree_get_prev - get previous entry
: btree head : btree geometry : pointer to key
The function returns the next item right before the value pointed to by , and updates with its key, or returns NULL when there is no entry with a key smaller than the given key.
Definition at line 310 of file btree.c.
btree_init - initialise a btree
: the btree head to initialise
This function allocates the memory pool that the btree needs. Returns zero or a negative error code (-ENOMEM) when memory allocation fails.
Definition at line 189 of file btree.c.
btree_init_mempool - initialise a btree with given mempool
: the btree head to initialise : the mempool to use
When this function is used, there is no need to destroy the mempool.
Definition at line 182 of file btree.c.
btree_insert - insert an entry into the btree
: the btree to add to : the btree geometry : the key to add (must not already be present) : the value to add (must not be NULL) : allocation flags for node allocations
This function returns 0 if the item could be added, or an error code if it failed (may fail due to memory pressure).
Definition at line 509 of file btree.c.
btree_last - get last entry in btree
: btree head : btree geometry : last key
Returns the last entry in the btree, and sets to the key of that entry; returns NULL if the tree is empty, in that case key is not changed.
Definition at line 206 of file btree.c.
btree_lookup - look up a key in the btree
: the btree to look in : the btree geometry : the key to look up
This function returns the value for the given key, or NULL.
Definition at line 240 of file btree.c.
btree_merge - merge two btrees
: the tree that gets all the entries : the tree that gets merged into : the btree geometry : allocation flags
The two trees and may not contain the same keys, that is a bug and triggers a BUG(). This function returns zero if the trees were merged successfully, and may return a failure when memory allocation fails, in which case both trees might have been partially merged, i.e. some entries have been moved from to .
Definition at line 638 of file btree.c.
btree_remove - remove an entry from the btree
: the btree to update : the btree geometry : the key to remove
This function returns the removed entry, or NULL if the key could not be found.
Definition at line 628 of file btree.c.
btree_update - update an entry in the btree
: the btree to update : the btree geometry : the key to update : the value to change it to (must not be NULL)
This function returns 0 if the update was successful, or -ENOENT if the key could not be found.
Definition at line 270 of file btree.c.