From 6c53999c970d7f1f5f7f87310fa4b578f88e6819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 3 Jan 2017 12:13:47 +0200 Subject: [PATCH] Combine ModuleInit and GetModuleObject The two functions can be combined into one as both are called only once. This removes the need for the explicit ModuleInit function. --- query_classifier/qc_dummy/qc_dummy.cc | 4 --- .../qc_mysqlembedded/qc_mysqlembedded.cc | 4 --- query_classifier/qc_sqlite/qc_sqlite.c | 4 --- server/core/load_utils.c | 12 +-------- .../CDCPlainAuth/cdc_plain_auth.c | 24 ++++++----------- .../GSSAPI/GSSAPIAuth/gssapi_auth.c | 7 ----- .../GSSAPIBackendAuth/gssapi_backend_auth.c | 7 ----- .../authenticator/HTTPAuth/http_auth.c | 8 ------ .../MaxAdminAuth/max_admin_auth.c | 8 ------ .../authenticator/MySQLAuth/mysql_auth.c | 8 ------ .../MySQLBackendAuth/mysql_backend_auth.c | 8 ------ .../NullAuthAllow/null_auth_allow.c | 8 ------ .../NullAuthDeny/null_auth_deny.c | 8 ------ server/modules/filter/cache/cachefilter.cc | 10 +++---- server/modules/filter/ccrfilter/ccrfilter.c | 12 --------- server/modules/filter/dbfwfilter/dbfwfilter.c | 26 +++++-------------- server/modules/filter/hintfilter/hintfilter.c | 13 ---------- server/modules/filter/luafilter/luafilter.c | 12 --------- .../modules/filter/masking/maskingfilter.cc | 6 +---- server/modules/filter/maxrows/maxrows.c | 8 ------ server/modules/filter/mqfilter/mqfilter.c | 12 --------- .../namedserverfilter/namedserverfilter.c | 12 --------- server/modules/filter/qlafilter/qlafilter.c | 12 --------- .../modules/filter/regexfilter/regexfilter.c | 12 --------- server/modules/filter/tee/tee.c | 20 +++----------- server/modules/filter/testfilter/testfilter.c | 12 --------- server/modules/filter/topfilter/topfilter.c | 12 --------- server/modules/filter/tpmfilter/tpmfilter.c | 9 ------- server/modules/monitor/auroramon/auroramon.c | 10 ------- server/modules/monitor/mmmon/mmmon.c | 11 +------- server/modules/monitor/mysqlmon/mysql_mon.c | 11 +------- .../monitor/ndbclustermon/ndbclustermon.c | 11 +------- server/modules/protocol/CDC/cdc.c | 9 ------- server/modules/protocol/HTTPD/httpd.c | 8 ------ .../MySQL/MySQLBackend/mysql_backend.c | 8 ------ .../protocol/MySQL/MySQLClient/mysql_client.c | 8 ------ server/modules/protocol/maxscaled/maxscaled.c | 10 +------ server/modules/protocol/telnetd/telnetd.c | 10 +------ .../protocol/testprotocol/testprotocol.c | 8 ------ server/modules/routing/debugcli/debugcli.c | 15 +++-------- server/modules/routing/maxinfo/maxinfo.c | 15 +++-------- .../routing/readconnroute/readconnroute.c | 15 +++-------- .../routing/readwritesplit/readwritesplit.c | 10 +------ .../routing/schemarouter/schemarouter.c | 14 +++------- server/modules/routing/testroute/testroute.c | 10 ------- 45 files changed, 42 insertions(+), 439 deletions(-) diff --git a/query_classifier/qc_dummy/qc_dummy.cc b/query_classifier/qc_dummy/qc_dummy.cc index 96881c2ca..d54a378e7 100644 --- a/query_classifier/qc_dummy/qc_dummy.cc +++ b/query_classifier/qc_dummy/qc_dummy.cc @@ -98,10 +98,6 @@ void qc_thread_end(void) extern "C" { - void ModuleInit() - { - } - /* @see function load_module in load_utils.c for explanation of the following * lint directives. */ diff --git a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc index 1bfbc3cb5..d8bd1199d 100644 --- a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc +++ b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc @@ -2591,10 +2591,6 @@ MODULE_INFO info = "V1.0.0" }; -void ModuleInit() -{ -} - QUERY_CLASSIFIER* GetModuleObject() { return &qc; diff --git a/query_classifier/qc_sqlite/qc_sqlite.c b/query_classifier/qc_sqlite/qc_sqlite.c index 3f3c5f06f..5ed088c6f 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.c +++ b/query_classifier/qc_sqlite/qc_sqlite.c @@ -3203,10 +3203,6 @@ MODULE_INFO info = "V1.0.0" }; -void ModuleInit() -{ -} - QUERY_CLASSIFIER* GetModuleObject() { return &qc; diff --git a/server/core/load_utils.c b/server/core/load_utils.c index a1485c8ab..05b79a5be 100644 --- a/server/core/load_utils.c +++ b/server/core/load_utils.c @@ -142,18 +142,8 @@ void *load_module(const char *module, const char *type) return NULL; } - void *sym; - - /* - * If the module has a ModuleInit function cal it now. - */ - if ((sym = dlsym(dlhandle, "ModuleInit")) != NULL) - { - void (*ModuleInit)() = sym; - ModuleInit(); - } - MODULE_INFO *mod_info = NULL; + void *sym; if ((sym = dlsym(dlhandle, "info")) != NULL) { diff --git a/server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.c b/server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.c index 632144ae1..329aa2882 100644 --- a/server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.c +++ b/server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.c @@ -159,22 +159,6 @@ static bool cdc_add_new_user(const MODULECMD_ARG *args) return rval; } -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ - modulecmd_arg_type_t args[] = - { - { MODULECMD_ARG_SERVICE, "Service where the user is added"}, - { MODULECMD_ARG_STRING, "User to add"}, - { MODULECMD_ARG_STRING, "Password of the user"} - }; - - modulecmd_register_command("cdc", "add_user", cdc_add_new_user, 3, args); -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -185,6 +169,14 @@ void ModuleInit() */ GWAUTHENTICATOR* GetModuleObject() { + modulecmd_arg_type_t args[] = + { + { MODULECMD_ARG_SERVICE, "Service where the user is added"}, + { MODULECMD_ARG_STRING, "User to add"}, + { MODULECMD_ARG_STRING, "Password of the user"} + }; + + modulecmd_register_command("cdc", "add_user", cdc_add_new_user, 3, args); return &MyObject; } diff --git a/server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.c b/server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.c index 6e5108ac1..dd89ac39b 100644 --- a/server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.c +++ b/server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.c @@ -620,13 +620,6 @@ MODULE_INFO info = "V1.0.0" }; -/** - * Module initialization entry point - */ -void ModuleInit() -{ -} - /** * Module handle entry point */ diff --git a/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.c b/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.c index 49a0c1fd2..32470ba38 100644 --- a/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.c +++ b/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.c @@ -284,13 +284,6 @@ MODULE_INFO info = "V1.0.0" }; -/** - * Module initialization entry point - */ -void ModuleInit() -{ -} - /** * Module handle entry point */ diff --git a/server/modules/authenticator/HTTPAuth/http_auth.c b/server/modules/authenticator/HTTPAuth/http_auth.c index ef63a2301..445de2b7c 100644 --- a/server/modules/authenticator/HTTPAuth/http_auth.c +++ b/server/modules/authenticator/HTTPAuth/http_auth.c @@ -74,14 +74,6 @@ typedef struct http_auth char* pw; }HTTP_AUTH; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/authenticator/MaxAdminAuth/max_admin_auth.c b/server/modules/authenticator/MaxAdminAuth/max_admin_auth.c index 400c80f9b..616923c4b 100644 --- a/server/modules/authenticator/MaxAdminAuth/max_admin_auth.c +++ b/server/modules/authenticator/MaxAdminAuth/max_admin_auth.c @@ -68,14 +68,6 @@ static GWAUTHENTICATOR MyObject = users_default_loadusers /* Load generic users */ }; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/authenticator/MySQLAuth/mysql_auth.c b/server/modules/authenticator/MySQLAuth/mysql_auth.c index 713fe51d4..653d476b1 100644 --- a/server/modules/authenticator/MySQLAuth/mysql_auth.c +++ b/server/modules/authenticator/MySQLAuth/mysql_auth.c @@ -93,14 +93,6 @@ static int mysql_auth_set_client_data( MySQLProtocol *protocol, GWBUF *buffer); -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/authenticator/MySQLBackendAuth/mysql_backend_auth.c b/server/modules/authenticator/MySQLBackendAuth/mysql_backend_auth.c index 61dfc6d95..9921f51c0 100644 --- a/server/modules/authenticator/MySQLBackendAuth/mysql_backend_auth.c +++ b/server/modules/authenticator/MySQLBackendAuth/mysql_backend_auth.c @@ -177,14 +177,6 @@ static GWAUTHENTICATOR MyObject = NULL /* We don't need to load users */ }; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/authenticator/NullAuthAllow/null_auth_allow.c b/server/modules/authenticator/NullAuthAllow/null_auth_allow.c index d216888bb..f31c3238f 100644 --- a/server/modules/authenticator/NullAuthAllow/null_auth_allow.c +++ b/server/modules/authenticator/NullAuthAllow/null_auth_allow.c @@ -70,14 +70,6 @@ static GWAUTHENTICATOR MyObject = users_default_loadusers /* Load generic users */ }; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/authenticator/NullAuthDeny/null_auth_deny.c b/server/modules/authenticator/NullAuthDeny/null_auth_deny.c index 93beb5f6a..8a6ef95f0 100644 --- a/server/modules/authenticator/NullAuthDeny/null_auth_deny.c +++ b/server/modules/authenticator/NullAuthDeny/null_auth_deny.c @@ -67,14 +67,6 @@ static GWAUTHENTICATOR MyObject = users_default_loadusers /* Load generic users */ }; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/filter/cache/cachefilter.cc b/server/modules/filter/cache/cachefilter.cc index fd2b93edd..38e031ea5 100644 --- a/server/modules/filter/cache/cachefilter.cc +++ b/server/modules/filter/cache/cachefilter.cc @@ -202,22 +202,18 @@ MODULE_INFO info = VERSION_STRING }; -extern "C" void ModuleInit() +extern "C" FILTER_OBJECT *GetModuleObject() { static modulecmd_arg_type_t show_argv[] = { { MODULECMD_ARG_OUTPUT, "The output dcb" }, { MODULECMD_ARG_FILTER, "Cache name" } }; - + modulecmd_register_command("cache", "show", cache_command_show, MXS_ARRAY_NELEMS(show_argv), show_argv); - + MXS_NOTICE("Initialized cache module %s.\n", VERSION_STRING); -} - -extern "C" FILTER_OBJECT *GetModuleObject() -{ return &CacheFilter::s_object; }; diff --git a/server/modules/filter/ccrfilter/ccrfilter.c b/server/modules/filter/ccrfilter/ccrfilter.c index 533c6173f..0786bc311 100644 --- a/server/modules/filter/ccrfilter/ccrfilter.c +++ b/server/modules/filter/ccrfilter/ccrfilter.c @@ -116,18 +116,6 @@ typedef struct time_t last_modification; /*< Time of the last data modifying operation */ } CCR_SESSION; -/** - * The module initialization routine, called when the module - * is first loaded. - * @see function load_module in load_utils.c for explanation of lint - */ -/*lint -e14 */ -void -ModuleInit() -{ -} -/*lint +e14 */ - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/filter/dbfwfilter/dbfwfilter.c b/server/modules/filter/dbfwfilter/dbfwfilter.c index 3430d9edb..f6d40b8a8 100644 --- a/server/modules/filter/dbfwfilter/dbfwfilter.c +++ b/server/modules/filter/dbfwfilter/dbfwfilter.c @@ -794,12 +794,14 @@ bool dbfw_show_rules(const MODULECMD_ARG *argv) } /** - * The module initialisation routine, called when the module - * is first loaded. - * @see function load_module in load_utils.c for explanation of lint + * The module entry point routine. It is this routine that + * must populate the structure that is referred to as the + * "module object", this is a structure with the set of + * external entry points for this module. + * + * @return The module object */ -/*lint -e14 */ -void ModuleInit() +FILTER_OBJECT * GetModuleObject() { modulecmd_arg_type_t args_rules_reload[] = { @@ -816,20 +818,6 @@ void ModuleInit() }; modulecmd_register_command("dbfwfilter", "rules", dbfw_show_rules, 2, args_rules_show); -} - -/*lint +e14 */ - -/** - * The module entry point routine. It is this routine that - * must populate the structure that is referred to as the - * "module object", this is a structure with the set of - * external entry points for this module. - * - * @return The module object - */ -FILTER_OBJECT * GetModuleObject() -{ return &MyObject; } diff --git a/server/modules/filter/hintfilter/hintfilter.c b/server/modules/filter/hintfilter/hintfilter.c index d76b319a2..d6fddb1d2 100644 --- a/server/modules/filter/hintfilter/hintfilter.c +++ b/server/modules/filter/hintfilter/hintfilter.c @@ -57,19 +57,6 @@ static FILTER_OBJECT MyObject = NULL, // No destroyInstance }; -/** - * The module initialization routine, called when the module - * is first loaded. - * @see function load_module in load_utils.c for explanation of lint - */ - -/*lint -e14 */ -void -ModuleInit() -{ -} -/*lint +e14 */ - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/filter/luafilter/luafilter.c b/server/modules/filter/luafilter/luafilter.c index 82526aba4..5322c2b9b 100644 --- a/server/modules/filter/luafilter/luafilter.c +++ b/server/modules/filter/luafilter/luafilter.c @@ -180,18 +180,6 @@ typedef struct UPSTREAM up; } LUA_SESSION; -/** - * The module initialisation routine, called when the module - * is first loaded. - * @see function load_module in load_utils.c for explanation of lint - */ -/*lint -e14 */ -void -ModuleInit() -{ -} -/*lint +e14 */ - /** * Create a new instance of the Lua filter. * diff --git a/server/modules/filter/masking/maskingfilter.cc b/server/modules/filter/masking/maskingfilter.cc index d35340cfb..524517a9c 100644 --- a/server/modules/filter/masking/maskingfilter.cc +++ b/server/modules/filter/masking/maskingfilter.cc @@ -27,13 +27,9 @@ MODULE_INFO info = "V1.0.0" }; -extern "C" void ModuleInit() -{ - MXS_NOTICE("Initialized masking module."); -} - extern "C" FILTER_OBJECT *GetModuleObject() { + MXS_NOTICE("Initialized masking module."); return &MaskingFilter::s_object; } diff --git a/server/modules/filter/maxrows/maxrows.c b/server/modules/filter/maxrows/maxrows.c index 2a31dba35..46384b399 100644 --- a/server/modules/filter/maxrows/maxrows.c +++ b/server/modules/filter/maxrows/maxrows.c @@ -68,14 +68,6 @@ MODULE_INFO info = "V1.0.0" }; -/** - * The module initialization functions, called when the module has - * been loaded. - */ -void ModuleInit() -{ -} - /** * The module entry point function, called when the module is loaded. * diff --git a/server/modules/filter/mqfilter/mqfilter.c b/server/modules/filter/mqfilter/mqfilter.c index f889e9916..740159dcc 100644 --- a/server/modules/filter/mqfilter/mqfilter.c +++ b/server/modules/filter/mqfilter/mqfilter.c @@ -262,18 +262,6 @@ typedef struct void sendMessage(void* data); -/** - * The module initialisation routine, called when the module - * is first loaded. - * @see function load_module in load_utils.c for explanation of lint - */ -/*lint -e14 */ -void -ModuleInit() -{ -} -/*lint +e14 */ - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/filter/namedserverfilter/namedserverfilter.c b/server/modules/filter/namedserverfilter/namedserverfilter.c index cd9cc1aa5..afe1bb2ca 100644 --- a/server/modules/filter/namedserverfilter/namedserverfilter.c +++ b/server/modules/filter/namedserverfilter/namedserverfilter.c @@ -97,18 +97,6 @@ typedef struct int active; /* Is filter active */ } REGEXHINT_SESSION; -/** - * The module initialisation routine, called when the module - * is first loaded. - * @see function load_module in load_utils.c for explanation of lint - */ -/*lint -e14 */ -void -ModuleInit() -{ -} -/*lint +e14 */ - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/filter/qlafilter/qlafilter.c b/server/modules/filter/qlafilter/qlafilter.c index 8d82aefc0..bc10b7e24 100644 --- a/server/modules/filter/qlafilter/qlafilter.c +++ b/server/modules/filter/qlafilter/qlafilter.c @@ -156,18 +156,6 @@ static FILE* open_log_file(uint32_t, QLA_INSTANCE *, const char *); static int write_log_entry(uint32_t, FILE*, QLA_INSTANCE*, QLA_SESSION*, const char*, const char*, size_t); -/** - * The module initialisation routine, called when the module - * is first loaded. - * @see function load_module in load_utils.c for explanation of lint - */ -/*lint -e14 */ -void -ModuleInit() -{ -} -/*lint +e14 */ - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/filter/regexfilter/regexfilter.c b/server/modules/filter/regexfilter/regexfilter.c index 7ecad7a17..e021b523f 100644 --- a/server/modules/filter/regexfilter/regexfilter.c +++ b/server/modules/filter/regexfilter/regexfilter.c @@ -106,18 +106,6 @@ typedef struct void log_match(REGEX_INSTANCE* inst, char* re, char* old, char* new); void log_nomatch(REGEX_INSTANCE* inst, char* re, char* old); -/** - * The module initialisation routine, called when the module - * is first loaded. - * @see function load_module in load_utils.c for explanation of lint - */ -/*lint -e14 */ -void -ModuleInit() -{ -} -/*lint +e14 */ - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/filter/tee/tee.c b/server/modules/filter/tee/tee.c index 1fc787864..c0246f097 100644 --- a/server/modules/filter/tee/tee.c +++ b/server/modules/filter/tee/tee.c @@ -305,22 +305,6 @@ orphan_free(void* data) #endif } -/** - * The module initialisation routine, called when the module - * is first loaded. - * @see function load_module in load_utils.c for explanation of lint - */ -/*lint -e14 */ -void -ModuleInit() -{ - spinlock_init(&orphanLock); -#ifdef SS_DEBUG - spinlock_init(&debug_lock); -#endif -} -/*lint +e14 */ - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -332,6 +316,10 @@ ModuleInit() FILTER_OBJECT * GetModuleObject() { + spinlock_init(&orphanLock); +#ifdef SS_DEBUG + spinlock_init(&debug_lock); +#endif return &MyObject; } diff --git a/server/modules/filter/testfilter/testfilter.c b/server/modules/filter/testfilter/testfilter.c index 14a58d285..cc0d723d4 100644 --- a/server/modules/filter/testfilter/testfilter.c +++ b/server/modules/filter/testfilter/testfilter.c @@ -82,18 +82,6 @@ typedef struct int count; } TEST_SESSION; -/** - * The module initialisation routine, called when the module - * is first loaded. - * @see function load_module in load_utils.c for explanation of lint - */ -/*lint -e14 */ -void -ModuleInit() -{ -} -/*lint +e14 */ - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/filter/topfilter/topfilter.c b/server/modules/filter/topfilter/topfilter.c index 346a2911f..53fb057f7 100644 --- a/server/modules/filter/topfilter/topfilter.c +++ b/server/modules/filter/topfilter/topfilter.c @@ -140,18 +140,6 @@ typedef struct struct timeval disconnect; } TOPN_SESSION; -/** - * The module initialisation routine, called when the module - * is first loaded. - * @see function load_module in load_utils.c for explanation of lint - */ -/*lint -e14 */ -void -ModuleInit() -{ -} -/*lint +e14 */ - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/filter/tpmfilter/tpmfilter.c b/server/modules/filter/tpmfilter/tpmfilter.c index ba7e36aca..f1fdd9f41 100644 --- a/server/modules/filter/tpmfilter/tpmfilter.c +++ b/server/modules/filter/tpmfilter/tpmfilter.c @@ -158,15 +158,6 @@ typedef struct size_t max_sql_size; } TPM_SESSION; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void -ModuleInit() -{ -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/monitor/auroramon/auroramon.c b/server/modules/monitor/auroramon/auroramon.c index 87d30720b..456909b82 100644 --- a/server/modules/monitor/auroramon/auroramon.c +++ b/server/modules/monitor/auroramon/auroramon.c @@ -41,16 +41,6 @@ typedef struct aurora_monitor bool events[MAX_MONITOR_EVENT]; /**< Enabled monitor events */ } AURORA_MONITOR; -/** - * The module initialisation routine, called when the module is first loaded. - */ -/*lint -e14 */ -void -ModuleInit() -{ -} -/*lint +e14 */ - /** * @brief Update the status of a server * diff --git a/server/modules/monitor/mmmon/mmmon.c b/server/modules/monitor/mmmon/mmmon.c index 6b6ac0d2f..39f0e13a9 100644 --- a/server/modules/monitor/mmmon/mmmon.c +++ b/server/modules/monitor/mmmon/mmmon.c @@ -59,16 +59,6 @@ static MONITOR_OBJECT MyObject = diagnostics }; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void -ModuleInit() -{ - MXS_NOTICE("Initialise the Multi-Master Monitor module."); -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -80,6 +70,7 @@ ModuleInit() MONITOR_OBJECT * GetModuleObject() { + MXS_NOTICE("Initialise the Multi-Master Monitor module."); return &MyObject; } /*lint +e14 */ diff --git a/server/modules/monitor/mysqlmon/mysql_mon.c b/server/modules/monitor/mysqlmon/mysql_mon.c index bd77e0a90..053f17b63 100644 --- a/server/modules/monitor/mysqlmon/mysql_mon.c +++ b/server/modules/monitor/mysqlmon/mysql_mon.c @@ -107,16 +107,6 @@ static MONITOR_OBJECT MyObject = diagnostics }; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void -ModuleInit() -{ - MXS_NOTICE("Initialise the MySQL Monitor module."); -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -128,6 +118,7 @@ ModuleInit() MONITOR_OBJECT * GetModuleObject() { + MXS_NOTICE("Initialise the MySQL Monitor module."); return &MyObject; } diff --git a/server/modules/monitor/ndbclustermon/ndbclustermon.c b/server/modules/monitor/ndbclustermon/ndbclustermon.c index a3921f773..ff15bde47 100644 --- a/server/modules/monitor/ndbclustermon/ndbclustermon.c +++ b/server/modules/monitor/ndbclustermon/ndbclustermon.c @@ -57,16 +57,6 @@ static MONITOR_OBJECT MyObject = diagnostics }; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void -ModuleInit() -{ - MXS_NOTICE("Initialise the MySQL Cluster Monitor module."); -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -78,6 +68,7 @@ ModuleInit() MONITOR_OBJECT * GetModuleObject() { + MXS_NOTICE("Initialise the MySQL Cluster Monitor module."); return &MyObject; } /*lint +e14 */ diff --git a/server/modules/protocol/CDC/cdc.c b/server/modules/protocol/CDC/cdc.c index 96a5491db..f9f0143b8 100644 --- a/server/modules/protocol/CDC/cdc.c +++ b/server/modules/protocol/CDC/cdc.c @@ -88,15 +88,6 @@ static GWPROTOCOL MyObject = cdc_default_auth /* default authentication */ }; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void -ModuleInit() -{ -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/protocol/HTTPD/httpd.c b/server/modules/protocol/HTTPD/httpd.c index 0d5aa11e6..eb8c16ca3 100644 --- a/server/modules/protocol/HTTPD/httpd.c +++ b/server/modules/protocol/HTTPD/httpd.c @@ -89,14 +89,6 @@ static GWPROTOCOL MyObject = NULL /**< Connection limit reached */ }; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c index 1cdbb968c..3380d53b0 100644 --- a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c @@ -112,14 +112,6 @@ static GWPROTOCOL MyObject = NULL /* Connection limit reached */ }; -/* - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ -} - /* * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c index cb27eea32..9d04e9da6 100644 --- a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c +++ b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c @@ -114,14 +114,6 @@ static GWPROTOCOL MyObject = gw_connection_limit /* Send error connection limit */ }; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/protocol/maxscaled/maxscaled.c b/server/modules/protocol/maxscaled/maxscaled.c index 0860cb116..80a2c1069 100644 --- a/server/modules/protocol/maxscaled/maxscaled.c +++ b/server/modules/protocol/maxscaled/maxscaled.c @@ -191,15 +191,6 @@ static GWPROTOCOL MyObject = NULL /**< Connection limit reached */ }; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ - MXS_INFO("Initialise MaxScaled Protocol module.");; -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -210,6 +201,7 @@ void ModuleInit() */ GWPROTOCOL* GetModuleObject() { + MXS_INFO("Initialise MaxScaled Protocol module."); return &MyObject; } /*lint +e14 */ diff --git a/server/modules/protocol/telnetd/telnetd.c b/server/modules/protocol/telnetd/telnetd.c index eac1938ef..3824a4726 100644 --- a/server/modules/protocol/telnetd/telnetd.c +++ b/server/modules/protocol/telnetd/telnetd.c @@ -102,15 +102,6 @@ static GWPROTOCOL MyObject = static void telnetd_command(DCB *, unsigned char *cmd); static void telnetd_echo(DCB *dcb, int enable); -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ - MXS_INFO("Initialise Telnetd Protocol module."); -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -121,6 +112,7 @@ void ModuleInit() */ GWPROTOCOL* GetModuleObject() { + MXS_INFO("Initialise Telnetd Protocol module."); return &MyObject; } /*lint +e14 */ diff --git a/server/modules/protocol/testprotocol/testprotocol.c b/server/modules/protocol/testprotocol/testprotocol.c index e0f9f95a3..22eb5bc6d 100644 --- a/server/modules/protocol/testprotocol/testprotocol.c +++ b/server/modules/protocol/testprotocol/testprotocol.c @@ -77,14 +77,6 @@ static GWPROTOCOL MyObject = test_connection_limit /**< Connection limit */ }; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the diff --git a/server/modules/routing/debugcli/debugcli.c b/server/modules/routing/debugcli/debugcli.c index 6189e4516..c8f50e621 100644 --- a/server/modules/routing/debugcli/debugcli.c +++ b/server/modules/routing/debugcli/debugcli.c @@ -78,18 +78,6 @@ extern int execute_cmd(CLI_SESSION *cli); static SPINLOCK instlock; static CLI_INSTANCE *instances; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void -ModuleInit() -{ - MXS_NOTICE("Initialise debug CLI router module."); - spinlock_init(&instlock); - instances = NULL; -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -101,6 +89,9 @@ ModuleInit() ROUTER_OBJECT * GetModuleObject() { + MXS_NOTICE("Initialise debug CLI router module."); + spinlock_init(&instlock); + instances = NULL; return &MyObject; } diff --git a/server/modules/routing/maxinfo/maxinfo.c b/server/modules/routing/maxinfo/maxinfo.c index 9f7650add..e96c6d9dd 100644 --- a/server/modules/routing/maxinfo/maxinfo.c +++ b/server/modules/routing/maxinfo/maxinfo.c @@ -102,18 +102,6 @@ static ROUTER_OBJECT MyObject = static SPINLOCK instlock; static INFO_INSTANCE *instances; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void -ModuleInit() -{ - MXS_NOTICE("Initialise MaxInfo router module."); - spinlock_init(&instlock); - instances = NULL; -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -125,6 +113,9 @@ ModuleInit() ROUTER_OBJECT * GetModuleObject() { + MXS_NOTICE("Initialise MaxInfo router module."); + spinlock_init(&instlock); + instances = NULL; return &MyObject; } diff --git a/server/modules/routing/readconnroute/readconnroute.c b/server/modules/routing/readconnroute/readconnroute.c index fa89272e4..e7c18e0b6 100644 --- a/server/modules/routing/readconnroute/readconnroute.c +++ b/server/modules/routing/readconnroute/readconnroute.c @@ -137,18 +137,6 @@ static int handle_state_switch(DCB* dcb, DCB_REASON reason, void * routersession static SPINLOCK instlock; static ROUTER_INSTANCE *instances; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void -ModuleInit() -{ - MXS_NOTICE("Initialise readconnroute router module."); - spinlock_init(&instlock); - instances = NULL; -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -160,6 +148,9 @@ ModuleInit() ROUTER_OBJECT * GetModuleObject() { + MXS_NOTICE("Initialise readconnroute router module."); + spinlock_init(&instlock); + instances = NULL; return &MyObject; } diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index 89ce1a017..095ec5528 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -126,15 +126,6 @@ static bool have_enough_servers(ROUTER_CLIENT_SES *rses, const int min_nsrv, int router_nsrv, ROUTER_INSTANCE *router); static bool create_backends(ROUTER_CLIENT_SES *rses, backend_ref_t** dest, int* n_backend); -/** - * The module initialization routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ - MXS_NOTICE("Initializing statement-based read/write split router module."); -} - /** * The module entry point routine. It is this routine that * must return the structure that is referred to as the @@ -145,6 +136,7 @@ void ModuleInit() */ ROUTER_OBJECT *GetModuleObject() { + MXS_NOTICE("Initializing statement-based read/write split router module."); return &MyObject; } diff --git a/server/modules/routing/schemarouter/schemarouter.c b/server/modules/routing/schemarouter/schemarouter.c index 81c31e7b3..139a6a4ae 100644 --- a/server/modules/routing/schemarouter/schemarouter.c +++ b/server/modules/routing/schemarouter/schemarouter.c @@ -607,17 +607,6 @@ bool check_shard_status(ROUTER_INSTANCE* router, char* shard) return false; } -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void ModuleInit() -{ - MXS_NOTICE("Initializing Schema Sharding Router."); - spinlock_init(&instlock); - instances = NULL; -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the @@ -628,6 +617,9 @@ void ModuleInit() */ ROUTER_OBJECT* GetModuleObject() { + MXS_NOTICE("Initializing Schema Sharding Router."); + spinlock_init(&instlock); + instances = NULL; return &MyObject; } diff --git a/server/modules/routing/testroute/testroute.c b/server/modules/routing/testroute/testroute.c index 8d77ed53f..25bad19c7 100644 --- a/server/modules/routing/testroute/testroute.c +++ b/server/modules/routing/testroute/testroute.c @@ -61,16 +61,6 @@ typedef struct { } TESTSESSION; -/** - * The module initialisation routine, called when the module - * is first loaded. - */ -void -ModuleInit() -{ - -} - /** * The module entry point routine. It is this routine that * must populate the structure that is referred to as the