From: Alan T. DeKok Date: Tue, 3 Apr 2018 14:09:41 +0000 (-0400) Subject: s/module_unlang/unlang_module/ X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8deb2a712dd4775bc405afa12dbdb610db4095d8;p=thirdparty%2Ffreeradius-server.git s/module_unlang/unlang_module/ like the last commit --- diff --git a/src/include/modules.h b/src/include/modules.h index 036da00f1e7..0811baa8f4b 100644 --- a/src/include/modules.h +++ b/src/include/modules.h @@ -162,7 +162,7 @@ typedef void (*fr_unlang_module_fd_event_t)(REQUEST *request, void *instance, vo * @param[in] rctx a local context for the callback. * @return a normal rlm_rcode_t. */ -typedef rlm_rcode_t (*fr_module_unlang_resume_t)(REQUEST *request, void *instance, void *thread, void *rctx); +typedef rlm_rcode_t (*fr_unlang_module_resume_t)(REQUEST *request, void *instance, void *thread, void *rctx); /** A callback when the request gets a fr_state_signal_t. * @@ -177,7 +177,7 @@ typedef rlm_rcode_t (*fr_module_unlang_resume_t)(REQUEST *request, void *instanc * @param[in] rctx Resume ctx for the callback. * @param[in] action which is signalling the request. */ -typedef void (*fr_module_unlang_signal_t)(REQUEST *request, void *instance, void *thread, +typedef void (*fr_unlang_module_signal_t)(REQUEST *request, void *instance, void *thread, void *rctx, fr_state_signal_t action); /** Struct exported by a rlm_* module @@ -302,7 +302,7 @@ int virtual_server_namespace_register(char const *namespace, fr_virtual_server_ void fr_request_async_bootstrap(REQUEST *request, fr_event_list_t *el); /* for unit_test_module */ /* - * module_unlang.c + * unlang_module.c */ int unlang_event_module_timeout_add(REQUEST *request, fr_unlang_module_timeout_t callback, void const *ctx, struct timeval *timeout); @@ -317,15 +317,15 @@ int unlang_event_timeout_delete(REQUEST *request, void const *ctx); int unlang_event_fd_delete(REQUEST *request, void const *ctx, int fd); -rlm_rcode_t module_unlang_push_xlat(TALLOC_CTX *ctx, fr_value_box_t **out, +rlm_rcode_t unlang_module_push_xlat(TALLOC_CTX *ctx, fr_value_box_t **out, REQUEST *request, xlat_exp_t const *xlat, - fr_module_unlang_resume_t callback, - fr_module_unlang_signal_t signal_callback, void *uctx); + fr_unlang_module_resume_t callback, + fr_unlang_module_signal_t signal_callback, void *uctx); -rlm_rcode_t unlang_module_yield(REQUEST *request, fr_module_unlang_resume_t callback, - fr_module_unlang_signal_t signal_callback, void *ctx); +rlm_rcode_t unlang_module_yield(REQUEST *request, fr_unlang_module_resume_t callback, + fr_unlang_module_signal_t signal_callback, void *ctx); -void module_unlang_init(void); +void unlang_module_init(void); #ifdef __cplusplus } #endif diff --git a/src/unlang/compile.c b/src/unlang/compile.c index 9b070dae1d3..e84209eda86 100644 --- a/src/unlang/compile.c +++ b/src/unlang/compile.c @@ -97,7 +97,7 @@ static void dump_mc(unlang_t *c, int indent) int i; if(c->type==UNLANG_TYPE_MODULE_CALL) { - module_unlang_call_t *single = unlang_generic_to_module_call(c); + unlang_module_call_t *single = unlang_generic_to_module_call(c); DEBUG("%.*s%s {", indent, "\t\t\t\t\t\t\t\t\t\t\t", single->module_instance->name); } else if ((c->type > UNLANG_TYPE_MODULE_CALL) && (c->type <= UNLANG_TYPE_POLICY)) { @@ -909,7 +909,7 @@ static void unlang_dump(unlang_t *mc, int depth) break; case UNLANG_TYPE_MODULE_CALL: { - module_unlang_call_t *single = unlang_generic_to_module_call(this); + unlang_module_call_t *single = unlang_generic_to_module_call(this); DEBUG("%.*s%s", depth, modcall_spaces, single->module_instance->name); @@ -2834,7 +2834,7 @@ static CONF_SECTION *virtual_module_find_cs(CONF_SECTION *conf_root, rlm_compone static unlang_t *compile_module(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM *ci, module_instance_t *this, unlang_group_type_t parentgroup_type, char const *realname) { unlang_t *c; - module_unlang_call_t *single; + unlang_module_call_t *single; /* * Check if the module in question has the necessary @@ -2852,11 +2852,11 @@ static unlang_t *compile_module(unlang_t *parent, unlang_compile_t *unlang_ctx, return NULL; } - single = talloc_zero(parent, module_unlang_call_t); + single = talloc_zero(parent, unlang_module_call_t); single->module_instance = this; single->method = this->module->methods[unlang_ctx->component]; - c = module_unlang_call_to_generic(single); + c = unlang_module_call_to_generic(single); c->parent = parent; c->next = NULL; diff --git a/src/unlang/interpret.c b/src/unlang/interpret.c index ce1c4b67d56..51c82d3d219 100644 --- a/src/unlang/interpret.c +++ b/src/unlang/interpret.c @@ -990,7 +990,7 @@ int unlang_event_module_timeout_add(REQUEST *request, fr_unlang_module_timeout_t unlang_stack_t *stack = request->stack; unlang_stack_frame_t *frame = &stack->frame[stack->depth]; unlang_event_t *ev; - module_unlang_call_t *sp; + unlang_module_call_t *sp; unlang_frame_state_modcall_t *ms = talloc_get_type_abort(frame->state, unlang_frame_state_modcall_t); @@ -1075,7 +1075,7 @@ int unlang_event_fd_add(REQUEST *request, unlang_stack_t *stack = request->stack; unlang_stack_frame_t *frame = &stack->frame[stack->depth]; unlang_event_t *ev; - module_unlang_call_t *sp; + unlang_module_call_t *sp; unlang_frame_state_modcall_t *ms = talloc_get_type_abort(frame->state, unlang_frame_state_modcall_t); @@ -1139,7 +1139,7 @@ int unlang_event_fd_delete(REQUEST *request, void const *ctx, int fd) * This is typically called via an "async" action, i.e. an action * outside of the normal processing of the request. * - * If there is no #fr_module_unlang_signal_t callback defined, the action is ignored. + * If there is no #fr_unlang_module_signal_t callback defined, the action is ignored. * * @param[in] request The current request. * @param[in] action to signal. @@ -1427,8 +1427,8 @@ static unlang_action_t unlang_resume(REQUEST *request, rlm_rcode_t *presult, int * - RLM_MODULE_FAIL (or asserts) if the current frame is not a module call or * resume frame. */ -rlm_rcode_t unlang_module_yield(REQUEST *request, fr_module_unlang_resume_t callback, - fr_module_unlang_signal_t cancel, void *rctx) +rlm_rcode_t unlang_module_yield(REQUEST *request, fr_unlang_module_resume_t callback, + fr_unlang_module_signal_t cancel, void *rctx) { unlang_stack_t *stack = request->stack; unlang_stack_frame_t *frame = &stack->frame[stack->depth]; diff --git a/src/unlang/module.c b/src/unlang/module.c index 90a49dedd49..0639673b5c2 100644 --- a/src/unlang/module.c +++ b/src/unlang/module.c @@ -49,10 +49,10 @@ static inline void safe_unlock(module_instance_t *instance) if (instance->mutex) pthread_mutex_unlock(instance->mutex); } -static unlang_action_t module_unlang_call(REQUEST *request, +static unlang_action_t unlang_module_call(REQUEST *request, rlm_rcode_t *presult, int *priority) { - module_unlang_call_t *sp; + unlang_module_call_t *sp; unlang_stack_t *stack = request->stack; unlang_stack_frame_t *frame = &stack->frame[stack->depth]; unlang_t *instruction = frame->instruction; @@ -146,18 +146,18 @@ done: * This is typically called via an "async" action, i.e. an action * outside of the normal processing of the request. * - * If there is no #fr_module_unlang_signal_t callback defined, the action is ignored. + * If there is no #fr_unlang_module_signal_t callback defined, the action is ignored. * * @param[in] request The current request. - * @param[in] rctx createed by #module_unlang_call. + * @param[in] rctx createed by #unlang_module_call. * @param[in] action to signal. */ -static void module_unlang_signal(REQUEST *request, void *rctx, fr_state_signal_t action) +static void unlang_module_signal(REQUEST *request, void *rctx, fr_state_signal_t action) { unlang_stack_frame_t *frame; unlang_stack_t *stack = request->stack; unlang_resume_t *mr; - module_unlang_call_t *mc; + unlang_module_call_t *mc; char const *caller; unlang_frame_state_modcall_t *ms = NULL; @@ -174,19 +174,19 @@ static void module_unlang_signal(REQUEST *request, void *rctx, fr_state_signal_t caller = request->module; request->module = mc->module_instance->name; - ((fr_module_unlang_signal_t)mr->signal)(request, + ((fr_unlang_module_signal_t)mr->signal)(request, mc->module_instance->dl_inst->data, ms->thread->data, rctx, action); request->module = caller; } -static unlang_action_t module_unlang_resume(REQUEST *request, rlm_rcode_t *presult, UNUSED void *rctx) +static unlang_action_t unlang_module_resume(REQUEST *request, rlm_rcode_t *presult, UNUSED void *rctx) { unlang_stack_t *stack = request->stack; unlang_stack_frame_t *frame = &stack->frame[stack->depth]; unlang_t *instruction = frame->instruction; unlang_resume_t *mr = unlang_generic_to_resume(instruction); - module_unlang_call_t *mc = unlang_generic_to_module_call(mr->parent); + unlang_module_call_t *mc = unlang_generic_to_module_call(mr->parent); int stack_depth = stack->depth; char const *caller; @@ -202,7 +202,7 @@ static unlang_action_t module_unlang_resume(REQUEST *request, rlm_rcode_t *presu caller = request->module; request->module = mc->module_instance->name; safe_lock(mc->module_instance); - *presult = request->rcode = ((fr_module_unlang_resume_t)mr->callback)(request, + *presult = request->rcode = ((fr_unlang_module_resume_t)mr->callback)(request, mc->module_instance->dl_inst->data, ms->thread->data, mr->rctx); safe_unlock(mc->module_instance); @@ -249,10 +249,10 @@ static unlang_action_t module_unlang_resume(REQUEST *request, rlm_rcode_t *presu * @return * - RLM_MODULE_YIELD. */ -rlm_rcode_t module_unlang_push_xlat(TALLOC_CTX *ctx, fr_value_box_t **out, +rlm_rcode_t unlang_module_push_xlat(TALLOC_CTX *ctx, fr_value_box_t **out, REQUEST *request, xlat_exp_t const *exp, - fr_module_unlang_resume_t resume, - fr_module_unlang_signal_t signal, void *rctx) + fr_unlang_module_resume_t resume, + fr_unlang_module_signal_t signal, void *rctx) { /* * Push the resumption point @@ -267,13 +267,13 @@ rlm_rcode_t module_unlang_push_xlat(TALLOC_CTX *ctx, fr_value_box_t **out, return RLM_MODULE_YIELD; /* This may allow us to do optimisations in future */ } -void module_unlang_init(void) +void unlang_module_init(void) { unlang_op_register(UNLANG_TYPE_MODULE_CALL, &(unlang_op_t){ .name = "module", - .func = module_unlang_call, - .signal = module_unlang_signal, - .resume = module_unlang_resume + .func = unlang_module_call, + .signal = unlang_module_signal, + .resume = unlang_module_resume }); } diff --git a/src/unlang/op.c b/src/unlang/op.c index e70a23765fb..73e4686a0da 100644 --- a/src/unlang/op.c +++ b/src/unlang/op.c @@ -55,7 +55,7 @@ static uint64_t unlang_active_callers(unlang_t *instruction) case UNLANG_TYPE_MODULE_CALL: { module_thread_instance_t *thread; - module_unlang_call_t *sp; + unlang_module_call_t *sp; sp = unlang_generic_to_module_call(instruction); rad_assert(sp != NULL); @@ -302,7 +302,7 @@ static unlang_action_t unlang_load_balance(REQUEST *request, } else { module_thread_instance_t *thread; - module_unlang_call_t *sp; + unlang_module_call_t *sp; sp = unlang_generic_to_module_call(child); rad_assert(sp != NULL); @@ -1766,6 +1766,6 @@ void unlang_op_initialize(void) }); map_unlang_init(); - module_unlang_init(); + unlang_module_init(); #endif } diff --git a/src/unlang/unlang_priv.h b/src/unlang/unlang_priv.h index f96f1208674..398e6bd7779 100644 --- a/src/unlang/unlang_priv.h +++ b/src/unlang/unlang_priv.h @@ -46,7 +46,7 @@ extern "C" { /** Types of unlang_t nodes * - * Here are our basic types: unlang_t, unlang_group_t, and module_unlang_call_t. For an + * Here are our basic types: unlang_t, unlang_group_t, and unlang_module_call_t. For an * explanation of what they are all about, see doc/configurable_failover.rst */ typedef enum { @@ -170,7 +170,7 @@ typedef struct { unlang_t self; module_instance_t *module_instance; //!< Instance of the module we're calling. module_method_t method; -} module_unlang_call_t; +} unlang_module_call_t; /** Pushed onto the interpreter stack by a yielding module, indicates the resumption point * @@ -308,15 +308,15 @@ extern char const *const comp2str[]; /** @name Conversion functions for converting #unlang_t to its specialisations * - * Simple conversions: #module_unlang_call_t and #unlang_group_t are subclasses of #unlang_t, + * Simple conversions: #unlang_module_call_t and #unlang_group_t are subclasses of #unlang_t, * so we often want to go back and forth between them. * * @{ */ -static inline module_unlang_call_t *unlang_generic_to_module_call(unlang_t *p) +static inline unlang_module_call_t *unlang_generic_to_module_call(unlang_t *p) { rad_assert(p->type == UNLANG_TYPE_MODULE_CALL); - return talloc_get_type_abort(p, module_unlang_call_t); + return talloc_get_type_abort(p, unlang_module_call_t); } static inline unlang_group_t *unlang_generic_to_group(unlang_t *p) @@ -326,7 +326,7 @@ static inline unlang_group_t *unlang_generic_to_group(unlang_t *p) return (unlang_group_t *)p; } -static inline unlang_t *module_unlang_call_to_generic(module_unlang_call_t *p) +static inline unlang_t *unlang_module_call_to_generic(unlang_module_call_t *p) { return (unlang_t *)p; }