From: Alan T. DeKok Date: Fri, 16 Dec 2022 17:40:48 +0000 (-0500) Subject: remove needs_async flag X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29b0e6798c0eb689b88f970962729d819d03d37a;p=thirdparty%2Ffreeradius-server.git remove needs_async flag as it is no longer used --- diff --git a/src/lib/unlang/foreach.c b/src/lib/unlang/foreach.c index e6d9f467c4f..0f9e6c4f864 100644 --- a/src/lib/unlang/foreach.c +++ b/src/lib/unlang/foreach.c @@ -233,7 +233,7 @@ void unlang_foreach_init(void) xlat_t *x; x = xlat_register(NULL, xlat_foreach_names[i], - unlang_foreach_xlat, FR_TYPE_VOID, XLAT_FLAG_NEEDS_ASYNC); + unlang_foreach_xlat, FR_TYPE_VOID, 0); fr_assert(x); x->uctx = &xlat_foreach_inst[i]; xlat_internal(x); diff --git a/src/lib/unlang/xlat.h b/src/lib/unlang/xlat.h index 8f44322f9c5..ee07321cb34 100644 --- a/src/lib/unlang/xlat.h +++ b/src/lib/unlang/xlat.h @@ -108,8 +108,6 @@ typedef struct xlat_s xlat_t; */ typedef struct { bool needs_resolving;//!< Needs pass2 resolution. - bool needs_async; //!< Node and all child nodes are guaranteed to not - ///< require asynchronous expansion. bool pure; //!< has no external side effects, true for BOX, LITERAL, and some functions bool can_purify; //!< if the xlat has a pure function with pure arguments. @@ -121,7 +119,6 @@ typedef struct { * * We can't set "needs_resolving" here, and async functions can't be pure. */ -#define XLAT_FLAG_NEEDS_ASYNC &(xlat_flags_t) { .needs_async = true, } #define XLAT_FLAG_PURE &(xlat_flags_t) { .pure = true, } extern fr_table_num_sorted_t const xlat_action_table[]; diff --git a/src/lib/unlang/xlat_builtin.c b/src/lib/unlang/xlat_builtin.c index 8e1e5968b8a..6392185953c 100644 --- a/src/lib/unlang/xlat_builtin.c +++ b/src/lib/unlang/xlat_builtin.c @@ -197,11 +197,6 @@ xlat_t *xlat_register_module(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx, return NULL; } - if (c->flags.needs_async != flags->needs_async) { - ERROR("%s: Cannot change async capability of %s", __FUNCTION__, name); - return NULL; - } - if (c->func != func) { ERROR("%s: Cannot change callback function for %s", __FUNCTION__, name); return NULL; @@ -239,7 +234,6 @@ xlat_t *xlat_register_module(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx, * If the function is async, it can't be pure. But * non-pure functions don't need to be async. */ - fr_assert(!flags->needs_async || !flags->pure); fr_assert(!flags->needs_resolving); return c; @@ -419,8 +413,6 @@ int xlat_func_mono(xlat_t *x, xlat_arg_parser_t const *arg) } /** Set global instantiation/detach callbacks - * - * All functions registered must be needs_async. * * @param[in] xlat to set instantiation callbacks for. * @param[in] instantiate Instantiation function. Called whenever a xlat is @@ -449,7 +441,7 @@ void _xlat_async_instantiate_set(xlat_t const *xlat, /** Register an async xlat * - * All functions registered must be needs_async. + * All functions registered must be !pure * * @param[in] xlat to set instantiation callbacks for. * @param[in] thread_instantiate Instantiation function. Called for every compiled xlat diff --git a/src/lib/unlang/xlat_priv.h b/src/lib/unlang/xlat_priv.h index f55c08aa85b..843f64e926f 100644 --- a/src/lib/unlang/xlat_priv.h +++ b/src/lib/unlang/xlat_priv.h @@ -179,16 +179,11 @@ typedef struct { * * For pass2, if either the parent or child is marked up for pass2, then the parent * is marked up for pass2. - * - * For needs_async, if both the parent and the child are needs_async, the parent is - * needs_async. */ static inline CC_HINT(nonnull) void xlat_flags_merge(xlat_flags_t *parent, xlat_flags_t const *child) { - parent->needs_async |= child->needs_async; parent->needs_resolving |= child->needs_resolving; parent->pure &= child->pure; /* purity can only be removed, never added */ - parent->pure &= !parent->needs_async; /* things needing async cannot be pure */ parent->can_purify |= child->can_purify; parent->constant &= child->constant; } diff --git a/src/lib/unlang/xlat_tokenize.c b/src/lib/unlang/xlat_tokenize.c index 841220e44aa..b106deab09c 100644 --- a/src/lib/unlang/xlat_tokenize.c +++ b/src/lib/unlang/xlat_tokenize.c @@ -253,7 +253,6 @@ static inline int xlat_tokenize_regex(xlat_exp_head_t *head, fr_sbuff_t *in) node = xlat_exp_alloc(head, XLAT_REGEX, fr_sbuff_current(&m_s), fr_sbuff_behind(&m_s)); node->regex_index = num; - node->flags.needs_async = false; fr_sbuff_marker_release(&m_s); fr_sbuff_next(in); /* Skip '}' */ @@ -1016,7 +1015,6 @@ static int xlat_tokenize_string(xlat_exp_head_t *head, * %% is pure. Everything else is not. */ node->flags.pure = (node->fmt[0] == '%'); - node->flags.needs_async = false; xlat_exp_insert_tail(head, node); continue; @@ -1069,16 +1067,14 @@ static void _xlat_debug(xlat_exp_head_t const *head, int depth) fr_assert(head != NULL); - INFO_INDENT("head flags = { %s %s %s %s }", + INFO_INDENT("head flags = { %s %s %s }", head->flags.needs_resolving ? "need_resolving" : "", - head->flags.needs_async ? "need_async" : "", head->flags.pure ? "pure" : "", head->flags.can_purify ? "can_purify" : ""); xlat_exp_foreach(head, node) { - INFO_INDENT("[%d] flags = { %s %s %s %s }", i++, + INFO_INDENT("[%d] flags = { %s %s %s }", i++, node->flags.needs_resolving ? "need_resolving" : "", - node->flags.needs_async ? "need_async" : "", node->flags.pure ? "pure" : "", node->flags.can_purify ? "can_purify" : ""); diff --git a/src/modules/rlm_cache/rlm_cache.c b/src/modules/rlm_cache/rlm_cache.c index 32269cde755..d7aca03c54a 100644 --- a/src/modules/rlm_cache/rlm_cache.c +++ b/src/modules/rlm_cache/rlm_cache.c @@ -974,7 +974,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) /* * Register the cache xlat function */ - xlat = xlat_register_module(inst, mctx, mctx->inst->name, cache_xlat, FR_TYPE_VOID, XLAT_FLAG_NEEDS_ASYNC); + xlat = xlat_register_module(inst, mctx, mctx->inst->name, cache_xlat, FR_TYPE_VOID, 0); xlat_func_args(xlat, cache_xlat_args); return 0; diff --git a/src/modules/rlm_delay/rlm_delay.c b/src/modules/rlm_delay/rlm_delay.c index ea05cfc3b49..64f0a2876de 100644 --- a/src/modules/rlm_delay/rlm_delay.c +++ b/src/modules/rlm_delay/rlm_delay.c @@ -265,7 +265,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) rlm_delay_t *inst = talloc_get_type_abort(mctx->inst->data, rlm_delay_t); xlat_t *xlat; - xlat = xlat_register_module(inst, mctx, mctx->inst->name, xlat_delay, FR_TYPE_TIME_DELTA, XLAT_FLAG_NEEDS_ASYNC); + xlat = xlat_register_module(inst, mctx, mctx->inst->name, xlat_delay, FR_TYPE_TIME_DELTA, 0); xlat_func_args(xlat, xlat_delay_args); return 0; } diff --git a/src/modules/rlm_exec/rlm_exec.c b/src/modules/rlm_exec/rlm_exec.c index 7020209b854..189e25c9005 100644 --- a/src/modules/rlm_exec/rlm_exec.c +++ b/src/modules/rlm_exec/rlm_exec.c @@ -166,7 +166,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) xlat_t *xlat; char const *p; - xlat = xlat_register_module(NULL, mctx, mctx->inst->name, exec_xlat, FR_TYPE_STRING, XLAT_FLAG_NEEDS_ASYNC); + xlat = xlat_register_module(NULL, mctx, mctx->inst->name, exec_xlat, FR_TYPE_STRING, 0); xlat_func_args(xlat, exec_xlat_args); if (inst->input) { diff --git a/src/modules/rlm_icmp/rlm_icmp.c b/src/modules/rlm_icmp/rlm_icmp.c index bcfe7d6ecdf..7bca945df2a 100644 --- a/src/modules/rlm_icmp/rlm_icmp.c +++ b/src/modules/rlm_icmp/rlm_icmp.c @@ -497,7 +497,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) rlm_icmp_t *inst = talloc_get_type_abort(mctx->inst->data, rlm_icmp_t); xlat_t *xlat; - xlat = xlat_register_module(inst, mctx, mctx->inst->name, xlat_icmp, FR_TYPE_BOOL, XLAT_FLAG_NEEDS_ASYNC); + xlat = xlat_register_module(inst, mctx, mctx->inst->name, xlat_icmp, FR_TYPE_BOOL, 0); xlat_func_args(xlat, xlat_icmp_args); FR_TIME_DELTA_BOUND_CHECK("timeout", inst->timeout, >=, fr_time_delta_from_msec(100)); /* 1/10s minimum timeout */ diff --git a/src/modules/rlm_rest/rlm_rest.c b/src/modules/rlm_rest/rlm_rest.c index dba74b23aac..e9d3b857b90 100644 --- a/src/modules/rlm_rest/rlm_rest.c +++ b/src/modules/rlm_rest/rlm_rest.c @@ -1200,7 +1200,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) rlm_rest_t *inst = talloc_get_type_abort(mctx->inst->data, rlm_rest_t); xlat_t *xlat; - xlat = xlat_register_module(inst, mctx, mctx->inst->name, rest_xlat, FR_TYPE_STRING, XLAT_FLAG_NEEDS_ASYNC); + xlat = xlat_register_module(inst, mctx, mctx->inst->name, rest_xlat, FR_TYPE_STRING, 0); xlat_func_args(xlat, rest_xlat_args); return 0; diff --git a/src/modules/rlm_unbound/rlm_unbound.c b/src/modules/rlm_unbound/rlm_unbound.c index d09309f898a..c6880ee080e 100644 --- a/src/modules/rlm_unbound/rlm_unbound.c +++ b/src/modules/rlm_unbound/rlm_unbound.c @@ -490,7 +490,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return -1; } - if(!(xlat = xlat_register_module(NULL, mctx, mctx->inst->name, xlat_unbound, FR_TYPE_VOID, XLAT_FLAG_NEEDS_ASYNC))) return -1; + if(!(xlat = xlat_register_module(NULL, mctx, mctx->inst->name, xlat_unbound, FR_TYPE_VOID, 0))) return -1; xlat_func_args(xlat, xlat_unbound_args); return 0;