]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Pass const'd config section into thread_instantiate functions
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 26 Nov 2016 20:26:41 +0000 (15:26 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 26 Nov 2016 22:17:31 +0000 (17:17 -0500)
src/include/modules.h
src/main/modules.c
src/modules/rlm_delay/rlm_delay.c
src/modules/rlm_test/rlm_test.c

index ef413afe5cd064bc57c42b71f3cfb696ab13f40c..0f7579dbf919b90b702033fd7b755217b7601e3b 100644 (file)
@@ -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
  *
index f92cad6bc481a1e6b505df5668d26c0653cc43e1..449f14d8673a42cb39bd44d7b931d831eaa20b07 100644 (file)
@@ -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;
index 7bed823573884b66d881fefe9c7b44a5151d5a5e..62d696739a2b3a1734b3303219aec51a6f7b070b 100644 (file)
@@ -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);
 
index 7de2bb3fef57d0ccf82e07261648b8f0a7bd429a..10f377f5bcd5108bcff23c0cdac1e3dc9bbbde03 100644 (file)
@@ -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;
 }