Quick and dirty BDB 4.6.18 support. Expect this to change again soon.

This commit is contained in:
Howard Chu 2007-07-24 14:02:37 +00:00
parent 767293dd3a
commit b514b25795
5 changed files with 21 additions and 5 deletions

View file

@ -275,6 +275,21 @@ struct bdb_op_info {
#endif #endif
/* 4.6.18 redefines cursor->locker */
#if DB_VERSION_FULL >= 0x04060012
struct __db_locker {
u_int32_t id;
};
#define CURSOR_SETLOCKER(cursor, id) \
__lock_getlocker(cursor->dbp->dbenv->lk_handle, id, 0, &cursor->locker)
#define CURSOR_GETLOCKER(cursor) cursor->locker->id
#else
#define CURSOR_SETLOCKER(cursor, id) cursor->locker = id
#define CURSOR_GETLOCKER(cursor) cursor->locker
#endif
#ifndef DB_BUFFER_SMALL #ifndef DB_BUFFER_SMALL
#define DB_BUFFER_SMALL ENOMEM #define DB_BUFFER_SMALL ENOMEM
#endif #endif

View file

@ -738,7 +738,7 @@ hdb_dn2id_parent(
rc = db->cursor( db, txn, &cursor, bdb->bi_db_opflags ); rc = db->cursor( db, txn, &cursor, bdb->bi_db_opflags );
if ( rc ) return rc; if ( rc ) return rc;
if ( !txn && locker ) { if ( !txn && locker ) {
cursor->locker = locker; CURSOR_SETLOCKER(cursor, locker);
} }
data.ulen = sizeof(diskNode) + (SLAP_LDAPDN_MAXLEN * 2); data.ulen = sizeof(diskNode) + (SLAP_LDAPDN_MAXLEN * 2);

View file

@ -121,8 +121,9 @@ int bdb_id2entry(
if ( rc ) return rc; if ( rc ) return rc;
/* Use our own locker if needed */ /* Use our own locker if needed */
if ( !tid && locker ) if ( !tid && locker ) {
cursor->locker = locker; CURSOR_SETLOCKER( cursor, locker );
}
/* Get the nattrs / nvals counts first */ /* Get the nattrs / nvals counts first */
data.ulen = data.dlen = sizeof(buf); data.ulen = data.dlen = sizeof(buf);

View file

@ -559,7 +559,7 @@ bdb_idl_fetch_key(
"cursor failed: %s (%d)\n", db_strerror(rc), rc, 0 ); "cursor failed: %s (%d)\n", db_strerror(rc), rc, 0 );
return rc; return rc;
} }
cursor->locker = locker; CURSOR_SETLOCKER( cursor, locker );
} else { } else {
cursor = *saved_cursor; cursor = *saved_cursor;
} }

View file

@ -319,7 +319,7 @@ Entry* bdb_tool_entry_get( BackendDB *be, ID id )
op.o_tmpmemctx = NULL; op.o_tmpmemctx = NULL;
op.o_tmpmfuncs = &ch_mfuncs; op.o_tmpmfuncs = &ch_mfuncs;
rc = bdb_cache_find_parent( &op, NULL, cursor->locker, id, &ei ); rc = bdb_cache_find_parent( &op, NULL, CURSOR_GETLOCKER(cursor), id, &ei );
if ( rc == LDAP_SUCCESS ) { if ( rc == LDAP_SUCCESS ) {
bdb_cache_entryinfo_unlock( ei ); bdb_cache_entryinfo_unlock( ei );
e->e_private = ei; e->e_private = ei;