From: Kurt Zeilenga Date: Mon, 11 Feb 2002 17:31:09 +0000 (+0000) Subject: Move BDB backend initialization to bdb_open. bdb_initialize() X-Git-Tag: OPENLDAP_REL_ENG_2_1_BP~45 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=45545571718b55a0f56cc414f977e7d1d0185db8;p=openldap Move BDB backend initialization to bdb_open. bdb_initialize() shouldn't do much more than register callbacks. --- diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 04609b4b22..911f23da16 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -30,20 +30,54 @@ static struct bdbi_database { { NULL, NULL, 0, 0 } }; -#if 0 -static int -bdb_destroy( BackendInfo *bi ) -{ - return 0; -} - static int bdb_open( BackendInfo *bi ) { + static char *controls[] = { + LDAP_CONTROL_MANAGEDSAIT, + LDAP_CONTROL_SUBENTRIES, + LDAP_CONTROL_NOOP, + NULL + }; + /* initialize the underlying database system */ Debug( LDAP_DEBUG_TRACE, "bdb_open: initialize BDB backend\n", 0, 0, 0 ); + { /* version check */ + int major, minor, patch; + char *version = db_version( &major, &minor, &patch ); + + if( major != DB_VERSION_MAJOR || + minor != DB_VERSION_MINOR || + patch < DB_VERSION_PATCH ) + { + Debug( LDAP_DEBUG_ANY, + "bdb_open: version mismatch\n" + "\texpected: " DB_VERSION_STRING "\n" + "\tgot: %s \n", version, 0, 0 ); + } + + Debug( LDAP_DEBUG_ANY, "bdb_open: %s\n", + version, 0, 0 ); + } + +#if 0 + db_env_set_func_malloc( ch_malloc ); + db_env_set_func_realloc( ch_realloc ); + db_env_set_func_free( ch_free ); +#endif + + db_env_set_func_yield( ldap_pvt_thread_yield ); + + bi->bi_controls = controls; + return 0; +} + +#if 0 +static int +bdb_destroy( BackendInfo *bi ) +{ return 0; } @@ -403,42 +437,7 @@ bdb_initialize( BackendInfo *bi ) { - static char *controls[] = { - LDAP_CONTROL_MANAGEDSAIT, - LDAP_CONTROL_SUBENTRIES, - LDAP_CONTROL_NOOP, - NULL - }; - - { /* version check */ - int major, minor, patch; - char *version = db_version( &major, &minor, &patch ); - - if( major != DB_VERSION_MAJOR || - minor != DB_VERSION_MINOR || - patch < DB_VERSION_PATCH ) - { - Debug( LDAP_DEBUG_ANY, - "bi_back_initialize: version mismatch\n" - "\texpected: " DB_VERSION_STRING "\n" - "\tgot: %s \n", version, 0, 0 ); - } - - Debug( LDAP_DEBUG_ANY, "bdb_initialize: %s\n", - version, 0, 0 ); - } - -#if 0 - db_env_set_func_malloc( ch_malloc ); - db_env_set_func_realloc( ch_realloc ); - db_env_set_func_free( ch_free ); -#endif - - db_env_set_func_yield( ldap_pvt_thread_yield ); - - bi->bi_controls = controls; - - bi->bi_open = 0; + bi->bi_open = bdb_open; bi->bi_close = 0; bi->bi_config = 0; bi->bi_destroy = 0;