Move module object inside MODULE_INFO

This allows modules to only expose one entry point with a consistent
signature. In the future, this could be used to implement declarations of
module parameters.
This commit is contained in:
Markus Mäkelä
2017-01-03 14:04:20 +02:00
parent 6c53999c97
commit ae0577c695
53 changed files with 1346 additions and 1483 deletions

View File

@ -22,17 +22,6 @@
#include <maxscale/alloc.h>
#include <maxscale/debug.h>
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_MONITOR,
MODULE_BETA_RELEASE,
MONITOR_VERSION,
"Aurora monitor",
"V1.0.0"
};
/*lint +e14 */
typedef struct aurora_monitor
{
bool shutdown; /**< True if the monitor is stopped */
@ -348,13 +337,6 @@ diagnostics(DCB *dcb, const MONITOR *mon)
{
}
static MONITOR_OBJECT MyObject =
{
startMonitor,
stopMonitor,
diagnostics
};
/**
* 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
@ -362,9 +344,24 @@ static MONITOR_OBJECT MyObject =
*
* @return The module object
*/
MONITOR_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static MONITOR_OBJECT MyObject =
{
startMonitor,
stopMonitor,
diagnostics
};
static MODULE_INFO info =
{
MODULE_API_MONITOR,
MODULE_BETA_RELEASE,
MONITOR_VERSION,
"Aurora monitor",
"V1.0.0",
&MyObject
};
return &info;
}
/*lint +e14 */