diff options
Diffstat (limited to 'sql/sql_plugin.h')
-rw-r--r-- | sql/sql_plugin.h | 69 |
1 files changed, 60 insertions, 9 deletions
diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index d86d9332a92..70ce21a64da 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -16,6 +16,17 @@ #ifndef _sql_plugin_h #define _sql_plugin_h +class sys_var; + +/* + the following flags are valid for plugin_init() +*/ +#define PLUGIN_INIT_SKIP_DYNAMIC_LOADING 1 +#define PLUGIN_INIT_SKIP_PLUGIN_TABLE 2 +#define PLUGIN_INIT_SKIP_INITIALIZATION 4 + +#define INITIAL_LEX_PLUGIN_LIST_SIZE 16 + /* the following #define adds server-only members to enum_mysql_show_type, that is defined in plugin.h @@ -41,6 +52,7 @@ typedef struct st_mysql_show_var SHOW_VAR; #define PLUGIN_IS_DELETED 2 #define PLUGIN_IS_UNINITIALIZED 4 #define PLUGIN_IS_READY 8 +#define PLUGIN_IS_DYING 16 /* A handle for the dynamic library containing a plugin or plugins. */ @@ -63,25 +75,64 @@ struct st_plugin_int uint state; uint ref_count; /* number of threads using the plugin */ void *data; /* plugin type specific, e.g. handlerton */ + MEM_ROOT mem_root; /* memory for dynamic plugin structures */ + sys_var *system_vars; /* server variables for this plugin */ }; + +/* + See intern_plugin_lock() for the explanation for the + conditionally defined plugin_ref type +*/ +#ifdef DBUG_OFF +typedef struct st_plugin_int *plugin_ref; +#define plugin_decl(pi) ((pi)->plugin) +#define plugin_dlib(pi) ((pi)->plugin_dl) +#define plugin_data(pi,cast) ((cast)((pi)->data)) +#define plugin_name(pi) (&((pi)->name)) +#define plugin_state(pi) ((pi)->state) +#define plugin_equals(p1,p2) ((p1) == (p2)) +#else +typedef struct st_plugin_int **plugin_ref; +#define plugin_decl(pi) ((pi)[0]->plugin) +#define plugin_dlib(pi) ((pi)[0]->plugin_dl) +#define plugin_data(pi,cast) ((cast)((pi)[0]->data)) +#define plugin_name(pi) (&((pi)[0]->name)) +#define plugin_state(pi) ((pi)[0]->state) +#define plugin_equals(p1,p2) ((p1) && (p2) && (p1)[0] == (p2)[0]) +#endif + typedef int (*plugin_type_init)(struct st_plugin_int *); +extern char *opt_plugin_load; extern char *opt_plugin_dir_ptr; extern char opt_plugin_dir[FN_REFLEN]; extern const LEX_STRING plugin_type_names[]; -extern int plugin_init(int); + +extern int plugin_init(int *argc, char **argv, int init_flags); extern void plugin_shutdown(void); -extern my_bool plugin_is_ready(const LEX_STRING *name, int type); -extern st_plugin_int *plugin_lock(const LEX_STRING *name, int type); -extern void plugin_unlock(struct st_plugin_int *plugin); -extern my_bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl); -extern my_bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name); +extern void my_print_help_inc_plugins(struct my_option *options, uint size); +extern bool plugin_is_ready(const LEX_STRING *name, int type); +#define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C CALLER_INFO) +#define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C ORIG_CALLER_INFO) +#define my_plugin_lock(A,B) plugin_lock(A,B CALLER_INFO) +#define my_plugin_lock_ci(A,B) plugin_lock(A,B ORIG_CALLER_INFO) +extern plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO); +extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, + int type CALLER_INFO_PROTO); +extern void plugin_unlock(THD *thd, plugin_ref plugin); +extern void plugin_unlock_list(THD *thd, plugin_ref *list, uint count); +extern bool mysql_install_plugin(THD *thd, const LEX_STRING *name, + const LEX_STRING *dl); +extern bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name); +extern bool plugin_register_builtin(struct st_mysql_plugin *plugin); +extern void plugin_thdvar_init(THD *thd); +extern void plugin_thdvar_cleanup(THD *thd); typedef my_bool (plugin_foreach_func)(THD *thd, - st_plugin_int *plugin, + plugin_ref plugin, void *arg); #define plugin_foreach(A,B,C,D) plugin_foreach_with_mask(A,B,C,PLUGIN_IS_READY,D) -extern my_bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, - int type, uint state_mask, void *arg); +extern bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, + int type, uint state_mask, void *arg); #endif |