From: Kurt Spanier Date: Thu, 1 Apr 1999 09:58:36 +0000 (+0000) Subject: Some minor clean-up; checking bdb2 for sync with ldbm. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~295 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1c7ebc514fe59448462aee86f71999ac6b6ff9ee;p=openldap Some minor clean-up; checking bdb2 for sync with ldbm. --- diff --git a/servers/slapd/back-bdb2/back-bdb2.h b/servers/slapd/back-bdb2/back-bdb2.h index a8785037d2..4a8879d4ec 100644 --- a/servers/slapd/back-bdb2/back-bdb2.h +++ b/servers/slapd/back-bdb2/back-bdb2.h @@ -82,8 +82,8 @@ struct cache { ldap_pvt_thread_mutex_t c_mutex; }; -#define CACHE_READ_LOCK 1 -#define CACHE_WRITE_LOCK 2 +#define CACHE_READ_LOCK 0 +#define CACHE_WRITE_LOCK 1 /* for the cache of open index files (re-used for txn) */ struct dbcache { diff --git a/servers/slapd/back-bdb2/cache.c b/servers/slapd/back-bdb2/cache.c index 0e89067cce..a22085c17b 100644 --- a/servers/slapd/back-bdb2/cache.c +++ b/servers/slapd/back-bdb2/cache.c @@ -359,7 +359,6 @@ bdb2i_cache_find_entry_dn2id( char *dn ) { - struct ldbminfo *li = (struct ldbminfo *) be->be_private; Entry e, *ep; ID id; diff --git a/servers/slapd/back-bdb2/delete.c b/servers/slapd/back-bdb2/delete.c index f0344009fd..1e094893d5 100644 --- a/servers/slapd/back-bdb2/delete.c +++ b/servers/slapd/back-bdb2/delete.c @@ -61,7 +61,7 @@ bdb2i_back_delete_internal( #endif /* delete from parent's id2children entry */ - if( (pdn = dn_parent( be, dn )) != NULL ) { + if( (pdn = dn_parent( be, e->e_ndn )) != NULL ) { if( (p = bdb2i_dn2entry_w( be, pdn, &matched )) == NULL) { Debug( LDAP_DEBUG_TRACE, "<=- bdb2i_back_delete: parent does not exist\n", 0, 0, 0); @@ -103,7 +103,7 @@ bdb2i_back_delete_internal( } /* delete from dn2id mapping */ - if ( bdb2i_dn2id_delete( be, e->e_dn ) != 0 ) { + if ( bdb2i_dn2id_delete( be, e->e_ndn ) != 0 ) { Debug(LDAP_DEBUG_ARGS, "<=- bdb2i_back_delete: operations error %s\n", dn, 0, 0); diff --git a/servers/slapd/back-bdb2/dn2id.c b/servers/slapd/back-bdb2/dn2id.c index 9de7630eb2..470eb6a142 100644 --- a/servers/slapd/back-bdb2/dn2id.c +++ b/servers/slapd/back-bdb2/dn2id.c @@ -116,7 +116,6 @@ bdb2i_dn2id_delete( char *dn ) { - struct ldbminfo *li = (struct ldbminfo *) be->be_private; struct dbcache *db; Datum key; int rc; diff --git a/servers/slapd/back-bdb2/idl.c b/servers/slapd/back-bdb2/idl.c index b8fe82a9e1..18d05cca69 100644 --- a/servers/slapd/back-bdb2/idl.c +++ b/servers/slapd/back-bdb2/idl.c @@ -15,7 +15,7 @@ static ID_BLOCK* idl_dup( ID_BLOCK *idl ); /* Allocate an ID_BLOCK with room for nids ids */ ID_BLOCK * -bdb2i_idl_alloc( unsigned long nids ) +bdb2i_idl_alloc( unsigned int nids ) { ID_BLOCK *new; @@ -615,9 +615,9 @@ bdb2i_idl_insert_key( * 3 id not inserted, block must be split */ int -bdb2i_idl_insert( ID_BLOCK **idl, ID id, unsigned long maxids ) +bdb2i_idl_insert( ID_BLOCK **idl, ID id, unsigned int maxids ) { - unsigned long i, j; + unsigned int i, j; if ( ID_BLOCK_ALLIDS( *idl ) ) { return( 2 ); /* already there */ diff --git a/servers/slapd/back-bdb2/porter.c b/servers/slapd/back-bdb2/porter.c index ce1518f239..39d3809d36 100644 --- a/servers/slapd/back-bdb2/porter.c +++ b/servers/slapd/back-bdb2/porter.c @@ -3,7 +3,7 @@ #include "portable.h" #include -#include +#include #include @@ -91,7 +91,6 @@ bdb2i_leave_backend_rw( DB_LOCK lock, int writer ) we must have several return codes that are or'ed at the end */ int ret_transaction = 0; int ret_lock = 0; - int ret_chkp = 0; /* if we are a writer, finish the transaction */ if ( writer ) { diff --git a/servers/slapd/back-bdb2/proto-back-bdb2.h b/servers/slapd/back-bdb2/proto-back-bdb2.h index 68756cf1a0..78e853c7d3 100644 --- a/servers/slapd/back-bdb2/proto-back-bdb2.h +++ b/servers/slapd/back-bdb2/proto-back-bdb2.h @@ -103,12 +103,12 @@ Entry * bdb2i_id2entry_rw LDAP_P(( BackendDB *be, ID id, int rw )); * idl.c */ -ID_BLOCK * bdb2i_idl_alloc LDAP_P(( unsigned long nids )); +ID_BLOCK * bdb2i_idl_alloc LDAP_P(( unsigned int nids )); ID_BLOCK * bdb2i_idl_allids LDAP_P(( BackendDB *be )); void bdb2i_idl_free LDAP_P(( ID_BLOCK *idl )); ID_BLOCK * bdb2i_idl_fetch LDAP_P(( BackendDB *be, struct dbcache *db, Datum key )); int bdb2i_idl_insert_key LDAP_P(( BackendDB *be, struct dbcache *db, Datum key, ID id )); -int bdb2i_idl_insert LDAP_P(( ID_BLOCK **idl, ID id, unsigned long maxids )); +int bdb2i_idl_insert LDAP_P(( ID_BLOCK **idl, ID id, unsigned int maxids )); int bdb2i_idl_delete_key LDAP_P(( BackendDB *be, struct dbcache *db, Datum key, ID id )); ID_BLOCK * bdb2i_idl_intersection LDAP_P(( BackendDB *be, ID_BLOCK *a, ID_BLOCK *b )); ID_BLOCK * bdb2i_idl_union LDAP_P(( BackendDB *be, ID_BLOCK *a, ID_BLOCK *b )); diff --git a/servers/slapd/back-ldbm/index.c b/servers/slapd/back-ldbm/index.c index e634e912b4..b16ddddd0e 100644 --- a/servers/slapd/back-ldbm/index.c +++ b/servers/slapd/back-ldbm/index.c @@ -167,6 +167,7 @@ add_value( { int rc; Datum key; + /* XXX do we need idl ??? */ ID_BLOCK *idl = NULL; char *tmpval = NULL; char *realval = val;