~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_plugin.h

  • Committer: Brian Aker
  • Date: 2009-03-27 00:14:08 UTC
  • mto: This revision was merged to the branch mainline in revision 967.
  • Revision ID: brian@tangent.org-20090327001408-n6uxtfiymazy1pgf
Refactor plugin loading to remove mask (one step closer to getting rid of
malloc!)

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
 
67
67
#define DRIZZLE_ANY_PLUGIN         -1
68
68
 
69
 
/*
70
 
  different values of st_plugin_int::state
71
 
  though they look like a bitmap, plugin may only
72
 
  be in one of those eigenstates, not in a superposition of them :)
73
 
  It's a bitmap, because it makes it easier to test
74
 
  "whether the state is one of those..."
75
 
*/
76
 
#define PLUGIN_IS_FREED         1
77
 
#define PLUGIN_IS_DELETED       2
78
 
#define PLUGIN_IS_UNINITIALIZED 4
79
 
#define PLUGIN_IS_READY         8
80
 
#define PLUGIN_IS_DYING         16
81
 
 
82
69
/* A handle for the dynamic library containing a plugin or plugins. */
83
70
 
84
71
struct st_plugin_dl
95
82
  LEX_STRING name;
96
83
  struct st_mysql_plugin *plugin;
97
84
  struct st_plugin_dl *plugin_dl;
98
 
  uint32_t state;
 
85
  uint32_t isInited;
99
86
  uint32_t ref_count;               /* number of threads using the plugin */
100
87
  void *data;                   /* plugin type specific, e.g. StorageEngine */
101
88
  MEM_ROOT mem_root;            /* memory for dynamic plugin structures */
112
99
#define plugin_dlib(pi) ((pi)[0]->plugin_dl)
113
100
#define plugin_data(pi,cast) (static_cast<cast>((pi)[0]->data))
114
101
#define plugin_name(pi) (&((pi)[0]->name))
115
 
#define plugin_state(pi) ((pi)[0]->state)
116
102
#define plugin_equals(p1,p2) ((p1) && (p2) && (p1)[0] == (p2)[0])
117
103
 
118
104
typedef int (*plugin_type_init)(struct st_plugin_int *);
136
122
extern void plugin_sessionvar_init(Session *session);
137
123
extern void plugin_sessionvar_cleanup(Session *session);
138
124
 
139
 
typedef bool (plugin_foreach_func)(Session *session,
140
 
                                   plugin_ref plugin,
141
 
                                   void *arg);
 
125
typedef bool (plugin_foreach_func)(Session *session, plugin_ref plugin, void *arg);
142
126
bool plugin_foreach(Session *session, plugin_foreach_func *func,
143
 
                    int type, void *arg,
144
 
                    uint32_t state_mask= PLUGIN_IS_READY);
 
127
                    int type, void *arg, bool all= false);
145
128
 
146
129
#endif /* DRIZZLE_SERVER_PLUGIN_H */