From: Arran Cudbard-Bell Date: Sat, 26 Nov 2016 20:26:41 +0000 (-0500) Subject: Pass const'd config section into thread_instantiate functions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2cf8058aa8af466ff0dcc9ea7ae445d04d75001b;p=thirdparty%2Ffreeradius-server.git Pass const'd config section into thread_instantiate functions --- diff --git a/src/include/modules.h b/src/include/modules.h index ef413afe5cd..0f7579dbf91 100644 --- a/src/include/modules.h +++ b/src/include/modules.h @@ -113,15 +113,17 @@ typedef int (*module_instantiate_t)(CONF_SECTION *mod_cs, void *instance); * * Called whenever a new thread is created. * + * @param[in] mod_cs Module instance's configuration section. * @param[in] instance data, specific to an instantiated module. * Pre-allocated, and populated during the * bootstrap and instantiate calls. + * @param[in] el The event list serviced by this thread. * @param[in] thread data specific to this module instance. * @return * - 0 on success. * - -1 if instantiation failed. */ -typedef int (*module_thread_t)(fr_event_list_t *el, void *instance, void *thread); +typedef int (*module_thread_t)(CONF_SECTION const *mod_cs, void *instance, fr_event_list_t *el, void *thread); /** Module thread destruction callback * diff --git a/src/main/modules.c b/src/main/modules.c index f92cad6bc48..449f14d8673 100644 --- a/src/main/modules.c +++ b/src/main/modules.c @@ -569,7 +569,7 @@ static int _module_thread_instantiate(void *instance, void *ctx) rbtree_insert(thread_inst_ctx->tree, thread_inst); } - ret = inst->module->thread_instantiate(thread_inst_ctx->el, inst, thread_inst->data); + ret = inst->module->thread_instantiate(inst->cs, inst, thread_inst_ctx->el, thread_inst->data); if (ret < 0) { ERROR("Thread instantiation failed for module \"%s\"", inst->name); return -1; diff --git a/src/modules/rlm_delay/rlm_delay.c b/src/modules/rlm_delay/rlm_delay.c index 7bed8235738..62d696739a2 100644 --- a/src/modules/rlm_delay/rlm_delay.c +++ b/src/modules/rlm_delay/rlm_delay.c @@ -49,7 +49,7 @@ static const CONF_PARSER module_config[] = { /** Called when the delay is complete, and we're running from the interpreter * */ -static rlm_rcode_t delay_return(UNUSED REQUEST *request, UNUSED void *module_instance, UNUSED void *ctx) +static rlm_rcode_t delay_return(UNUSED REQUEST *request, UNUSED void *instance, UNUSED void *ctx) { return RLM_MODULE_OK; } @@ -59,11 +59,11 @@ static rlm_rcode_t delay_return(UNUSED REQUEST *request, UNUSED void *module_ins * Marks the request as resumable, and prints the actual delay time. * * @param[in] request The current request. - * @param[in] module_instance This instance of the delay module. + * @param[in] instance This instance of the delay module. * @param[in] ctx Scheduled end of the delay. * @param[in] fired When request processing was resumed. */ -static void delay_done(REQUEST *request, UNUSED void *module_instance, void *ctx, struct timeval *fired) +static void delay_done(REQUEST *request, UNUSED void *instance, void *ctx, struct timeval *fired) { struct timeval *when = talloc_get_type_abort(ctx, struct timeval); diff --git a/src/modules/rlm_test/rlm_test.c b/src/modules/rlm_test/rlm_test.c index 7de2bb3fef5..10f377f5bcd 100644 --- a/src/modules/rlm_test/rlm_test.c +++ b/src/modules/rlm_test/rlm_test.c @@ -177,12 +177,13 @@ static int rlm_test_cmp(UNUSED void *instance, REQUEST *request, UNUSED VALUE_PA return 1; } -static int mod_thread_instantiate(UNUSED void *instance, void *thread) +static int mod_thread_instantiate(UNUSED CONF_SECTION const *cs, UNUSED void *instance, UNUSED fr_event_list_t *el, + void *thread) { rlm_test_thread_t *t = thread; t->value = pthread_self(); - INFO("Performing instantiation for thread %p", (void *)t->value); + INFO("Performing instantiation for thread %p (ctx %p)", (void *)t->value, t); return 0; }