1
#include <drizzled/server_includes.h>
2
#include <drizzled/configvar.h>
4
int configvar_initializer(st_plugin_int *plugin)
8
p= (configvar_t *) malloc(sizeof(configvar_t));
9
if (p == NULL) return 1;
10
memset(p, 0, sizeof(configvar_t));
12
plugin->data= (void *)p;
14
if (plugin->plugin->init)
16
if (plugin->plugin->init((void *)p))
18
sql_print_error("Configvar plugin '%s' init() failed",
30
int configvar_finalizer(st_plugin_int *plugin)
32
configvar_t *p= (configvar_t *) plugin->data;
34
if (plugin->plugin->deinit)
36
if (plugin->plugin->deinit((void *)p))
38
sql_print_error("Configvar plugin '%s' deinit() failed",
48
/* The plugin_foreach() iterator requires that we
49
convert all the parameters of a plugin api entry point
50
into just one single void ptr, plus the thd.
51
So we will take all the additional paramters of configvar_do1,
52
and marshall them into a struct of this type, and
53
then just pass in a pointer to it.
55
typedef struct configvar_do1_parms_st
59
} configvar_do1_parms_t;
61
/* This gets called by plugin_foreach once for each loaded configvar plugin */
62
static bool configvar_do1_iterate (THD *thd, plugin_ref plugin, void *p)
64
configvar_t *l= plugin_data(plugin, configvar_t *);
65
configvar_do1_parms_t *parms= (configvar_do1_parms_t *) p;
67
/* call this loaded configvar plugin's configvar_func1 function pointer */
68
if (l && l->configvar_func1)
70
if (l->configvar_func1(thd, parms->parm1, parms->parm2))
72
sql_print_error("Configvar plugin '%s' do1() failed",
80
/* This is the configvar_do1 entry point.
81
This gets called by the rest of the Drizzle server code */
82
bool configvar_do1 (THD *thd, void *parm1, void *parm2)
84
configvar_do1_parms_t parms;
87
/* marshall the parameters so they will fit into the foreach */
91
/* call configvar_do1_iterate
92
once for each loaded configvar plugin */
93
foreach_rv= plugin_foreach(thd,
94
configvar_do1_iterate,
95
DRIZZLE_CONFIGVAR_PLUGIN,
100
/* The plugin_foreach() iterator requires that we
101
convert all the parameters of a plugin api entry point
102
into just one single void ptr, plus the thd.
103
So we will take all the additional paramters of configvar_do2,
104
and marshall them into a struct of this type, and
105
then just pass in a pointer to it.
107
typedef struct configvar_do2_parms_st
111
} configvar_do2_parms_t;
113
/* This gets called by plugin_foreach once for each loaded configvar plugin */
114
static bool configvar_do2_iterate (THD *thd, plugin_ref plugin, void *p)
116
configvar_t *l= plugin_data(plugin, configvar_t *);
117
configvar_do2_parms_t *parms= (configvar_do2_parms_t *) p;
119
/* call this loaded configvar plugin's configvar_func1 function pointer */
120
if (l && l->configvar_func1)
122
if (l->configvar_func1(thd, parms->parm3, parms->parm4))
124
sql_print_error("Configvar plugin '%s' do2() failed",
132
/* This is the configvar_do2 entry point.
133
This gets called by the rest of the Drizzle server code */
134
bool configvar_do2 (THD *thd, void *parm3, void *parm4)
136
configvar_do2_parms_t parms;
139
/* marshall the parameters so they will fit into the foreach */
143
/* call configvar_do2_iterate
144
once for each loaded configvar plugin */
145
foreach_rv= plugin_foreach(thd,
146
configvar_do2_iterate,
147
DRIZZLE_CONFIGVAR_PLUGIN,