/* init.c - initialize bdb backend */
/* $OpenLDAP$ */
-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2000-2004 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
*/
#include "portable.h"
LDAP_LIST_INIT (&bdb->bi_psearch_list);
+ ldap_pvt_thread_mutex_init( &bdb->bi_database_mutex );
ldap_pvt_thread_mutex_init( &bdb->bi_lastid_mutex );
+ ldap_pvt_thread_rdwr_init ( &bdb->bi_pslist_rwlock );
ldap_pvt_thread_mutex_init( &bdb->bi_cache.lru_mutex );
ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_dntree.bei_kids_mutex );
ldap_pvt_thread_rdwr_init ( &bdb->bi_cache.c_rwlock );
#ifdef HAVE_EBCDIC
strcpy( path, bdbi_databases[i].file );
__atoe( path );
- rc = DB_OPEN( db->bdi_db, NULL,
+ rc = DB_OPEN( db->bdi_db,
path,
/* bdbi_databases[i].name, */ NULL,
bdbi_databases[i].type,
- bdbi_databases[i].flags | flags | DB_AUTO_COMMIT,
+ bdbi_databases[i].flags | flags,
bdb->bi_dbenv_mode );
#else
- rc = DB_OPEN( db->bdi_db, NULL,
+ rc = DB_OPEN( db->bdi_db,
bdbi_databases[i].file,
/* bdbi_databases[i].name, */ NULL,
bdbi_databases[i].type,
- bdbi_databases[i].flags | flags | DB_AUTO_COMMIT,
+ bdbi_databases[i].flags | flags,
bdb->bi_dbenv_mode );
#endif
ldap_pvt_thread_rdwr_destroy ( &bdb->bi_cache.c_rwlock );
ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.lru_mutex );
ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_dntree.bei_kids_mutex );
+ ldap_pvt_thread_rdwr_destroy ( &bdb->bi_pslist_rwlock );
ldap_pvt_thread_mutex_destroy( &bdb->bi_lastid_mutex );
+ ldap_pvt_thread_mutex_destroy( &bdb->bi_database_mutex );
#ifdef SLAP_IDL_CACHE
if ( bdb->bi_idl_cache_max_size ) {
ldap_pvt_thread_rdwr_destroy( &bdb->bi_idl_tree_rwlock );
return 0;
}
-#ifdef SLAPD_BDB_DYNAMIC
+#if (defined(SLAPD_BDB_DYNAMIC) && !defined(BDB_HIER)) || \
+ (defined(SLAPD_HDB_DYNAMIC) && defined(BDB_HIER))
int init_module( int argc, char *argv[] ) {
BackendInfo bi;
memset( &bi, '\0', sizeof(bi) );
+#ifdef BDB_HIER
+ bi.bi_type = "hdb";
+#else
bi.bi_type = "bdb";
+#endif
bi.bi_init = bdb_initialize;
backend_add( &bi );
LDAP_CONTROL_ASSERT,
LDAP_CONTROL_MANAGEDSAIT,
LDAP_CONTROL_NOOP,
-#ifdef LDAP_CONTROL_PAGEDRESULTS
LDAP_CONTROL_PAGEDRESULTS,
-#endif
#ifdef LDAP_CONTROL_SUBENTRIES
LDAP_CONTROL_SUBENTRIES,
#endif