From 3b9f4a82ee478c943a66696adf9133dc9f503e16 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 22 Aug 2002 04:00:06 +0000 Subject: [PATCH] Added support for BDB 4.1.17 --- libraries/libldbm/ldbm.c | 4 ++++ servers/slapd/back-bdb/back-bdb.h | 10 ++++++++++ servers/slapd/back-bdb/dbcache.c | 2 +- servers/slapd/back-bdb/init.c | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libraries/libldbm/ldbm.c b/libraries/libldbm/ldbm.c index 112a54a9b4..31c845416f 100644 --- a/libraries/libldbm/ldbm.c +++ b/libraries/libldbm/ldbm.c @@ -335,7 +335,11 @@ ldbm_open( DB_ENV *env, char *name, int rw, int mode, int dbcachesize ) __atoe(n2); name = n2; #endif +#if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR > 0 && DB_VERSION_PATCH >= 17 + err = ret->open( ret, NULL, name, NULL, DB_TYPE, rw, mode); +#else err = ret->open( ret, name, NULL, DB_TYPE, rw, mode); +#endif if ( err != 0 ) { int tmp = errno; diff --git a/servers/slapd/back-bdb/back-bdb.h b/servers/slapd/back-bdb/back-bdb.h index 784bbc89aa..6eeae509e5 100644 --- a/servers/slapd/back-bdb/back-bdb.h +++ b/servers/slapd/back-bdb/back-bdb.h @@ -143,6 +143,9 @@ struct bdb_op_info { int boi_err; }; +#define DB_OPEN(db, file, name, type, flags, mode) \ + (db)->open(db, file, name, type, flags, mode) + #if DB_VERSION_MAJOR < 4 #define LOCK_DETECT(env,f,t,a) lock_detect(env, f, t, a) #define LOCK_GET(env,i,f,o,m,l) lock_get(env, i, f, o, m, l) @@ -167,6 +170,13 @@ struct bdb_op_info { #define TXN_ID(txn) (txn)->id(txn) #define LOCK_ID(env, locker) (env)->lock_id(env, locker) #define LOCK_ID_FREE(env, locker) (env)->lock_id_free(env, locker) + +#if DB_VERSION_MINOR > 1 || DB_VERSION_PATCH >= 17 +#undef DB_OPEN +#define DB_OPEN(db, file, name, type, flags, mode) \ + (db)->open(db, NULL, file, name, type, (flags)|DB_AUTO_COMMIT, mode) +#endif + #endif LDAP_END_DECL diff --git a/servers/slapd/back-bdb/dbcache.c b/servers/slapd/back-bdb/dbcache.c index 68efe9aad4..8ee06503e5 100644 --- a/servers/slapd/back-bdb/dbcache.c +++ b/servers/slapd/back-bdb/dbcache.c @@ -109,7 +109,7 @@ bdb_db_cache( file = ch_malloc( strlen( name ) + sizeof(BDB_SUFFIX) ); sprintf( file, "%s" BDB_SUFFIX, name ); - rc = db->bdi_db->open( db->bdi_db, + rc = DB_OPEN( db->bdi_db, file, name, DB_HASH, bdb->bi_db_opflags | DB_CREATE | DB_THREAD, bdb->bi_dbenv_mode ); diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 8fa83ec16b..7c9ce06645 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -362,7 +362,7 @@ bdb_db_open( BackendDB *be ) BDB_PAGESIZE ); } - rc = db->bdi_db->open( db->bdi_db, + rc = DB_OPEN( db->bdi_db, bdbi_databases[i].file, /* bdbi_databases[i].name, */ NULL, bdbi_databases[i].type, -- 2.39.5