From 9c550e7235830af9d031d8d7ba86b87f36dcc99f Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 13 Nov 2004 18:52:44 +0000 Subject: [PATCH] first step towards removing back-*/external.h --- servers/slapd/back-bdb/init.c | 39 +++++++++++++++++-------------- servers/slapd/back-dnssrv/init.c | 35 ++++++++++++++------------- servers/slapd/back-ldap/init.c | 36 ++++++++++++++-------------- servers/slapd/back-ldbm/init.c | 35 +++++++++++++++------------ servers/slapd/back-meta/init.c | 35 ++++++++++++++------------- servers/slapd/back-monitor/init.c | 35 ++++++++++++++------------- servers/slapd/back-null/null.c | 20 +++++++++------- servers/slapd/back-passwd/init.c | 34 +++++++++++++++------------ servers/slapd/back-perl/init.c | 36 +++++++++++++++------------- servers/slapd/back-relay/init.c | 34 ++++++++++++++------------- servers/slapd/back-shell/init.c | 34 +++++++++++++++------------ servers/slapd/back-sql/init.c | 37 ++++++++++++++--------------- 12 files changed, 222 insertions(+), 188 deletions(-) diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index f65be68a60..b453c0266f 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -529,24 +529,6 @@ bdb_db_destroy( BackendDB *be ) return 0; } -#if (SLAPD_BDB == SLAPD_MOD_DYNAMIC && !defined(BDB_HIER)) || \ - (SLAPD_HDB == SLAPD_MOD_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_back_initialize; - - backend_add( &bi ); - return 0; -} -#endif /* SLAPD_BDB */ - int bdb_back_initialize( BackendInfo *bi ) @@ -674,3 +656,24 @@ bdb_back_initialize( return 0; } + +#if (SLAPD_BDB == SLAPD_MOD_DYNAMIC && !defined(BDB_HIER)) || \ + (SLAPD_HDB == SLAPD_MOD_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_back_initialize; + + backend_add( &bi ); + return 0; +} +#endif /* SLAPD_BDB */ + diff --git a/servers/slapd/back-dnssrv/init.c b/servers/slapd/back-dnssrv/init.c index 392ade4512..2d36c332ce 100644 --- a/servers/slapd/back-dnssrv/init.c +++ b/servers/slapd/back-dnssrv/init.c @@ -29,22 +29,6 @@ #include "proto-dnssrv.h" #include "external.h" -#if SLAPD_DNSSRV == SLAPD_MOD_DYNAMIC - -int init_module(int argc, char *argv[]) -{ - BackendInfo bi; - - memset( &bi, '\0', sizeof(bi) ); - bi.bi_type = "dnssrv"; - bi.bi_init = dnssrv_back_initialize; - - backend_add( &bi ); - return 0; -} - -#endif /* SLAPD_DNSSRV */ - int dnssrv_back_initialize( BackendInfo *bi ) @@ -101,3 +85,22 @@ dnssrv_back_db_destroy( { return 0; } + +#if SLAPD_DNSSRV == SLAPD_MOD_DYNAMIC + +int +init_module( int argc, char *argv[] ) +{ + BackendInfo bi; + + memset( &bi, '\0', sizeof( bi ) ); + bi.bi_type = "dnssrv"; + bi.bi_init = dnssrv_back_initialize; + + backend_add( &bi ); + + return 0; +} + +#endif /* SLAPD_DNSSRV */ + diff --git a/servers/slapd/back-ldap/init.c b/servers/slapd/back-ldap/init.c index 240fdcd654..ce27112586 100644 --- a/servers/slapd/back-ldap/init.c +++ b/servers/slapd/back-ldap/init.c @@ -32,23 +32,6 @@ #include "back-ldap.h" #include "external.h" -#if SLAPD_LDAP == SLAPD_MOD_DYNAMIC -int -init_module( int argc, char *argv[] ) -{ - BackendInfo bi; - - memset( &bi, '\0', sizeof( bi ) ); - bi.bi_type = "ldap"; - bi.bi_init = ldap_back_initialize; - - backend_add( &bi ); - - return 0; -} - -#endif /* SLAPD_LDAP */ - int ldap_back_open( BackendInfo *bi ) { @@ -271,3 +254,22 @@ ldap_back_db_destroy( return 0; } + +#if SLAPD_LDAP == SLAPD_MOD_DYNAMIC + +int +init_module( int argc, char *argv[] ) +{ + BackendInfo bi; + + memset( &bi, '\0', sizeof( bi ) ); + bi.bi_type = "ldap"; + bi.bi_init = ldap_back_initialize; + + backend_add( &bi ); + + return 0; +} + +#endif /* SLAPD_LDAP */ + diff --git a/servers/slapd/back-ldbm/init.c b/servers/slapd/back-ldbm/init.c index c78ce11261..120362b6a9 100644 --- a/servers/slapd/back-ldbm/init.c +++ b/servers/slapd/back-ldbm/init.c @@ -25,21 +25,6 @@ #include "back-ldbm.h" #include "external.h" -#if SLAPD_LDBM == SLAPD_MOD_DYNAMIC - -int init_module(int argc, char *argv[]) { - BackendInfo bi; - - memset( &bi, '\0', sizeof(bi) ); - bi.bi_type = "ldbm"; - bi.bi_init = ldbm_back_initialize; - - backend_add(&bi); - return 0; -} - -#endif /* SLAPD_LDBM */ - int ldbm_back_initialize( BackendInfo *bi @@ -253,3 +238,23 @@ ldbm_back_db_destroy( return 0; } + +#if SLAPD_LDBM == SLAPD_MOD_DYNAMIC + +int +init_module( int argc, char *argv[] ) +{ + BackendInfo bi; + + memset( &bi, '\0', sizeof(bi) ); + bi.bi_type = "ldbm"; + bi.bi_init = ldbm_back_initialize; + + backend_add( &bi ); + + return 0; +} + +#endif /* SLAPD_LDBM */ + + diff --git a/servers/slapd/back-meta/init.c b/servers/slapd/back-meta/init.c index 01d9874537..d173e6e1de 100644 --- a/servers/slapd/back-meta/init.c +++ b/servers/slapd/back-meta/init.c @@ -27,22 +27,6 @@ #include "back-meta.h" #include "external.h" -#if SLAPD_META == SLAPD_MOD_DYNAMIC - -int -init_module( int argc, char *argv[] ) { - BackendInfo bi; - - memset( &bi, '\0', sizeof( bi ) ); - bi.bi_type = "meta"; - bi.bi_init = meta_back_initialize; - - backend_add( &bi ); - return 0; -} - -#endif /* SLAPD_META */ - int meta_back_open( BackendInfo *bi @@ -238,3 +222,22 @@ meta_back_db_destroy( return 0; } +#if SLAPD_META == SLAPD_MOD_DYNAMIC + +int +init_module( int argc, char *argv[] ) +{ + BackendInfo bi; + + memset( &bi, '\0', sizeof( bi ) ); + bi.bi_type = "meta"; + bi.bi_init = meta_back_initialize; + + backend_add( &bi ); + + return 0; +} + +#endif /* SLAPD_META */ + + diff --git a/servers/slapd/back-monitor/init.c b/servers/slapd/back-monitor/init.c index 23d93e0c02..8f768f1648 100644 --- a/servers/slapd/back-monitor/init.c +++ b/servers/slapd/back-monitor/init.c @@ -160,22 +160,6 @@ static struct monitor_subsys_t known_monitor_subsys[] = { }, { NULL } }; -#if SLAPD_MONITOR == SLAPD_MOD_DYNAMIC - -int -init_module( int argc, char *argv[] ) -{ - BackendInfo bi; - - memset( &bi, '\0', sizeof(bi) ); - bi.bi_type = "monitor"; - bi.bi_init = monitor_back_initialize; - backend_add( &bi ); - return 0; -} - -#endif /* SLAPD_MONITOR */ - int monitor_back_register_subsys( monitor_subsys_t *ms ) { @@ -1471,3 +1455,22 @@ monitor_back_db_destroy( return 0; } +#if SLAPD_MONITOR == SLAPD_MOD_DYNAMIC + +int +init_module( int argc, char *argv[] ) +{ + BackendInfo bi; + + memset( &bi, '\0', sizeof( bi ) ); + bi.bi_type = "monitor"; + bi.bi_init = monitor_back_initialize; + + backend_add( &bi ); + + return 0; +} + +#endif /* SLAPD_MONITOR */ + + diff --git a/servers/slapd/back-null/null.c b/servers/slapd/back-null/null.c index f0d5f76df9..977e892456 100644 --- a/servers/slapd/back-null/null.c +++ b/servers/slapd/back-null/null.c @@ -173,17 +173,19 @@ null_back_initialize( } #if SLAPD_NULL == SLAPD_MOD_DYNAMIC -int init_module( - int argc, - char *argv[] ) + +int +init_module( int argc, char *argv[] ) { - BackendInfo bi; + BackendInfo bi; + + memset( &bi, '\0', sizeof( bi ) ); + bi.bi_type = "null"; + bi.bi_init = null_back_initialize; - memset( &bi, '\0', sizeof(bi) ); - bi.bi_type = "null"; - bi.bi_init = null_back_initialize; + backend_add( &bi ); - backend_add(&bi); - return 0; + return 0; } + #endif /* SLAPD_NULL */ diff --git a/servers/slapd/back-passwd/init.c b/servers/slapd/back-passwd/init.c index 34e486846c..ee40e72a93 100644 --- a/servers/slapd/back-passwd/init.c +++ b/servers/slapd/back-passwd/init.c @@ -26,21 +26,6 @@ ldap_pvt_thread_mutex_t passwd_mutex; -#if SLAPD_PASSWD == SLAPD_MOD_DYNAMIC - -int init_module(int argc, char *argv[]) { - BackendInfo bi; - - memset( &bi, '\0', sizeof(bi) ); - bi.bi_type = "passwd"; - bi.bi_init = passwd_back_initialize; - - backend_add(&bi); - return 0; -} - -#endif /* SLAPD_PASSWD */ - int passwd_back_initialize( BackendInfo *bi @@ -87,3 +72,22 @@ passwd_back_destroy( ldap_pvt_thread_mutex_destroy( &passwd_mutex ); return 0; } + +#if SLAPD_PASSWD == SLAPD_MOD_DYNAMIC + +int +init_module( int argc, char *argv[] ) +{ + BackendInfo bi; + + memset( &bi, '\0', sizeof( bi ) ); + bi.bi_type = "passwd"; + bi.bi_init = passwd_back_initialize; + + backend_add( &bi ); + + return 0; +} + +#endif /* SLAPD_PASSWD */ + diff --git a/servers/slapd/back-perl/init.c b/servers/slapd/back-perl/init.c index 91ca484979..ff3b589ab9 100644 --- a/servers/slapd/back-perl/init.c +++ b/servers/slapd/back-perl/init.c @@ -24,22 +24,6 @@ EXT void boot_DynaLoader LDAP_P((PERL_BACK_BOOT_DYNALOADER_PARAMS)); PerlInterpreter *PERL_INTERPRETER = NULL; ldap_pvt_thread_mutex_t perl_interpreter_mutex; -#if SLAPD_PERL == SLAPD_MOD_DYNAMIC - -int init_module(int argc, char *argv[]) -{ - BackendInfo bi; - - memset( &bi, '\0', sizeof(bi) ); - bi.bi_type = "perl"; - bi.bi_init = perl_back_initialize; - - backend_add(&bi); - return 0; -} - -#endif /* SLAPD_PERL */ - /********************************************************** * @@ -172,3 +156,23 @@ perl_back_xs_init(PERL_BACK_XS_INIT_PARAMS) dXSUB_SYS; newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); } + +#if SLAPD_PERL == SLAPD_MOD_DYNAMIC + +int +init_module( int argc, char *argv[] ) +{ + BackendInfo bi; + + memset( &bi, '\0', sizeof( bi ) ); + bi.bi_type = "perl"; + bi.bi_init = perl_back_initialize; + + backend_add( &bi ); + + return 0; +} + +#endif /* SLAPD_PERL */ + + diff --git a/servers/slapd/back-relay/init.c b/servers/slapd/back-relay/init.c index 9862df5d34..66213427d7 100644 --- a/servers/slapd/back-relay/init.c +++ b/servers/slapd/back-relay/init.c @@ -26,22 +26,6 @@ #include "back-relay.h" #include "external.h" -#if SLAPD_RELAY == SLAPD_MOD_DYNAMIC - -int -init_module( int argc, char *argv[] ) { - BackendInfo bi; - - memset( &bi, '\0', sizeof( bi ) ); - bi.bi_type = "relay"; - bi.bi_init = relay_back_initialize; - - backend_add(&bi); - return 0; -} - -#endif /* SLAPD_RELAY */ - int relay_back_initialize( BackendInfo *bi ) { @@ -140,3 +124,21 @@ relay_back_db_destroy( Backend *be ) return 0; } +#if SLAPD_RELAY == SLAPD_MOD_DYNAMIC + +int +init_module( int argc, char *argv[] ) +{ + BackendInfo bi; + + memset( &bi, '\0', sizeof( bi ) ); + bi.bi_type = "relay"; + bi.bi_init = relay_back_initialize; + + backend_add( &bi ); + + return 0; +} + +#endif /* SLAPD_RELAY */ + diff --git a/servers/slapd/back-shell/init.c b/servers/slapd/back-shell/init.c index a523ef3a2d..2441be162e 100644 --- a/servers/slapd/back-shell/init.c +++ b/servers/slapd/back-shell/init.c @@ -39,21 +39,6 @@ #include "shell.h" #include "external.h" -#if SLAPD_SHELL == SLAPD_MOD_DYNAMIC - -int init_module(int argc, char *argv[]) { - BackendInfo bi; - - memset( &bi, '\0', sizeof(bi) ); - bi.bi_type = "shell"; - bi.bi_init = shell_back_initialize; - - backend_add(&bi); - return 0; -} - -#endif /* SLAPD_SHELL */ - int shell_back_initialize( BackendInfo *bi @@ -112,3 +97,22 @@ shell_back_db_destroy( free( be->be_private ); return 0; } + +#if SLAPD_SHELL == SLAPD_MOD_DYNAMIC + +int +init_module( int argc, char *argv[] ) +{ + BackendInfo bi; + + memset( &bi, '\0', sizeof( bi ) ); + bi.bi_type = "shell"; + bi.bi_init = shell_back_initialize; + + backend_add( &bi ); + + return 0; +} + +#endif /* SLAPD_SHELL */ + diff --git a/servers/slapd/back-sql/init.c b/servers/slapd/back-sql/init.c index e5519bb794..468ffc7068 100644 --- a/servers/slapd/back-sql/init.c +++ b/servers/slapd/back-sql/init.c @@ -30,25 +30,6 @@ #include "proto-sql.h" #include "external.h" -#if SLAPD_SQL == SLAPD_MOD_DYNAMIC - -int -init_module( - int argc, - char *argv[] ) -{ - BackendInfo bi; - - memset( &bi, '\0', sizeof( bi ) ); - bi.bi_type = "sql"; - bi.bi_init = sql_back_initialize; - - backend_add( &bi ); - return 0; -} - -#endif /* SLAPD_SQL == SLAPD_MOD_DYNAMIC */ - int sql_back_initialize( BackendInfo *bi ) @@ -502,5 +483,23 @@ backsql_connection_destroy( Backend *bd, Connection *c ) return 0; } +#if SLAPD_SQL == SLAPD_MOD_DYNAMIC + +int +init_module( int argc, char *argv[] ) +{ + BackendInfo bi; + + memset( &bi, '\0', sizeof( bi ) ); + bi.bi_type = "sql"; + bi.bi_init = sql_back_initialize; + + backend_add( &bi ); + + return 0; +} + +#endif /* SLAPD_SQL == SLAPD_MOD_DYNAMIC */ + #endif /* SLAPD_SQL */ -- 2.39.5