Move version entry point into MODULE_INFO

The MODULE_INFO can easily hold the version information of the
module. This removes the need for a explicit version entry point.
This commit is contained in:
Markus Mäkelä
2017-01-03 11:48:55 +02:00
parent d3907882d6
commit 7df29aa1ec
49 changed files with 127 additions and 700 deletions

View File

@ -41,16 +41,15 @@
#include <maxscale/log_manager.h>
MODULE_INFO info =
MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_GA,
ROUTER_VERSION,
"The admin user interface"
"The admin user interface",
"V1.0.0"
};
static char *version_str = "V1.0.0";
/* The router entry points */
static ROUTER *createInstance(SERVICE *service, char **options);
static void *newSession(ROUTER *instance, SESSION *session);
@ -80,17 +79,6 @@ extern int execute_cmd(CLI_SESSION *cli);
static SPINLOCK instlock;
static CLI_INSTANCE *instances;
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*/
char *
version()
{
return version_str;
}
/**
* The module initialisation routine, called when the module
* is first loaded.
@ -98,7 +86,7 @@ version()
void
ModuleInit()
{
MXS_NOTICE("Initialise CLI router module %s.", version_str);
MXS_NOTICE("Initialise CLI router module");
spinlock_init(&instlock);
instances = NULL;
}

View File

@ -45,11 +45,10 @@ MODULE_INFO info =
MODULE_API_ROUTER,
MODULE_GA,
ROUTER_VERSION,
"The debug user interface"
"The debug user interface",
"V1.1.1"
};
static char *version_str = "V1.1.1";
/* The router entry points */
static ROUTER *createInstance(SERVICE *service, char **options);
static void *newSession(ROUTER *instance, SESSION *session);
@ -79,17 +78,6 @@ extern int execute_cmd(CLI_SESSION *cli);
static SPINLOCK instlock;
static CLI_INSTANCE *instances;
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*/
char *
version()
{
return version_str;
}
/**
* The module initialisation routine, called when the module
* is first loaded.
@ -97,7 +85,7 @@ version()
void
ModuleInit()
{
MXS_NOTICE("Initialise debug CLI router module %s.", version_str);
MXS_NOTICE("Initialise debug CLI router module.");
spinlock_init(&instlock);
instances = NULL;
}
@ -181,8 +169,7 @@ newSession(ROUTER *instance, SESSION *session)
session->state = SESSION_STATE_READY;
dcb_printf(session->client_dcb, "Welcome to the MariaDB Corporation MaxScale Debug Interface (%s).\n",
version_str);
dcb_printf(session->client_dcb, "Welcome to the MariaDB Corporation MaxScale Debug Interface.\n");
dcb_printf(session->client_dcb, "Type help for a list of available commands.\n\n");
return (void *)client;

View File

@ -57,13 +57,12 @@ MODULE_INFO info =
MODULE_API_ROUTER,
MODULE_ALPHA_RELEASE,
ROUTER_VERSION,
"The MaxScale Information Schema"
"The MaxScale Information Schema",
"V1.0.0"
};
extern char *create_hex_sha1_sha1_passwd(char *passwd);
static char *version_str = "V1.0.0";
static int maxinfo_statistics(INFO_INSTANCE *, INFO_SESSION *, GWBUF *);
static int maxinfo_ping(INFO_INSTANCE *, INFO_SESSION *, GWBUF *);
static int maxinfo_execute_query(INFO_INSTANCE *, INFO_SESSION *, char *);
@ -103,17 +102,6 @@ static ROUTER_OBJECT MyObject =
static SPINLOCK instlock;
static INFO_INSTANCE *instances;
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*/
char *
version()
{
return version_str;
}
/**
* The module initialisation routine, called when the module
* is first loaded.
@ -121,7 +109,7 @@ version()
void
ModuleInit()
{
MXS_NOTICE("Initialise MaxInfo router module %s.", version_str);
MXS_NOTICE("Initialise MaxInfo router module.");
spinlock_init(&instlock);
instances = NULL;
}

View File

@ -95,11 +95,10 @@ MODULE_INFO info =
MODULE_API_ROUTER,
MODULE_GA,
ROUTER_VERSION,
"A connection based router to load balance based on connections"
"A connection based router to load balance based on connections",
"V1.1.0"
};
static char *version_str = "V1.1.0";
/* The router entry points */
static ROUTER *createInstance(SERVICE *service, char **options);
static void *newSession(ROUTER *instance, SESSION *session);
@ -138,17 +137,6 @@ static int handle_state_switch(DCB* dcb, DCB_REASON reason, void * routersession
static SPINLOCK instlock;
static ROUTER_INSTANCE *instances;
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*/
char *
version()
{
return version_str;
}
/**
* The module initialisation routine, called when the module
* is first loaded.
@ -156,7 +144,7 @@ version()
void
ModuleInit()
{
MXS_NOTICE("Initialise readconnroute router module %s.", version_str);
MXS_NOTICE("Initialise readconnroute router module.");
spinlock_init(&instlock);
instances = NULL;
}

View File

@ -31,7 +31,8 @@
MODULE_INFO info =
{
MODULE_API_ROUTER, MODULE_GA, ROUTER_VERSION,
"A Read/Write splitting router for enhancement read scalability"
"A Read/Write splitting router for enhancement read scalability",
"V1.1.0"
};
/**
@ -68,8 +69,6 @@ MODULE_INFO info =
/** Maximum number of slaves */
#define MAX_SLAVE_COUNT 255
static char *version_str = "V1.1.0";
/*
* The functions that implement the router module API
*/
@ -126,15 +125,6 @@ static bool handle_error_new_connection(ROUTER_INSTANCE *inst,
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);
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*/
char *version()
{
return version_str;
}
/**
* The module initialization routine, called when the module

View File

@ -45,7 +45,8 @@ MODULE_INFO info =
MODULE_API_ROUTER,
MODULE_BETA_RELEASE,
ROUTER_VERSION,
"A database sharding router for simple sharding"
"A database sharding router for simple sharding",
"V1.0.0"
};
@ -64,8 +65,6 @@ MODULE_INFO info =
* @endverbatim
*/
static char *version_str = "V1.0.0";
static ROUTER* createInstance(SERVICE *service, char **options);
static void* newSession(ROUTER *instance, SESSION *session);
static void closeSession(ROUTER *instance, void *session);
@ -608,16 +607,6 @@ bool check_shard_status(ROUTER_INSTANCE* router, char* shard)
return false;
}
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*/
char* version()
{
return version_str;
}
/**
* The module initialisation routine, called when the module
* is first loaded.

View File

@ -15,14 +15,13 @@
#include <maxscale/router.h>
#include <maxscale/modinfo.h>
static char *version_str = "V1.0.0";
MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_IN_DEVELOPMENT,
ROUTER_VERSION,
"A test router - not for use in real systems"
"A test router - not for use in real systems",
"V1.0.0"
};
static ROUTER *createInstance(SERVICE *service, char **options);
@ -62,17 +61,6 @@ typedef struct
{
} TESTSESSION;
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*/
char *
version()
{
return version_str;
}
/**
* The module initialisation routine, called when the module
* is first loaded.