OpenMPI  0.1.1
rcache_rb_tree.c File Reference

Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana University Research and Technology Corporation. More...

#include "ompi_config.h"
#include "opal/mca/mca.h"
#include "rcache_rb_tree.h"

Functions

 OBJ_CLASS_INSTANCE (mca_rcache_rb_tree_item_t, ompi_free_list_item_t, NULL, NULL)
 
int mca_rcache_rb_tree_node_compare (void *key1, void *key2)
 Memory Pool Registration. More...
 
int mca_rcache_rb_tree_init (mca_rcache_rb_module_t *rcache)
 
struct mca_rcache_rb_tree_item_tmca_rcache_rb_tree_find (mca_rcache_rb_module_t *rcache, void *base)
 Searches the mpool to see if it has allocated the memory that is passed in. More...
 
int mca_rcache_rb_tree_insert (mca_rcache_rb_module_t *rb_module, mca_mpool_base_registration_t *reg)
 
int mca_rcache_rb_tree_delete (mca_rcache_rb_module_t *rb_module, mca_mpool_base_registration_t *reg)
 Function to remove previously memory from the tree without freeing it. More...
 

Detailed Description

Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana University Research and Technology Corporation.

All rights reserved. Copyright (c) 2004-2006 The University of Tennessee and The University of Tennessee Research Foundation. All rights reserved. Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, University of Stuttgart. All rights reserved. Copyright (c) 2004-2005 The Regents of the University of California. All rights reserved.5A $COPYRIGHT$

Additional copyrights may follow

$HEADER$

Description of the Registration Cache framework

Function Documentation

int mca_rcache_rb_tree_delete ( mca_rcache_rb_module_t rb_module,
mca_mpool_base_registration_t reg 
)

Function to remove previously memory from the tree without freeing it.

Parameters
basepointer to the memory to free
Return values
OMPI_SUCCESS
OMPI_ERR_BAD_PARAMif the passed base pointer was invalid

References mca_rcache_rb_tree_item_t::key, mca_rcache_rb_tree_find(), ompi_rb_tree_delete(), and mca_rcache_rb_tree_item_t::reg.

struct mca_rcache_rb_tree_item_t* mca_rcache_rb_tree_find ( mca_rcache_rb_module_t rcache,
void *  base 
)

Searches the mpool to see if it has allocated the memory that is passed in.

Returns the item in the rb tree.

If so it returns an array of mpools the memory is registered with.

Parameters
basepointer to the memory to lookup
Return values
NULLif the memory is not in any mpool
pointerto an array of type mca_mpool_base_reg_mpool_t

References mca_rcache_rb_tree_key_t::base, mca_rcache_rb_tree_key_t::bound, mca_rcache_rb_tree_item_t::key, ompi_rb_tree_find(), and mca_rcache_rb_tree_item_t::reg.

Referenced by mca_rcache_rb_tree_delete().

int mca_rcache_rb_tree_node_compare ( void *  key1,
void *  key2 
)

Memory Pool Registration.

Function for the red black tree to compare 2 keys

Parameters
key1a pointer to the 1st key
key2a pointer to the second key
Return values
-1if key1 is below key2
1if key 1 is above key2
0if the keys are the same