1
/* Copyright (C) 2005 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
22
the following flags are valid for plugin_init()
24
#define PLUGIN_INIT_SKIP_DYNAMIC_LOADING 1
25
#define PLUGIN_INIT_SKIP_PLUGIN_TABLE 2
26
#define PLUGIN_INIT_SKIP_INITIALIZATION 4
28
#define INITIAL_LEX_PLUGIN_LIST_SIZE 16
31
the following #define adds server-only members to enum_mysql_show_type,
32
that is defined in plugin.h
34
#define SHOW_FUNC SHOW_FUNC, SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_LONGLONG, \
35
SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, SHOW_HAVE, \
36
SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, SHOW_LONG_NOFLUSH, \
38
#include <drizzled/plugin.h>
40
typedef enum enum_mysql_show_type SHOW_TYPE;
41
typedef struct st_mysql_show_var SHOW_VAR;
43
#define MYSQL_ANY_PLUGIN -1
46
different values of st_plugin_int::state
47
though they look like a bitmap, plugin may only
48
be in one of those eigenstates, not in a superposition of them :)
49
It's a bitmap, because it makes it easier to test
50
"whether the state is one of those..."
52
#define PLUGIN_IS_FREED 1
53
#define PLUGIN_IS_DELETED 2
54
#define PLUGIN_IS_UNINITIALIZED 4
55
#define PLUGIN_IS_READY 8
56
#define PLUGIN_IS_DYING 16
58
/* A handle for the dynamic library containing a plugin or plugins. */
64
struct st_mysql_plugin *plugins;
65
uint ref_count; /* number of plugins loaded from the library */
68
/* A handle of a plugin */
73
struct st_mysql_plugin *plugin;
74
struct st_plugin_dl *plugin_dl;
76
uint ref_count; /* number of threads using the plugin */
77
void *data; /* plugin type specific, e.g. handlerton */
78
MEM_ROOT mem_root; /* memory for dynamic plugin structures */
79
sys_var *system_vars; /* server variables for this plugin */
84
See intern_plugin_lock() for the explanation for the
85
conditionally defined plugin_ref type
87
typedef struct st_plugin_int **plugin_ref;
88
#define plugin_decl(pi) ((pi)[0]->plugin)
89
#define plugin_dlib(pi) ((pi)[0]->plugin_dl)
90
#define plugin_data(pi,cast) ((cast)((pi)[0]->data))
91
#define plugin_name(pi) (&((pi)[0]->name))
92
#define plugin_state(pi) ((pi)[0]->state)
93
#define plugin_equals(p1,p2) ((p1) && (p2) && (p1)[0] == (p2)[0])
95
typedef int (*plugin_type_init)(struct st_plugin_int *);
97
extern char *opt_plugin_load;
98
extern char *opt_plugin_dir_ptr;
99
extern char opt_plugin_dir[FN_REFLEN];
100
extern const LEX_STRING plugin_type_names[];
102
extern int plugin_init(int *argc, char **argv, int init_flags);
103
extern void plugin_shutdown(void);
104
extern void my_print_help_inc_plugins(struct my_option *options, uint size);
105
extern bool plugin_is_ready(const LEX_STRING *name, int type);
106
#define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C CALLER_INFO)
107
#define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C ORIG_CALLER_INFO)
108
#define my_plugin_lock(A,B) plugin_lock(A,B CALLER_INFO)
109
#define my_plugin_lock_ci(A,B) plugin_lock(A,B ORIG_CALLER_INFO)
110
extern plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO);
111
extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name,
112
int type CALLER_INFO_PROTO);
113
extern void plugin_unlock(THD *thd, plugin_ref plugin);
114
extern void plugin_unlock_list(THD *thd, plugin_ref *list, uint count);
115
extern bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
116
const LEX_STRING *dl);
117
extern bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name);
118
extern bool plugin_register_builtin(struct st_mysql_plugin *plugin);
119
extern void plugin_thdvar_init(THD *thd);
120
extern void plugin_thdvar_cleanup(THD *thd);
122
typedef bool (plugin_foreach_func)(THD *thd,
125
#define plugin_foreach(A,B,C,D) plugin_foreach_with_mask(A,B,C,PLUGIN_IS_READY,D)
126
extern bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func,
127
int type, uint state_mask, void *arg);