From be32dce97f174f1660456949688dfb285bc6a44a Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Thu, 11 Nov 2004 00:38:11 +0000 Subject: [PATCH] rework static backend initialization --- servers/slapd/back-bdb/add.c | 1 - servers/slapd/back-bdb/bind.c | 1 - servers/slapd/back-bdb/compare.c | 1 - servers/slapd/back-bdb/config.c | 1 - servers/slapd/back-bdb/ctxcsn.c | 1 - servers/slapd/back-bdb/delete.c | 1 - servers/slapd/back-bdb/extended.c | 1 - servers/slapd/back-bdb/external.h | 73 ++++-------------------- servers/slapd/back-bdb/id2entry.c | 1 - servers/slapd/back-bdb/init.c | 10 ++-- servers/slapd/back-bdb/modify.c | 1 - servers/slapd/back-bdb/modrdn.c | 1 - servers/slapd/back-bdb/operational.c | 1 - servers/slapd/back-bdb/proto-bdb.h | 62 ++++++++++++++++++++ servers/slapd/back-bdb/referral.c | 1 - servers/slapd/back-bdb/search.c | 1 - servers/slapd/back-bdb/tools.c | 1 - servers/slapd/back-bdb/trans.c | 1 - servers/slapd/back-dnssrv/bind.c | 2 +- servers/slapd/back-dnssrv/compare.c | 2 +- servers/slapd/back-dnssrv/config.c | 2 +- servers/slapd/back-dnssrv/external.h | 18 +----- servers/slapd/back-dnssrv/init.c | 1 + servers/slapd/back-dnssrv/proto-dnssrv.h | 41 +++++++++++++ servers/slapd/back-dnssrv/referral.c | 2 +- servers/slapd/back-dnssrv/search.c | 2 +- 26 files changed, 125 insertions(+), 105 deletions(-) create mode 100644 servers/slapd/back-dnssrv/proto-dnssrv.h diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index 2c3826d0c7..b3935fb187 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -20,7 +20,6 @@ #include #include "back-bdb.h" -#include "external.h" int bdb_add(Operation *op, SlapReply *rs ) diff --git a/servers/slapd/back-bdb/bind.c b/servers/slapd/back-bdb/bind.c index c4a2092e0a..3f4c558c85 100644 --- a/servers/slapd/back-bdb/bind.c +++ b/servers/slapd/back-bdb/bind.c @@ -22,7 +22,6 @@ #include #include "back-bdb.h" -#include "external.h" int bdb_bind( Operation *op, SlapReply *rs ) diff --git a/servers/slapd/back-bdb/compare.c b/servers/slapd/back-bdb/compare.c index 7a3b279bf0..d23cf99f25 100644 --- a/servers/slapd/back-bdb/compare.c +++ b/servers/slapd/back-bdb/compare.c @@ -20,7 +20,6 @@ #include #include "back-bdb.h" -#include "external.h" int bdb_compare( Operation *op, SlapReply *rs ) diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index e417e713c2..1c346e38b6 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -20,7 +20,6 @@ #include #include "back-bdb.h" -#include "external.h" #ifdef DB_DIRTY_READ # define SLAP_BDB_ALLOW_DIRTY_READ diff --git a/servers/slapd/back-bdb/ctxcsn.c b/servers/slapd/back-bdb/ctxcsn.c index e5bccf02ed..82e1f53259 100644 --- a/servers/slapd/back-bdb/ctxcsn.c +++ b/servers/slapd/back-bdb/ctxcsn.c @@ -24,7 +24,6 @@ #include "lutil.h" #include "back-bdb.h" -#include "external.h" int bdb_csn_commit( diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index 701ff22ec9..0eb82f9304 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -20,7 +20,6 @@ #include #include "back-bdb.h" -#include "external.h" int bdb_delete( Operation *op, SlapReply *rs ) diff --git a/servers/slapd/back-bdb/extended.c b/servers/slapd/back-bdb/extended.c index dfe8b29a3c..bd65f8115f 100644 --- a/servers/slapd/back-bdb/extended.c +++ b/servers/slapd/back-bdb/extended.c @@ -20,7 +20,6 @@ #include #include "back-bdb.h" -#include "external.h" #include "lber_pvt.h" static struct exop { diff --git a/servers/slapd/back-bdb/external.h b/servers/slapd/back-bdb/external.h index 14070c2919..7a80427ec9 100644 --- a/servers/slapd/back-bdb/external.h +++ b/servers/slapd/back-bdb/external.h @@ -16,75 +16,22 @@ #ifndef _BDB_EXTERNAL_H #define _BDB_EXTERNAL_H -LDAP_BEGIN_DECL - -#ifndef BDB_SYMBOL -#ifdef BDB_HIER -#define BDB_SYMBOL(x) LDAP_CONCAT(hdb_,x) -#else -#define BDB_SYMBOL(x) LDAP_CONCAT(bdb_,x) -#endif -#endif - -#define bdb_initialize BDB_SYMBOL(initialize) -#define bdb_db_config BDB_SYMBOL(db_config) -#define bdb_add BDB_SYMBOL(add) -#define bdb_bind BDB_SYMBOL(bind) -#define bdb_compare BDB_SYMBOL(compare) -#define bdb_delete BDB_SYMBOL(delete) -#define bdb_modify BDB_SYMBOL(modify) -#define bdb_modrdn BDB_SYMBOL(modrdn) -#define bdb_search BDB_SYMBOL(search) -#define bdb_extended BDB_SYMBOL(extended) -#define bdb_referrals BDB_SYMBOL(referrals) -#define bdb_operational BDB_SYMBOL(operational) -#define bdb_hasSubordinates BDB_SYMBOL(hasSubordinates) -#define bdb_tool_entry_open BDB_SYMBOL(tool_entry_open) -#define bdb_tool_entry_close BDB_SYMBOL(tool_entry_close) -#define bdb_tool_entry_next BDB_SYMBOL(tool_entry_next) -#define bdb_tool_entry_get BDB_SYMBOL(tool_entry_get) -#define bdb_tool_entry_put BDB_SYMBOL(tool_entry_put) -#define bdb_tool_entry_reindex BDB_SYMBOL(tool_entry_reindex) -#define bdb_tool_dn2id_get BDB_SYMBOL(tool_dn2id_get) -#define bdb_tool_id2entry_get BDB_SYMBOL(tool_id2entry_get) -#define bdb_tool_entry_modify BDB_SYMBOL(tool_entry_modify) - -extern BI_init bdb_initialize; - -extern BI_db_config bdb_db_config; - -extern BI_op_add bdb_add; - -extern BI_op_bind bdb_bind; +#ifndef _PROTO_BDB_H +#error "\"proto-bdb.h\" must be included first" +#endif /* _PROTO_BDB_H */ -extern BI_op_compare bdb_compare; +/* -extern BI_op_delete bdb_delete; +#include "proto-bdb.h" -extern BI_op_modify bdb_modify; - -extern BI_op_modrdn bdb_modrdn; - -extern BI_op_search bdb_search; - -extern BI_op_extended bdb_extended; - -extern BI_chk_referrals bdb_referrals; + * must be included first + */ -extern BI_operational bdb_operational; +LDAP_BEGIN_DECL -extern BI_has_subordinates bdb_hasSubordinates; +#define bdb_back_initialize BDB_SYMBOL(back_initialize) -/* tools.c */ -extern BI_tool_entry_open bdb_tool_entry_open; -extern BI_tool_entry_close bdb_tool_entry_close; -extern BI_tool_entry_next bdb_tool_entry_next; -extern BI_tool_entry_get bdb_tool_entry_get; -extern BI_tool_entry_put bdb_tool_entry_put; -extern BI_tool_entry_reindex bdb_tool_entry_reindex; -extern BI_tool_dn2id_get bdb_tool_dn2id_get; -extern BI_tool_id2entry_get bdb_tool_id2entry_get; -extern BI_tool_entry_modify bdb_tool_entry_modify; +extern BI_init bdb_back_initialize; LDAP_END_DECL diff --git a/servers/slapd/back-bdb/id2entry.c b/servers/slapd/back-bdb/id2entry.c index cdef3f488d..d1cf0b747e 100644 --- a/servers/slapd/back-bdb/id2entry.c +++ b/servers/slapd/back-bdb/id2entry.c @@ -20,7 +20,6 @@ #include #include "back-bdb.h" -#include "external.h" static int bdb_id2entry_put( BackendDB *be, diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 217c662cf6..f65be68a60 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -540,7 +540,7 @@ int init_module( int argc, char *argv[] ) { #else bi.bi_type = "bdb"; #endif - bi.bi_init = bdb_initialize; + bi.bi_init = bdb_back_initialize; backend_add( &bi ); return 0; @@ -548,7 +548,7 @@ int init_module( int argc, char *argv[] ) { #endif /* SLAPD_BDB */ int -bdb_initialize( +bdb_back_initialize( BackendInfo *bi ) { static char *controls[] = { @@ -564,7 +564,7 @@ bdb_initialize( }; /* initialize the underlying database system */ - Debug( LDAP_DEBUG_TRACE, "bdb_initialize: initialize BDB backend\n", + Debug( LDAP_DEBUG_TRACE, "bdb_back_initialize: initialize BDB backend\n", 0, 0, 0 ); bi->bi_flags |= @@ -596,12 +596,12 @@ bdb_initialize( if( ver < DB_VERSION_FULL ) { Debug( LDAP_DEBUG_ANY, - "bdb_initialize: BDB library version mismatch:" + "bdb_back_initialize: BDB library version mismatch:" " expected " DB_VERSION_STRING "," " got %s\n", version, 0, 0 ); } - Debug( LDAP_DEBUG_ANY, "bdb_initialize: %s\n", + Debug( LDAP_DEBUG_ANY, "bdb_back_initialize: %s\n", version, 0, 0 ); } diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index 0df677600f..07a9740813 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -21,7 +21,6 @@ #include #include "back-bdb.h" -#include "external.h" static struct berval scbva[] = { BER_BVC("glue"), diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index 82f48c4210..a85ca3faef 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -20,7 +20,6 @@ #include #include "back-bdb.h" -#include "external.h" int bdb_modrdn( Operation *op, SlapReply *rs ) diff --git a/servers/slapd/back-bdb/operational.c b/servers/slapd/back-bdb/operational.c index 8eabfc9233..5707cf4dbf 100644 --- a/servers/slapd/back-bdb/operational.c +++ b/servers/slapd/back-bdb/operational.c @@ -23,7 +23,6 @@ #include "slap.h" #include "back-bdb.h" -#include "external.h" /* * sets *hasSubordinates to LDAP_COMPARE_TRUE/LDAP_COMPARE_FALSE diff --git a/servers/slapd/back-bdb/proto-bdb.h b/servers/slapd/back-bdb/proto-bdb.h index 8f7273f6ec..6f264720f4 100644 --- a/servers/slapd/back-bdb/proto-bdb.h +++ b/servers/slapd/back-bdb/proto-bdb.h @@ -572,6 +572,68 @@ int bdb_do_search( void bdb_trans_backoff( int num_retries ); +/* + * former external.h + */ + +#ifndef BDB_SYMBOL +#ifdef BDB_HIER +#define BDB_SYMBOL(x) LDAP_CONCAT(hdb_,x) +#else +#define BDB_SYMBOL(x) LDAP_CONCAT(bdb_,x) +#endif +#endif + +#define bdb_db_config BDB_SYMBOL(db_config) +#define bdb_add BDB_SYMBOL(add) +#define bdb_bind BDB_SYMBOL(bind) +#define bdb_compare BDB_SYMBOL(compare) +#define bdb_delete BDB_SYMBOL(delete) +#define bdb_modify BDB_SYMBOL(modify) +#define bdb_modrdn BDB_SYMBOL(modrdn) +#define bdb_search BDB_SYMBOL(search) +#define bdb_extended BDB_SYMBOL(extended) +#define bdb_referrals BDB_SYMBOL(referrals) +#define bdb_operational BDB_SYMBOL(operational) +#define bdb_hasSubordinates BDB_SYMBOL(hasSubordinates) +#define bdb_tool_entry_open BDB_SYMBOL(tool_entry_open) +#define bdb_tool_entry_close BDB_SYMBOL(tool_entry_close) +#define bdb_tool_entry_next BDB_SYMBOL(tool_entry_next) +#define bdb_tool_entry_get BDB_SYMBOL(tool_entry_get) +#define bdb_tool_entry_put BDB_SYMBOL(tool_entry_put) +#define bdb_tool_entry_reindex BDB_SYMBOL(tool_entry_reindex) +#define bdb_tool_dn2id_get BDB_SYMBOL(tool_dn2id_get) +#define bdb_tool_id2entry_get BDB_SYMBOL(tool_id2entry_get) +#define bdb_tool_entry_modify BDB_SYMBOL(tool_entry_modify) + +extern BI_db_config bdb_db_config; + +extern BI_op_add bdb_add; +extern BI_op_bind bdb_bind; +extern BI_op_compare bdb_compare; +extern BI_op_delete bdb_delete; +extern BI_op_modify bdb_modify; +extern BI_op_modrdn bdb_modrdn; +extern BI_op_search bdb_search; +extern BI_op_extended bdb_extended; + +extern BI_chk_referrals bdb_referrals; + +extern BI_operational bdb_operational; + +extern BI_has_subordinates bdb_hasSubordinates; + +/* tools.c */ +extern BI_tool_entry_open bdb_tool_entry_open; +extern BI_tool_entry_close bdb_tool_entry_close; +extern BI_tool_entry_next bdb_tool_entry_next; +extern BI_tool_entry_get bdb_tool_entry_get; +extern BI_tool_entry_put bdb_tool_entry_put; +extern BI_tool_entry_reindex bdb_tool_entry_reindex; +extern BI_tool_dn2id_get bdb_tool_dn2id_get; +extern BI_tool_id2entry_get bdb_tool_id2entry_get; +extern BI_tool_entry_modify bdb_tool_entry_modify; + LDAP_END_DECL #endif /* _PROTO_BDB_H */ diff --git a/servers/slapd/back-bdb/referral.c b/servers/slapd/back-bdb/referral.c index 9b8d434deb..aab9fe6dcf 100644 --- a/servers/slapd/back-bdb/referral.c +++ b/servers/slapd/back-bdb/referral.c @@ -19,7 +19,6 @@ #include #include "back-bdb.h" -#include "external.h" int bdb_referrals( Operation *op, SlapReply *rs ) diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index 5f7081f97e..e765b3a2de 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -21,7 +21,6 @@ #include "back-bdb.h" #include "idl.h" -#include "external.h" static int base_candidate( BackendDB *be, diff --git a/servers/slapd/back-bdb/tools.c b/servers/slapd/back-bdb/tools.c index ddf92e751c..0f4dcfcfd6 100644 --- a/servers/slapd/back-bdb/tools.c +++ b/servers/slapd/back-bdb/tools.c @@ -21,7 +21,6 @@ #define AVL_INTERNAL #include "back-bdb.h" -#include "external.h" static DBC *cursor = NULL; static DBT key, data; diff --git a/servers/slapd/back-bdb/trans.c b/servers/slapd/back-bdb/trans.c index b10906a21b..a18875ee14 100644 --- a/servers/slapd/back-bdb/trans.c +++ b/servers/slapd/back-bdb/trans.c @@ -20,7 +20,6 @@ #include #include "back-bdb.h" -#include "external.h" #include "lber_pvt.h" #include "lutil.h" diff --git a/servers/slapd/back-dnssrv/bind.c b/servers/slapd/back-dnssrv/bind.c index a5a3fe3d9b..eb02774567 100644 --- a/servers/slapd/back-dnssrv/bind.c +++ b/servers/slapd/back-dnssrv/bind.c @@ -28,7 +28,7 @@ #include #include "slap.h" -#include "external.h" +#include "proto-dnssrv.h" int dnssrv_back_bind( diff --git a/servers/slapd/back-dnssrv/compare.c b/servers/slapd/back-dnssrv/compare.c index 50464d5b08..99f99de81e 100644 --- a/servers/slapd/back-dnssrv/compare.c +++ b/servers/slapd/back-dnssrv/compare.c @@ -27,7 +27,7 @@ #include #include "slap.h" -#include "back-dnssrv.h" +#include "proto-dnssrv.h" int dnssrv_back_compare( diff --git a/servers/slapd/back-dnssrv/config.c b/servers/slapd/back-dnssrv/config.c index d809179b4b..c72a15b1c1 100644 --- a/servers/slapd/back-dnssrv/config.c +++ b/servers/slapd/back-dnssrv/config.c @@ -27,7 +27,7 @@ #include #include "slap.h" -#include "external.h" +#include "proto-dnssrv.h" int dnssrv_back_db_config( diff --git a/servers/slapd/back-dnssrv/external.h b/servers/slapd/back-dnssrv/external.h index 1a34767d9a..5f7ebb94b6 100644 --- a/servers/slapd/back-dnssrv/external.h +++ b/servers/slapd/back-dnssrv/external.h @@ -22,23 +22,7 @@ LDAP_BEGIN_DECL -extern BI_init dnssrv_back_initialize; -extern BI_open dnssrv_back_open; -extern BI_close dnssrv_back_close; -extern BI_destroy dnssrv_back_destroy; - -extern BI_db_init dnssrv_back_db_init; -extern BI_db_destroy dnssrv_back_db_destroy; - -extern BI_db_config dnssrv_back_db_config; - -extern BI_op_bind dnssrv_back_bind; - -extern BI_op_search dnssrv_back_search; - -extern BI_op_compare dnssrv_back_compare; - -extern BI_chk_referrals dnssrv_back_referrals; +extern BI_init dnssrv_back_initialize; LDAP_END_DECL diff --git a/servers/slapd/back-dnssrv/init.c b/servers/slapd/back-dnssrv/init.c index fc8e99146f..392ade4512 100644 --- a/servers/slapd/back-dnssrv/init.c +++ b/servers/slapd/back-dnssrv/init.c @@ -26,6 +26,7 @@ #include #include "slap.h" +#include "proto-dnssrv.h" #include "external.h" #if SLAPD_DNSSRV == SLAPD_MOD_DYNAMIC diff --git a/servers/slapd/back-dnssrv/proto-dnssrv.h b/servers/slapd/back-dnssrv/proto-dnssrv.h new file mode 100644 index 0000000000..7b01eee39b --- /dev/null +++ b/servers/slapd/back-dnssrv/proto-dnssrv.h @@ -0,0 +1,41 @@ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software . + * + * 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 + * . + */ +/* ACKNOWLEDGEMENTS: + * This work was originally developed by Kurt D. Zeilenga for inclusion + * in OpenLDAP Software. + */ + +#ifndef PROTO_DNSSRV_H +#define PROTO_DNSSRV_H + +LDAP_BEGIN_DECL + +extern BI_open dnssrv_back_open; +extern BI_close dnssrv_back_close; +extern BI_destroy dnssrv_back_destroy; + +extern BI_db_init dnssrv_back_db_init; +extern BI_db_destroy dnssrv_back_db_destroy; +extern BI_db_config dnssrv_back_db_config; + +extern BI_op_bind dnssrv_back_bind; +extern BI_op_search dnssrv_back_search; +extern BI_op_compare dnssrv_back_compare; + +extern BI_chk_referrals dnssrv_back_referrals; + +LDAP_END_DECL + +#endif /* PROTO_DNSSRV_H */ diff --git a/servers/slapd/back-dnssrv/referral.c b/servers/slapd/back-dnssrv/referral.c index 1d5ba88edb..0e130de0b2 100644 --- a/servers/slapd/back-dnssrv/referral.c +++ b/servers/slapd/back-dnssrv/referral.c @@ -27,7 +27,7 @@ #include #include "slap.h" -#include "external.h" +#include "proto-dnssrv.h" int dnssrv_back_referrals( diff --git a/servers/slapd/back-dnssrv/search.c b/servers/slapd/back-dnssrv/search.c index 40c03230f0..6970abe91a 100644 --- a/servers/slapd/back-dnssrv/search.c +++ b/servers/slapd/back-dnssrv/search.c @@ -28,7 +28,7 @@ #include #include "slap.h" -#include "external.h" +#include "proto-dnssrv.h" int dnssrv_back_search( -- 2.39.5