diff --git a/include/stellar/module_manager.h b/include/stellar/module_manager.h index 82c000c..e4983bb 100644 --- a/include/stellar/module_manager.h +++ b/include/stellar/module_manager.h @@ -8,7 +8,7 @@ extern "C" #include "stellar/mq.h" struct stellar_module; -struct stellar_module *stellar_module_new(const char *name); +struct stellar_module *stellar_module_new(const char *name, void *ctx); void stellar_module_free(struct stellar_module *mod); void * stellar_module_get_ctx(struct stellar_module *mod); diff --git a/infra/module_manager/module_manager.c b/infra/module_manager/module_manager.c index 819384e..3e56c35 100644 --- a/infra/module_manager/module_manager.c +++ b/infra/module_manager/module_manager.c @@ -187,10 +187,11 @@ struct stellar_module *stellar_module_manager_get_module(struct stellar_module_m *******************************************/ -struct stellar_module *stellar_module_new(const char *name) +struct stellar_module *stellar_module_new(const char *name, void *ctx) { struct stellar_module *mod = CALLOC(struct stellar_module, 1); memcpy(mod->name, name, MIN(NAME_MAX, strlen(name))); + mod->module_ctx=ctx; return mod; } diff --git a/infra/module_manager/test/gtest_module_manager_main.cpp b/infra/module_manager/test/gtest_module_manager_main.cpp index 625ec1b..467d5b3 100644 --- a/infra/module_manager/test/gtest_module_manager_main.cpp +++ b/infra/module_manager/test/gtest_module_manager_main.cpp @@ -71,7 +71,7 @@ TEST(module_manager_internal, stellar_module_manager_new_with_toml) { TEST(stellar_module, basic_new_and_free) { - struct stellar_module *mod = stellar_module_new("test"); + struct stellar_module *mod = stellar_module_new("test", NULL); EXPECT_TRUE(mod!=NULL); stellar_module_set_name(mod, "test1"); @@ -145,7 +145,7 @@ TEST(stellar_module_manager, register_thread) { extern "C" struct stellar_module *gtest_module_init(struct stellar_module_manager *mod_mgr) { - struct stellar_module *mod = stellar_module_new("gtest"); + struct stellar_module *mod = stellar_module_new("gtest", NULL); EXPECT_STREQ(stellar_module_get_name(mod), "gtest"); stellar_module_set_ctx(mod, (void*)1);