static int ldbm_instance_generate(struct ldbminfo *li, char *instance_name, Slapi_Backend **ret_be) { Slapi_Backend *new_be = NULL; int rc = 0; /* Create a new instance, process config info for it, * and then call slapi_be_new and create a new backend here */ new_be = slapi_be_new(LDBM_DATABASE_TYPE_NAME /* type */, instance_name, 0 /* public */, 1 /* do log changes */); new_be->be_database = li->li_plugin; rc = ldbm_instance_create(new_be, instance_name); if (rc) { goto bail; } ldbm_instance_config_load_dse_info(new_be->be_instance_info); ldbm_instance_create_default_indexes(new_be); /* if USN plugin is enabled, set slapi_counter */ if (plugin_enabled("USN", li->li_identity) && ldbm_back_isinitialized()) { /* * ldbm_back is already initialized. * I.e., a new instance is being added. * If not initialized, ldbm_usn_init is called later and * be usn counter is initialized there. */ if (config_get_entryusn_global()) { /* global usn counter is already created. * set it to be_usn_counter. */ new_be->be_usn_counter = li->li_global_usn_counter; } else { new_be->be_usn_counter = slapi_counter_new(); slapi_counter_set_value(new_be->be_usn_counter, INITIALUSN); } } if (ret_be != NULL) { *ret_be = new_be; } bail: return rc; }
Slapi_Backend * be_new_internal(struct dse *pdse, const char *type, const char *name) { Slapi_Backend *be= slapi_be_new(type, name, 1 /* Private */, 0 /* Do Not Log Changes */); be->be_database = (struct slapdplugin *) slapi_ch_calloc( 1, sizeof(struct slapdplugin) ); be->be_database->plg_private= (void*)pdse; be->be_database->plg_bind= &dse_bind; be->be_database->plg_unbind= &dse_unbind; be->be_database->plg_search= &dse_search; be->be_database->plg_next_search_entry= &dse_next_search_entry; be->be_database->plg_search_results_release= &dse_search_set_release; be->be_database->plg_prev_search_results= &dse_prev_search_results; be->be_database->plg_compare= &be_plgfn_unwillingtoperform; be->be_database->plg_modify= &dse_modify; be->be_database->plg_modrdn= &be_plgfn_unwillingtoperform; be->be_database->plg_add= &dse_add; be->be_database->plg_delete= &dse_delete; be->be_database->plg_abandon= &be_plgfn_unwillingtoperform; be->be_database->plg_cleanup = dse_deletedse; /* All the other function pointers default to NULL */ return be; }