From 4b3615e4b0d55497a8e1a5f16125a89b082d6af0 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Wed, 9 Dec 2009 14:04:14 -0300 Subject: [PATCH] Add MK_PLUGIN_STAGE_00 to plugin stages --- plugins/cheetah/cheetah.c | 1 + src/include/plugin.h | 3 ++- src/plugin.c | 10 +++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/cheetah/cheetah.c b/plugins/cheetah/cheetah.c index 1e21534..a6989cc 100644 --- a/plugins/cheetah/cheetah.c +++ b/plugins/cheetah/cheetah.c @@ -191,6 +191,7 @@ void mk_cheetah_cmd_plugins() { struct plugin_stages *p = mk_api->config->plugins; + mk_cheetah_cmd_plugins_print(p->stage_00, "STAGE_00"); mk_cheetah_cmd_plugins_print(p->stage_10, "STAGE_10"); mk_cheetah_cmd_plugins_print(p->stage_20, "STAGE_20"); mk_cheetah_cmd_plugins_print(p->stage_30, "STAGE_30"); diff --git a/src/include/plugin.h b/src/include/plugin.h index f33288e..472a37e 100644 --- a/src/include/plugin.h +++ b/src/include/plugin.h @@ -46,6 +46,7 @@ #define MK_PLUGIN_RET_CONTINUE 300 struct plugin_stages { + struct plugin *stage_00; struct plugin *stage_10; struct plugin *stage_20; struct plugin *stage_30; @@ -83,7 +84,7 @@ struct plugin { struct plugin_api { struct server_config *config; - struct plugins *plugins; + struct plugin_list *plugins; struct sched_list_node **sched_list; /* Exporting Functions */ diff --git a/src/plugin.c b/src/plugin.c index 21c6d81..cf11414 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -105,6 +105,10 @@ void mk_plugin_register_stages(struct plugin *p) } /* Assign plugin to stages */ + if(*p->stages & MK_PLUGIN_STAGE_00){ + mk_plugin_register_add_to_stage(&config->plugins->stage_00, p); + } + if(*p->stages & MK_PLUGIN_STAGE_10){ mk_plugin_register_add_to_stage(&config->plugins->stage_10, p); } @@ -148,6 +152,9 @@ void *mk_plugin_register(void *handler, char *path) p->call_worker_init = (int (*)()) mk_plugin_load_symbol(handler, "_mk_plugin_worker_init"); + p->call_stage_10 = (int (*)()) + mk_plugin_load_symbol(handler, "_mk_plugin_stage_00"); + p->call_stage_10 = (int (*)()) mk_plugin_load_symbol(handler, "_mk_plugin_stage_10"); @@ -184,7 +191,7 @@ void mk_plugin_init() /* Setup and connections list */ api->config = config; api->sched_list = &sched_list; - + /* API plugins funcions */ api->mem_alloc = (void *) mk_mem_malloc; api->mem_alloc_z = (void *) mk_mem_malloc_z; @@ -236,6 +243,7 @@ void mk_plugin_init() cnf = cnf->next; } + api->plugins = plg_list; mk_mem_free(path); } -- 2.11.4.GIT