static void lru_print(struct cache *cache);
#endif
-/*
- * the cache has three entry points (ways to find things):
- *
- * by entry e.g., if you already have an entry from the cache
- * and want to delete it. (really by entry ptr)
- * by dn e.g., when looking for the base object of a search
- * by id e.g., for search candidates
- *
- * these correspond to three different avl trees that are maintained.
- */
-#define cache_entry_cmp entry_cmp
-#define cache_entrydn_cmp entry_dn_cmp
-#define cache_entryid_cmp entry_id_cmp
-
void
bdb2i_cache_set_state( struct cache *cache, Entry *e, int state )
{
ldap_pvt_thread_mutex_lock( &cache->c_mutex );
if ( avl_insert( &cache->c_dntree, (caddr_t) e,
- cache_entrydn_cmp, avl_dup_error ) != 0 )
+ entry_dn_cmp, avl_dup_error ) != 0 )
{
Debug( LDAP_DEBUG_TRACE,
"====> cache_add_entry lock: entry %20s id %lu already in dn cache\n",
/* id tree */
if ( avl_insert( &cache->c_idtree, (caddr_t) e,
- cache_entryid_cmp, avl_dup_error ) != 0 )
+ entry_id_cmp, avl_dup_error ) != 0 )
{
Debug( LDAP_DEBUG_ANY,
"====> entry %20s id %lu already in id cache\n",
/* delete from dn tree inserted above */
if ( avl_delete( &cache->c_dntree, (caddr_t) e,
- cache_entrydn_cmp ) == NULL )
+ entry_dn_cmp ) == NULL )
{
Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n",
0, 0, 0 );
e.e_ndn = dn_normalize_case( ch_strdup( dn ) );
if ( (ep = (Entry *) avl_find( cache->c_dntree, (caddr_t) &e,
- cache_entrydn_cmp )) != NULL )
+ entry_dn_cmp )) != NULL )
{
/*
* ep now points to an unlocked entry
ldap_pvt_thread_mutex_lock( &cache->c_mutex );
if ( (ep = (Entry *) avl_find( cache->c_idtree, (caddr_t) &e,
- cache_entryid_cmp )) != NULL )
+ entry_id_cmp )) != NULL )
{
Debug(LDAP_DEBUG_TRACE,
"====> cache_find_entry_dn2id: found id: %ld rw: %d\n",
int rc = 0; /* return code */
/* dn tree */
- if ( avl_delete( &cache->c_dntree, (caddr_t) e, cache_entrydn_cmp )
+ if ( avl_delete( &cache->c_dntree, (caddr_t) e, entry_dn_cmp )
== NULL )
{
rc = -1;
}
/* id tree */
- if ( avl_delete( &cache->c_idtree, (caddr_t) e, cache_entryid_cmp )
+ if ( avl_delete( &cache->c_idtree, (caddr_t) e, entry_id_cmp )
== NULL )
{
rc = -1;
static void lru_print(struct cache *cache);
#endif
-/*
- * the cache has three entry points (ways to find things):
- *
- * by entry e.g., if you already have an entry from the cache
- * and want to delete it. (really by entry ptr)
- * by dn e.g., when looking for the base object of a search
- * by id e.g., for search candidates
- *
- * these correspond to three different avl trees that are maintained.
- */
-#define cache_entry_cmp entry_cmp
-#define cache_entrydn_cmp entry_dn_cmp
-#define cache_entryid_cmp entry_id_cmp
-
static int
cache_entry_rdwr_lock(Entry *e, int rw)
{
}
if ( avl_insert( &cache->c_dntree, (caddr_t) e,
- cache_entrydn_cmp, avl_dup_error ) != 0 )
+ entry_dn_cmp, avl_dup_error ) != 0 )
{
Debug( LDAP_DEBUG_TRACE,
"====> cache_add_entry( %lu ): \"%s\": already in dn cache\n",
/* id tree */
if ( avl_insert( &cache->c_idtree, (caddr_t) e,
- cache_entryid_cmp, avl_dup_error ) != 0 )
+ entry_id_cmp, avl_dup_error ) != 0 )
{
Debug( LDAP_DEBUG_ANY,
"====> cache_add_entry( %lu ): \"%s\": already in id cache\n",
/* delete from dn tree inserted above */
if ( avl_delete( &cache->c_dntree, (caddr_t) e,
- cache_entrydn_cmp ) == NULL )
+ entry_dn_cmp ) == NULL )
{
Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n",
0, 0, 0 );
#endif
if ( avl_insert( &cache->c_dntree, (caddr_t) e,
- cache_entrydn_cmp, avl_dup_error ) != 0 )
+ entry_dn_cmp, avl_dup_error ) != 0 )
{
Debug( LDAP_DEBUG_TRACE,
"====> cache_update_entry( %lu ): \"%s\": already in dn cache\n",
/* id tree */
if ( avl_insert( &cache->c_idtree, (caddr_t) e,
- cache_entryid_cmp, avl_dup_error ) != 0 )
+ entry_id_cmp, avl_dup_error ) != 0 )
{
Debug( LDAP_DEBUG_ANY,
"====> cache_update_entry( %lu ): \"%s\": already in id cache\n",
/* delete from dn tree inserted above */
if ( avl_delete( &cache->c_dntree, (caddr_t) e,
- cache_entrydn_cmp ) == NULL )
+ entry_dn_cmp ) == NULL )
{
Debug( LDAP_DEBUG_ANY, "====> can't delete from dn cache\n",
0, 0, 0 );
e.e_ndn = dn_normalize_case( ch_strdup( dn ) );
if ( (ep = (Entry *) avl_find( cache->c_dntree, (caddr_t) &e,
- cache_entrydn_cmp )) != NULL )
+ entry_dn_cmp )) != NULL )
{
/*
* ep now points to an unlocked entry
ldap_pvt_thread_mutex_lock( &cache->c_mutex );
if ( (ep = (Entry *) avl_find( cache->c_idtree, (caddr_t) &e,
- cache_entryid_cmp )) != NULL )
+ entry_id_cmp )) != NULL )
{
#ifdef LDAP_DEBUG
assert( ep->e_private );
int rc = 0; /* return code */
/* dn tree */
- if ( avl_delete( &cache->c_dntree, (caddr_t) e, cache_entrydn_cmp )
+ if ( avl_delete( &cache->c_dntree, (caddr_t) e, entry_dn_cmp )
== NULL )
{
rc = -1;
}
/* id tree */
- if ( avl_delete( &cache->c_idtree, (caddr_t) e, cache_entryid_cmp )
+ if ( avl_delete( &cache->c_idtree, (caddr_t) e, entry_id_cmp )
== NULL )
{
rc = -1;