mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-12 15:23:11 -05:00
Function renaming, make internal funcs static, etc.
This commit is contained in:
parent
bdb3adca39
commit
6f461690c1
15 changed files with 219 additions and 120 deletions
|
|
@ -214,18 +214,10 @@ struct bdb_op_info {
|
|||
(db)->open(db, txn, file, name, type, flags, mode)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define BDB_REUSE_LOCKERS
|
||||
|
||||
#ifdef BDB_REUSE_LOCKERS
|
||||
#define LOCK_ID_FREE(env, locker)
|
||||
#define LOCK_ID(env, locker) bdb_locker_id(op, env, locker)
|
||||
#else
|
||||
#define LOCK_ID_FREE(env, locker) XLOCK_ID_FREE(env, locker)
|
||||
#define LOCK_ID(env, locker) XLOCK_ID(env, locker)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
#include "proto-bdb.h"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "back-bdb.h"
|
||||
|
||||
static int bdb_cache_delete_entry_internal(Cache *cache, EntryInfo *e);
|
||||
static int bdb_cache_delete_internal(Cache *cache, EntryInfo *e);
|
||||
#ifdef LDAP_DEBUG
|
||||
static void bdb_lru_print(Cache *cache);
|
||||
#endif
|
||||
|
|
@ -34,7 +34,7 @@ bdb_cache_entryinfo_new( )
|
|||
}
|
||||
|
||||
/* Atomically release and reacquire a lock */
|
||||
int
|
||||
static int
|
||||
bdb_cache_entry_db_relock(
|
||||
DB_ENV *env,
|
||||
u_int32_t locker,
|
||||
|
|
@ -80,7 +80,7 @@ bdb_cache_entry_db_relock(
|
|||
return rc;
|
||||
#endif
|
||||
}
|
||||
int
|
||||
static int
|
||||
bdb_cache_entry_db_lock
|
||||
( DB_ENV *env, u_int32_t locker, EntryInfo *ei, int rw, int tryOnly, DB_LOCK *lock )
|
||||
{
|
||||
|
|
@ -188,7 +188,7 @@ bdb_id_cmp( const void *v_e1, const void *v_e2 )
|
|||
|
||||
/* Create an entryinfo in the cache. Caller must release the locks later.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
bdb_entryinfo_add_internal(
|
||||
struct bdb_info *bdb,
|
||||
EntryInfo *ei,
|
||||
|
|
@ -244,7 +244,7 @@ bdb_entryinfo_add_internal(
|
|||
bdb_cache_entry_db_unlock( env, &lock );
|
||||
continue;
|
||||
}
|
||||
bdb_cache_delete_entry_internal( cache, elru );
|
||||
bdb_cache_delete_internal( cache, elru );
|
||||
bdb_cache_entryinfo_unlock( elru->bei_parent );
|
||||
elru->bei_e->e_private = NULL;
|
||||
bdb_entry_return( elru->bei_e );
|
||||
|
|
@ -311,7 +311,7 @@ bdb_entryinfo_add_internal(
|
|||
* The EntryInfo is locked upon return and must be unlocked by the caller.
|
||||
*/
|
||||
int
|
||||
bdb_cache_find_entry_ndn2id(
|
||||
bdb_cache_find_ndn(
|
||||
Backend *be,
|
||||
DB_TXN *txn,
|
||||
struct berval *ndn,
|
||||
|
|
@ -401,7 +401,7 @@ bdb_cache_find_entry_ndn2id(
|
|||
/* Walk up the tree from a child node, looking for an ID that's already
|
||||
* been linked into the cache.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
bdb_cache_find_parent(
|
||||
Backend *be,
|
||||
DB_TXN *txn,
|
||||
|
|
@ -430,9 +430,7 @@ bdb_cache_find_parent(
|
|||
ein->bei_id = ei.bei_id;
|
||||
ein->bei_kids = ei.bei_kids;
|
||||
ein->bei_nrdn = ei.bei_nrdn;
|
||||
#ifdef BDB_HIER
|
||||
ein->bei_rdn = ei.bei_rdn;
|
||||
#endif
|
||||
|
||||
/* This node is not fully connected yet */
|
||||
ein->bei_state = CACHE_ENTRY_NOT_LINKED;
|
||||
|
|
@ -493,13 +491,13 @@ bdb_cache_find_parent(
|
|||
#endif
|
||||
|
||||
/*
|
||||
* cache_find_entry_id - find an entry in the cache, given id.
|
||||
* cache_find_id - find an entry in the cache, given id.
|
||||
* The entry is locked for Read upon return. Call with islocked TRUE if
|
||||
* the supplied *eip was already locked.
|
||||
*/
|
||||
|
||||
int
|
||||
bdb_cache_find_entry_id(
|
||||
bdb_cache_find_id(
|
||||
Backend *be,
|
||||
DB_TXN *tid,
|
||||
ID id,
|
||||
|
|
@ -534,7 +532,7 @@ bdb_cache_find_entry_id(
|
|||
#ifndef BDB_HIER
|
||||
rc = bdb_id2entry( be, tid, id, &ep );
|
||||
if ( rc == 0 ) {
|
||||
rc = bdb_cache_find_entry_ndn2id( be, tid,
|
||||
rc = bdb_cache_find_ndn( be, tid,
|
||||
&ep->e_nname, eip, locker, ctx );
|
||||
if ( *eip )
|
||||
islocked = 1;
|
||||
|
|
@ -563,7 +561,7 @@ bdb_cache_find_entry_id(
|
|||
*eip, 1, 0, lock );
|
||||
ep->e_private = *eip;
|
||||
#ifdef BDB_HIER
|
||||
hdb_fix_dn( ep );
|
||||
bdb_fix_dn( ep );
|
||||
#endif
|
||||
(*eip)->bei_e = ep;
|
||||
bdb_cache_entry_db_relock( bdb->bi_dbenv, locker,
|
||||
|
|
@ -738,14 +736,14 @@ bdb_cache_modrdn(
|
|||
return rc;
|
||||
}
|
||||
/*
|
||||
* cache_delete_entry - delete the entry e from the cache.
|
||||
* cache_delete - delete the entry e from the cache.
|
||||
*
|
||||
* returns: 0 e was deleted ok
|
||||
* 1 e was not in the cache
|
||||
* -1 something bad happened
|
||||
*/
|
||||
int
|
||||
bdb_cache_delete_entry(
|
||||
bdb_cache_delete(
|
||||
Cache *cache,
|
||||
Entry *e,
|
||||
DB_ENV *env,
|
||||
|
|
@ -772,15 +770,15 @@ bdb_cache_delete_entry(
|
|||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( CACHE, ENTRY,
|
||||
"bdb_cache_delete_entry: delete %ld.\n", e->e_id, 0, 0 );
|
||||
"bdb_cache_delete: delete %ld.\n", e->e_id, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "====> bdb_cache_delete_entry( %ld )\n",
|
||||
Debug( LDAP_DEBUG_TRACE, "====> bdb_cache_delete( %ld )\n",
|
||||
e->e_id, 0, 0 );
|
||||
#endif
|
||||
|
||||
/* set lru mutex */
|
||||
ldap_pvt_thread_mutex_lock( &cache->lru_mutex );
|
||||
rc = bdb_cache_delete_entry_internal( cache, e->e_private );
|
||||
rc = bdb_cache_delete_internal( cache, e->e_private );
|
||||
/* free lru mutex */
|
||||
ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
|
||||
|
||||
|
|
@ -793,7 +791,7 @@ bdb_cache_delete_entry(
|
|||
}
|
||||
|
||||
static int
|
||||
bdb_cache_delete_entry_internal(
|
||||
bdb_cache_delete_internal(
|
||||
Cache *cache,
|
||||
EntryInfo *e
|
||||
)
|
||||
|
|
@ -893,7 +891,7 @@ bdb_lru_print( Cache *cache )
|
|||
#endif
|
||||
|
||||
#ifdef BDB_REUSE_LOCKERS
|
||||
void
|
||||
static void
|
||||
bdb_locker_id_free( void *key, void *data )
|
||||
{
|
||||
DB_ENV *env = key;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <ac/string.h>
|
||||
|
||||
#include "back-bdb.h"
|
||||
#include "external.h"
|
||||
|
||||
#ifdef DB_DIRTY_READ
|
||||
# define SLAP_BDB_ALLOW_DIRTY_READ
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ retry: /* transaction retry */
|
|||
if ( rs->sr_err == 0 ) {
|
||||
e = ei->bei_e;
|
||||
eip = ei->bei_parent;
|
||||
bdb_cache_find_entry_id( op->o_bd, ltid, eip->bei_id, &eip,
|
||||
bdb_cache_find_id( op->o_bd, ltid, eip->bei_id, &eip,
|
||||
0, locker, &plock, op->o_tmpmemctx );
|
||||
}
|
||||
if ( eip ) {
|
||||
|
|
@ -442,7 +442,7 @@ retry: /* transaction retry */
|
|||
rs->sr_err = LDAP_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
bdb_cache_delete_entry( &bdb->bi_cache, e, bdb->bi_dbenv,
|
||||
bdb_cache_delete( &bdb->bi_cache, e, bdb->bi_dbenv,
|
||||
locker, &lock );
|
||||
rs->sr_err = TXN_COMMIT( ltid, 0 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ bdb_dn2entry(
|
|||
|
||||
*e = NULL;
|
||||
|
||||
rc = bdb_cache_find_entry_ndn2id( be, tid, dn, &ei, locker, ctx );
|
||||
rc = bdb_cache_find_ndn( be, tid, dn, &ei, locker, ctx );
|
||||
if ( rc ) {
|
||||
if ( matched && rc == DB_NOTFOUND ) {
|
||||
/* Set the return value, whether we have its entry
|
||||
|
|
@ -50,7 +50,7 @@ bdb_dn2entry(
|
|||
*/
|
||||
*e = ei;
|
||||
if ( ei && ei->bei_id )
|
||||
bdb_cache_find_entry_id( be, tid, ei->bei_id,
|
||||
bdb_cache_find_id( be, tid, ei->bei_id,
|
||||
&ei, 1, locker, lock, ctx );
|
||||
else if ( ei )
|
||||
bdb_cache_entryinfo_unlock( ei );
|
||||
|
|
@ -58,14 +58,14 @@ bdb_dn2entry(
|
|||
bdb_cache_entryinfo_unlock( ei );
|
||||
}
|
||||
} else {
|
||||
rc = bdb_cache_find_entry_id( be, tid, ei->bei_id, &ei, 1,
|
||||
rc = bdb_cache_find_id( be, tid, ei->bei_id, &ei, 1,
|
||||
locker, lock, ctx );
|
||||
if ( rc == 0 ) {
|
||||
*e = ei;
|
||||
} else if ( matched && rc == DB_NOTFOUND ) {
|
||||
/* always return EntryInfo */
|
||||
ei = ei->bei_parent;
|
||||
bdb_cache_find_entry_id( be, tid, ei->bei_id, &ei, 1,
|
||||
bdb_cache_find_id( be, tid, ei->bei_id, &ei, 1,
|
||||
locker, lock, ctx );
|
||||
*e = ei;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ typedef struct diskNode {
|
|||
* Sorts based on normalized RDN, in lexical order.
|
||||
*/
|
||||
int
|
||||
hdb_dup_compare(
|
||||
bdb_dup_compare(
|
||||
DB *db,
|
||||
const DBT *usrkey,
|
||||
const DBT *curkey
|
||||
|
|
@ -544,7 +544,7 @@ hdb_dup_compare(
|
|||
|
||||
/* This function constructs a full DN for a given entry.
|
||||
*/
|
||||
int hdb_fix_dn(
|
||||
int bdb_fix_dn(
|
||||
Entry *e
|
||||
)
|
||||
{
|
||||
|
|
@ -880,7 +880,7 @@ struct dn2id_cookie {
|
|||
void *ctx;
|
||||
};
|
||||
|
||||
int
|
||||
static int
|
||||
bdb_dn2idl_internal(
|
||||
struct dn2id_cookie *cx
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,34 @@
|
|||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
#ifndef BDB_SYMBOL
|
||||
#ifdef BDB_HIER
|
||||
#define BDB_SYMBOL(x) LDAP_CONCAT(hdb_,x)
|
||||
#else
|
||||
#define BDB_SYMBOL(x) LDAP_CONCAT(bdb_,x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define bdb_initialize BDB_SYMBOL(initialize)
|
||||
#define bdb_db_config BDB_SYMBOL(db_config)
|
||||
#define bdb_add BDB_SYMBOL(add)
|
||||
#define bdb_bind BDB_SYMBOL(bind)
|
||||
#define bdb_compare BDB_SYMBOL(compare)
|
||||
#define bdb_delete BDB_SYMBOL(delete)
|
||||
#define bdb_modify BDB_SYMBOL(modify)
|
||||
#define bdb_modrdn BDB_SYMBOL(modrdn)
|
||||
#define bdb_search BDB_SYMBOL(search)
|
||||
#define bdb_extended BDB_SYMBOL(extended)
|
||||
#define bdb_referrals BDB_SYMBOL(referrals)
|
||||
#define bdb_operational BDB_SYMBOL(operational)
|
||||
#define bdb_hasSubordinates BDB_SYMBOL(hasSubordinates)
|
||||
#define bdb_tool_entry_open BDB_SYMBOL(tool_entry_open)
|
||||
#define bdb_tool_entry_close BDB_SYMBOL(tool_entry_close)
|
||||
#define bdb_tool_entry_next BDB_SYMBOL(tool_entry_next)
|
||||
#define bdb_tool_entry_get BDB_SYMBOL(tool_entry_get)
|
||||
#define bdb_tool_entry_put BDB_SYMBOL(tool_entry_put)
|
||||
#define bdb_tool_entry_reindex BDB_SYMBOL(tool_entry_reindex)
|
||||
|
||||
extern BI_init bdb_initialize;
|
||||
|
||||
extern BI_db_config bdb_db_config;
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@
|
|||
#include <ac/string.h>
|
||||
|
||||
#include "back-bdb.h"
|
||||
#include "external.h"
|
||||
|
||||
int bdb_id2entry_put(
|
||||
static int bdb_id2entry_put(
|
||||
BackendDB *be,
|
||||
DB_TXN *tid,
|
||||
Entry *e,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
} \
|
||||
} while ( 0 )
|
||||
|
||||
int
|
||||
static int
|
||||
bdb_idl_entry_cmp( const void *v_idl1, const void *v_idl2 )
|
||||
{
|
||||
const bdb_idl_cache_entry_t *idl1 = v_idl1, *idl2 = v_idl2;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "external.h"
|
||||
#include <lutil.h>
|
||||
|
||||
static struct bdbi_database {
|
||||
static const struct bdbi_database {
|
||||
char *file;
|
||||
char *name;
|
||||
int type;
|
||||
|
|
@ -371,7 +371,7 @@ bdb_db_open( BackendDB *be )
|
|||
bdb_bt_compare );
|
||||
#else
|
||||
rc = db->bdi_db->set_dup_compare( db->bdi_db,
|
||||
hdb_dup_compare );
|
||||
bdb_dup_compare );
|
||||
rc = db->bdi_db->set_bt_compare( db->bdi_db,
|
||||
bdb_bt_compare );
|
||||
#endif
|
||||
|
|
@ -462,11 +462,10 @@ bdb_db_close( BackendDB *be )
|
|||
#ifdef SLAP_IDL_CACHE
|
||||
if ( bdb->bi_idl_cache_max_size ) {
|
||||
ldap_pvt_thread_rdwr_wlock ( &bdb->bi_idl_tree_rwlock );
|
||||
avl_free( bdb->bi_idl_tree, NULL );
|
||||
entry = bdb->bi_idl_lru_head;
|
||||
while ( entry != NULL ) {
|
||||
next_entry = entry->idl_lru_next;
|
||||
avl_delete( &bdb->bi_idl_tree, (caddr_t) entry,
|
||||
bdb_idl_entry_cmp );
|
||||
if ( entry->idl )
|
||||
free( entry->idl );
|
||||
free( entry->kstr.bv_val );
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ retry: /* transaction retry */
|
|||
* children.
|
||||
*/
|
||||
eip = ei->bei_parent;
|
||||
rs->sr_err = bdb_cache_find_entry_id( op->o_bd, ltid,
|
||||
rs->sr_err = bdb_cache_find_id( op->o_bd, ltid,
|
||||
eip->bei_id, &eip, 0, locker, &plock, op->o_tmpmemctx );
|
||||
|
||||
switch( rs->sr_err ) {
|
||||
|
|
@ -669,7 +669,7 @@ retry: /* transaction retry */
|
|||
|
||||
/* Shortcut the search */
|
||||
nei = neip ? neip : eip;
|
||||
rs->sr_err = bdb_cache_find_entry_ndn2id ( op->o_bd, ltid, &new_ndn,
|
||||
rs->sr_err = bdb_cache_find_ndn ( op->o_bd, ltid, &new_ndn,
|
||||
&nei, locker, op->o_tmpmemctx );
|
||||
if ( nei ) bdb_cache_entryinfo_unlock( nei );
|
||||
switch( rs->sr_err ) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "slap.h"
|
||||
#include "back-bdb.h"
|
||||
#include "proto-bdb.h"
|
||||
#include "external.h"
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -9,26 +9,20 @@
|
|||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
/*
|
||||
* alias.c
|
||||
*/
|
||||
Entry *bdb_deref_internal_r LDAP_P((
|
||||
BackendDB *be,
|
||||
Entry *e,
|
||||
struct berval *dn,
|
||||
int *err,
|
||||
Entry **matched,
|
||||
const char **text ));
|
||||
|
||||
#define deref_entry_r( be, e, err, matched, text ) \
|
||||
bdb_deref_internal_r( be, e, NULL, err, matched, text )
|
||||
#define deref_dn_r( be, dn, err, matched, text ) \
|
||||
bdb_deref_internal_r( be, NULL, dn, err, matched, text)
|
||||
#ifdef BDB_HIER
|
||||
#define BDB_SYMBOL(x) LDAP_CONCAT(hdb_,x)
|
||||
#else
|
||||
#define BDB_SYMBOL(x) LDAP_CONCAT(bdb_,x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* attr.c
|
||||
*/
|
||||
|
||||
#define bdb_attr_mask BDB_SYMBOL(attr_mask)
|
||||
#define bdb_attr_index_config BDB_SYMBOL(attr_index_config)
|
||||
#define bdb_attr_index_destroy BDB_SYMBOL(attr_index_destroy)
|
||||
|
||||
void bdb_attr_mask( struct bdb_info *bdb,
|
||||
AttributeDescription *desc,
|
||||
slap_mask_t *indexmask );
|
||||
|
|
@ -42,6 +36,8 @@ void bdb_attr_index_destroy LDAP_P(( Avlnode *tree ));
|
|||
/*
|
||||
* dbcache.c
|
||||
*/
|
||||
#define bdb_db_cache BDB_SYMBOL(db_cache)
|
||||
|
||||
int
|
||||
bdb_db_cache(
|
||||
Backend *be,
|
||||
|
|
@ -52,6 +48,8 @@ bdb_db_cache(
|
|||
/*
|
||||
* dn2entry.c
|
||||
*/
|
||||
#define bdb_dn2entry BDB_SYMBOL(dn2entry)
|
||||
|
||||
int bdb_dn2entry LDAP_P(( BackendDB *be, DB_TXN *tid,
|
||||
struct berval *dn, EntryInfo **e, int matched,
|
||||
u_int32_t locker, DB_LOCK *lock, void *ctx));
|
||||
|
|
@ -59,6 +57,12 @@ int bdb_dn2entry LDAP_P(( BackendDB *be, DB_TXN *tid,
|
|||
/*
|
||||
* dn2id.c
|
||||
*/
|
||||
#define bdb_dn2id BDB_SYMBOL(dn2id)
|
||||
#define bdb_dn2id_add BDB_SYMBOL(dn2id_add)
|
||||
#define bdb_dn2id_delete BDB_SYMBOL(dn2id_delete)
|
||||
#define bdb_dn2id_children BDB_SYMBOL(dn2id_children)
|
||||
#define bdb_dn2idl BDB_SYMBOL(dn2idl)
|
||||
|
||||
int bdb_dn2id(
|
||||
BackendDB *be,
|
||||
DB_TXN *tid,
|
||||
|
|
@ -85,8 +89,7 @@ int bdb_dn2id_children(
|
|||
DB_TXN *tid,
|
||||
Entry *e );
|
||||
|
||||
int
|
||||
bdb_dn2idl(
|
||||
int bdb_dn2idl(
|
||||
BackendDB *be,
|
||||
struct berval *dn,
|
||||
int prefix,
|
||||
|
|
@ -95,29 +98,45 @@ bdb_dn2idl(
|
|||
void *ctx );
|
||||
|
||||
#ifdef BDB_HIER
|
||||
int hdb_dup_compare(
|
||||
#define bdb_dn2id_parent BDB_SYMBOL(dn2id_parent)
|
||||
#define bdb_dup_compare BDB_SYMBOL(dup_compare)
|
||||
#define bdb_fix_dn BDB_SYMBOL(fix_dn)
|
||||
|
||||
int bdb_dn2id_parent(
|
||||
Backend *be,
|
||||
DB_TXN *txn,
|
||||
EntryInfo *ei,
|
||||
ID *idp,
|
||||
void *ctx );
|
||||
|
||||
int bdb_dup_compare(
|
||||
DB *db,
|
||||
const DBT *usrkey,
|
||||
const DBT *curkey );
|
||||
|
||||
int hdb_fix_dn( Entry *e );
|
||||
int bdb_fix_dn( Entry *e );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* entry.c
|
||||
*/
|
||||
int bdb_entry_return( Entry *e );
|
||||
BI_entry_release_rw bdb_entry_release;
|
||||
BI_entry_get_rw bdb_entry_get;
|
||||
|
||||
/*
|
||||
* error.c
|
||||
*/
|
||||
#define bdb_errcall BDB_SYMBOL(errcall)
|
||||
|
||||
void bdb_errcall( const char *pfx, char * msg );
|
||||
|
||||
#ifdef HAVE_EBCDIC
|
||||
#define ebcdic_dberror BDB_SYMBOL(ebcdic_dberror)
|
||||
|
||||
char *ebcdic_dberror( int rc );
|
||||
#define db_strerror(x) ebcdic_dberror(x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* filterentry.c
|
||||
*/
|
||||
#define bdb_filter_candidates BDB_SYMBOL(filter_candidates)
|
||||
|
||||
int bdb_filter_candidates(
|
||||
Operation *op,
|
||||
Filter *f,
|
||||
|
|
@ -128,6 +147,11 @@ int bdb_filter_candidates(
|
|||
/*
|
||||
* id2entry.c
|
||||
*/
|
||||
#define bdb_id2entry BDB_SYMBOL(id2entry)
|
||||
#define bdb_id2entry_add BDB_SYMBOL(id2entry_add)
|
||||
#define bdb_id2entry_update BDB_SYMBOL(id2entry_update)
|
||||
#define bdb_id2entry_delete BDB_SYMBOL(id2entry_delete)
|
||||
|
||||
int bdb_id2entry_add(
|
||||
BackendDB *be,
|
||||
DB_TXN *tid,
|
||||
|
|
@ -149,13 +173,25 @@ int bdb_id2entry(
|
|||
ID id,
|
||||
Entry **e);
|
||||
|
||||
#define bdb_entry_free BDB_SYMBOL(entry_free)
|
||||
#define bdb_entry_return BDB_SYMBOL(entry_return)
|
||||
#define bdb_entry_release BDB_SYMBOL(entry_release)
|
||||
#define bdb_entry_get BDB_SYMBOL(entry_get)
|
||||
|
||||
void bdb_entry_free ( Entry *e );
|
||||
int bdb_entry_return( Entry *e );
|
||||
BI_entry_release_rw bdb_entry_release;
|
||||
BI_entry_get_rw bdb_entry_get;
|
||||
|
||||
|
||||
/*
|
||||
* idl.c
|
||||
*/
|
||||
#ifdef SLAP_IDL_CACHE
|
||||
int bdb_idl_entry_cmp( const void*, const void* );
|
||||
|
||||
#define bdb_idl_cache_get BDB_SYMBOL(idl_cache_get)
|
||||
#define bdb_idl_cache_put BDB_SYMBOL(idl_cache_put)
|
||||
#define bdb_idl_cache_del BDB_SYMBOL(idl_cache_del)
|
||||
|
||||
int bdb_idl_cache_get(
|
||||
struct bdb_info *bdb,
|
||||
|
|
@ -178,12 +214,18 @@ bdb_idl_cache_del(
|
|||
DBT *key );
|
||||
#endif
|
||||
|
||||
unsigned bdb_idl_search( ID *ids, ID id );
|
||||
#define bdb_idl_first BDB_SYMBOL(idl_first)
|
||||
#define bdb_idl_next BDB_SYMBOL(idl_next)
|
||||
#define bdb_idl_search BDB_SYMBOL(idl_search)
|
||||
#define bdb_idl_insert BDB_SYMBOL(idl_insert)
|
||||
#define bdb_idl_intersection BDB_SYMBOL(idl_intersection)
|
||||
#define bdb_idl_union BDB_SYMBOL(idl_union)
|
||||
|
||||
int bdb_bt_compare(
|
||||
DB *db,
|
||||
const DBT *a,
|
||||
const DBT *b );
|
||||
#define bdb_idl_fetch_key BDB_SYMBOL(idl_fetch_key)
|
||||
#define bdb_idl_insert_key BDB_SYMBOL(idl_insert_key)
|
||||
#define bdb_idl_delete_key BDB_SYMBOL(idl_delete_key)
|
||||
|
||||
unsigned bdb_idl_search( ID *ids, ID id );
|
||||
|
||||
int bdb_idl_fetch_key(
|
||||
BackendDB *be,
|
||||
|
|
@ -208,14 +250,6 @@ int bdb_idl_delete_key(
|
|||
DBT *key,
|
||||
ID id );
|
||||
|
||||
#if 0
|
||||
int
|
||||
bdb_idl_notin(
|
||||
ID *a,
|
||||
ID *b,
|
||||
ID *ids );
|
||||
#endif
|
||||
|
||||
int
|
||||
bdb_idl_intersection(
|
||||
ID *a,
|
||||
|
|
@ -230,9 +264,22 @@ ID bdb_idl_first( ID *ids, ID *cursor );
|
|||
ID bdb_idl_next( ID *ids, ID *cursor );
|
||||
|
||||
|
||||
#define bdb_bt_compare BDB_SYMBOL(bt_compare)
|
||||
|
||||
int bdb_bt_compare(
|
||||
DB *db,
|
||||
const DBT *a,
|
||||
const DBT *b );
|
||||
|
||||
|
||||
/*
|
||||
* index.c
|
||||
*/
|
||||
#define bdb_index_is_indexed BDB_SYMBOL(index_is_indexed)
|
||||
#define bdb_index_param BDB_SYMBOL(index_param)
|
||||
#define bdb_index_values BDB_SYMBOL(index_values)
|
||||
#define bdb_index_entry BDB_SYMBOL(index_entry)
|
||||
|
||||
extern int
|
||||
bdb_index_is_indexed LDAP_P((
|
||||
Backend *be,
|
||||
|
|
@ -266,11 +313,16 @@ int bdb_index_entry LDAP_P(( Operation *op, DB_TXN *t, int r, Entry *e ));
|
|||
/*
|
||||
* init.c
|
||||
*/
|
||||
#define bdb_uuid BDB_SYMBOL(uuid)
|
||||
|
||||
extern struct berval bdb_uuid;
|
||||
|
||||
/*
|
||||
* key.c
|
||||
*/
|
||||
#define bdb_key_read BDB_SYMBOL(key_read)
|
||||
#define bdb_key_change BDB_SYMBOL(key_change)
|
||||
|
||||
extern int
|
||||
bdb_key_read(
|
||||
Backend *be,
|
||||
|
|
@ -291,12 +343,17 @@ bdb_key_change(
|
|||
/*
|
||||
* nextid.c
|
||||
*/
|
||||
#define bdb_next_id BDB_SYMBOL(next_id)
|
||||
#define bdb_last_id BDB_SYMBOL(last_id)
|
||||
|
||||
int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
|
||||
int bdb_last_id( BackendDB *be, DB_TXN *tid );
|
||||
|
||||
/*
|
||||
* modify.c
|
||||
*/
|
||||
#define bdb_modify_internal BDB_SYMBOL(modify_internal)
|
||||
|
||||
int bdb_modify_internal(
|
||||
Operation *op,
|
||||
DB_TXN *tid,
|
||||
|
|
@ -309,18 +366,24 @@ int bdb_modify_internal(
|
|||
/*
|
||||
* passwd.c
|
||||
*/
|
||||
#define bdb_exop_passwd BDB_SYMBOL(exop_passwd)
|
||||
|
||||
BI_op_extended bdb_exop_passwd;
|
||||
|
||||
|
||||
/*
|
||||
* cache.c
|
||||
*/
|
||||
#define bdb_cache_entry_db_unlock BDB_SYMBOL(cache_entry_db_unlock)
|
||||
|
||||
#define bdb_cache_entryinfo_lock(e) \
|
||||
ldap_pvt_thread_mutex_lock( &(e)->bei_kids_mutex )
|
||||
#define bdb_cache_entryinfo_unlock(e) \
|
||||
ldap_pvt_thread_mutex_unlock( &(e)->bei_kids_mutex )
|
||||
|
||||
/* What a mess. Hopefully the current cache scheme will stabilize
|
||||
* and we can trim out all of this stuff.
|
||||
*/
|
||||
#if 0
|
||||
void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e,
|
||||
int rw, DB_LOCK *lock );
|
||||
|
|
@ -344,6 +407,15 @@ void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
|
|||
#define bdb_unlocked_cache_return_entry_w( c, e ) \
|
||||
bdb_unlocked_cache_return_entry_rw((c), (e), 1)
|
||||
|
||||
#define bdb_cache_add BDB_SYMBOL(cache_add)
|
||||
#define bdb_cache_children BDB_SYMBOL(cache_children)
|
||||
#define bdb_cache_delete BDB_SYMBOL(cache_delete)
|
||||
#define bdb_cache_find_id BDB_SYMBOL(cache_find_id)
|
||||
#define bdb_cache_find_ndn BDB_SYMBOL(cache_find_ndn)
|
||||
#define bdb_cache_modify BDB_SYMBOL(cache_modify)
|
||||
#define bdb_cache_modrdn BDB_SYMBOL(cache_modrdn)
|
||||
#define bdb_cache_release_all BDB_SYMBOL(cache_release_all)
|
||||
|
||||
int bdb_cache_children(
|
||||
Operation *op,
|
||||
DB_TXN *txn,
|
||||
|
|
@ -372,11 +444,7 @@ int bdb_cache_modify(
|
|||
u_int32_t locker,
|
||||
DB_LOCK *lock
|
||||
);
|
||||
int bdb_cache_update_entry(
|
||||
Cache *cache,
|
||||
Entry *e
|
||||
);
|
||||
int bdb_cache_find_entry_ndn2id(
|
||||
int bdb_cache_find_ndn(
|
||||
Backend *be,
|
||||
DB_TXN *txn,
|
||||
struct berval *ndn,
|
||||
|
|
@ -384,7 +452,7 @@ int bdb_cache_find_entry_ndn2id(
|
|||
u_int32_t locker,
|
||||
void *ctx
|
||||
);
|
||||
int bdb_cache_find_entry_id(
|
||||
int bdb_cache_find_id(
|
||||
Backend *be,
|
||||
DB_TXN *tid,
|
||||
ID id,
|
||||
|
|
@ -394,7 +462,7 @@ int bdb_cache_find_entry_id(
|
|||
DB_LOCK *lock,
|
||||
void *ctx
|
||||
);
|
||||
int bdb_cache_delete_entry(
|
||||
int bdb_cache_delete(
|
||||
Cache *cache,
|
||||
Entry *e,
|
||||
DB_ENV *env,
|
||||
|
|
@ -403,15 +471,34 @@ int bdb_cache_delete_entry(
|
|||
);
|
||||
void bdb_cache_release_all( Cache *cache );
|
||||
|
||||
#ifdef BDB_REUSE_LOCKERS
|
||||
|
||||
#define bdb_locker_id BDB_SYMBOL(locker_id)
|
||||
int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
|
||||
|
||||
#define LOCK_ID_FREE(env, locker)
|
||||
#define LOCK_ID(env, locker) bdb_locker_id(op, env, locker)
|
||||
|
||||
#else
|
||||
|
||||
#define LOCK_ID_FREE(env, locker) XLOCK_ID_FREE(env, locker)
|
||||
#define LOCK_ID(env, locker) XLOCK_ID(env, locker)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* lcup.c
|
||||
* search.c
|
||||
*/
|
||||
|
||||
BI_op_abandon bdb_abandon;
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
|
||||
#define bdb_abandon BDB_SYMBOL(abandon)
|
||||
#define bdb_cancel BDB_SYMBOL(cancel)
|
||||
#define bdb_do_search BDB_SYMBOL(do_search)
|
||||
|
||||
BI_op_abandon bdb_abandon;
|
||||
BI_op_cancel bdb_cancel;
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
int bdb_do_search(
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
|
|
@ -422,11 +509,11 @@ int bdb_do_search(
|
|||
#define bdb_psearch(op, rs, sop, e, ps_type) bdb_do_search(op, rs, sop, e, ps_type)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* search.c
|
||||
*/
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
#define bdb_build_lcup_update_ctrl BDB_SYMBOL(build_lcup_update_ctrl)
|
||||
#define bdb_build_lcup_done_ctrl BDB_SYMBOL(build_lcup_done_ctrl)
|
||||
|
||||
int
|
||||
bdb_build_lcup_update_ctrl(
|
||||
Operation *op,
|
||||
|
|
@ -448,6 +535,10 @@ bdb_build_lcup_done_ctrl(
|
|||
#endif
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
#define bdb_build_sync_state_ctrl BDB_SYMBOL(build_sync_state_ctrl)
|
||||
#define bdb_build_sync_done_ctrl BDB_SYMBOL(build_sync_done_ctrl)
|
||||
#define bdb_send_ldap_intermediate BDB_SYMBOL(send_ldap_intermediate)
|
||||
|
||||
int
|
||||
bdb_build_sync_state_ctrl(
|
||||
Operation *op,
|
||||
|
|
@ -476,17 +567,6 @@ bdb_send_ldap_intermediate(
|
|||
struct berval *cookie );
|
||||
#endif
|
||||
|
||||
#ifdef BDB_REUSE_LOCKERS
|
||||
|
||||
int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EBCDIC
|
||||
char *ebcdic_dberror( int rc );
|
||||
|
||||
#define db_strerror(x) ebcdic_dberror(x)
|
||||
#endif
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ static int search_aliases(
|
|||
ida = bdb_idl_next(curscop, &cursora))
|
||||
{
|
||||
ei = NULL;
|
||||
rs->sr_err = bdb_cache_find_entry_id(op->o_bd, NULL,
|
||||
rs->sr_err = bdb_cache_find_id(op->o_bd, NULL,
|
||||
ida, &ei, 0, locker, &lockr, op->o_tmpmemctx );
|
||||
if (rs->sr_err != LDAP_SUCCESS) {
|
||||
continue;
|
||||
|
|
@ -269,7 +269,7 @@ nextido:
|
|||
* Set the name so that the scope's IDL can be retrieved.
|
||||
*/
|
||||
ei = NULL;
|
||||
rs->sr_err = bdb_cache_find_entry_id(op->o_bd, NULL, ido, &ei,
|
||||
rs->sr_err = bdb_cache_find_id(op->o_bd, NULL, ido, &ei,
|
||||
0, locker, &locka, op->o_tmpmemctx );
|
||||
if (rs->sr_err != LDAP_SUCCESS) goto nextido;
|
||||
e = ei->bei_e;
|
||||
|
|
@ -866,7 +866,7 @@ loop_begin:
|
|||
id2entry_retry:
|
||||
/* get the entry with reader lock */
|
||||
ei = NULL;
|
||||
rs->sr_err = bdb_cache_find_entry_id( op->o_bd, NULL,
|
||||
rs->sr_err = bdb_cache_find_id( op->o_bd, NULL,
|
||||
id, &ei, 0, locker, &lock, op->o_tmpmemctx );
|
||||
|
||||
if (rs->sr_err == LDAP_BUSY) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <ac/string.h>
|
||||
|
||||
#include "back-bdb.h"
|
||||
#include "external.h"
|
||||
|
||||
static DBC *cursor = NULL;
|
||||
static DBT key, data;
|
||||
|
|
@ -21,9 +22,9 @@ typedef struct dn_id {
|
|||
} dn_id;
|
||||
|
||||
#define HOLE_SIZE 4096
|
||||
dn_id hbuf[HOLE_SIZE], *holes = hbuf;
|
||||
unsigned nhmax = HOLE_SIZE;
|
||||
unsigned nholes;
|
||||
static dn_id hbuf[HOLE_SIZE], *holes = hbuf;
|
||||
static unsigned nhmax = HOLE_SIZE;
|
||||
static unsigned nholes;
|
||||
|
||||
int bdb_tool_entry_open(
|
||||
BackendDB *be, int mode )
|
||||
|
|
@ -124,7 +125,7 @@ Entry* bdb_tool_entry_get( BackendDB *be, ID id )
|
|||
#else
|
||||
{
|
||||
EntryInfo *ei = NULL;
|
||||
rc = bdb_cache_find_entry_id( be, NULL, id, &ei, 0, 0,
|
||||
rc = bdb_cache_find_id( be, NULL, id, &ei, 0, 0,
|
||||
NULL, NULL );
|
||||
if ( rc == LDAP_SUCCESS )
|
||||
e = ei->bei_e;
|
||||
|
|
@ -133,7 +134,7 @@ Entry* bdb_tool_entry_get( BackendDB *be, ID id )
|
|||
return e;
|
||||
}
|
||||
|
||||
int bdb_tool_next_id(
|
||||
static int bdb_tool_next_id(
|
||||
BackendDB *be,
|
||||
DB_TXN *tid,
|
||||
Entry *e,
|
||||
|
|
@ -147,7 +148,7 @@ int bdb_tool_next_id(
|
|||
EntryInfo *ei = NULL;
|
||||
int rc;
|
||||
|
||||
rc = bdb_cache_find_entry_ndn2id( be, tid, &dn, &ei, locker, NULL );
|
||||
rc = bdb_cache_find_ndn( be, tid, &dn, &ei, locker, NULL );
|
||||
if ( ei ) bdb_cache_entryinfo_unlock( ei );
|
||||
if ( rc == DB_NOTFOUND ) {
|
||||
if ( be_issuffix( be, &dn ) ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue