diff --git a/addons/ot/include/debug.h b/addons/ot/include/debug.h index 7becdf72f..6311216a6 100644 --- a/addons/ot/include/debug.h +++ b/addons/ot/include/debug.h @@ -39,6 +39,9 @@ } while (0) # define FLT_OT_FUNC(f, ...) do { FLT_OT_DBG(1, "%s(" f ") {", __func__, ##__VA_ARGS__); dbg_indent_level += 3; } while (0) # define FLT_OT_RETURN(a) do { dbg_indent_level -= 3; FLT_OT_DBG(1, "}"); return a; } while (0) +# define FLT_OT_RETURN_EX(a,t,f) do { dbg_indent_level -= 3; { t _r = (a); FLT_OT_DBG(1, "} = " f, _r); return _r; } } while (0) +# define FLT_OT_RETURN_INT(a) FLT_OT_RETURN_EX((a), int, "%d") +# define FLT_OT_RETURN_PTR(a) FLT_OT_RETURN_EX((a), void *, "%p") # define FLT_OT_DBG_IFDEF(a,b) a # define FLT_OT_DBG_ARGS(a, ...) a, ##__VA_ARGS__ @@ -58,8 +61,12 @@ extern struct flt_ot_debug flt_ot_debug; # define FLT_OT_DBG(...) while (0) # define FLT_OT_FUNC(...) while (0) # define FLT_OT_RETURN(a) return a +# define FLT_OT_RETURN_EX(a,t,f) return a +# define FLT_OT_RETURN_INT(a) return a +# define FLT_OT_RETURN_PTR(a) return a # define FLT_OT_DBG_IFDEF(a,b) b # define FLT_OT_DBG_ARGS(...) +# define FLT_OT_DBG_BUF(a,b) while (0) #endif /* DEBUG_OT */ /* diff --git a/addons/ot/src/cli.c b/addons/ot/src/cli.c index 529c6874c..f9feeca15 100644 --- a/addons/ot/src/cli.c +++ b/addons/ot/src/cli.c @@ -97,7 +97,7 @@ static int flt_ot_cli_parse_debug(char **args, char *payload, struct appctx *app cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_FREE); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } #endif /* DEBUG_OT */ @@ -137,7 +137,7 @@ static int flt_ot_cli_parse_disabled(char **args, char *payload, struct appctx * cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_FREE); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -175,7 +175,7 @@ static int flt_ot_cli_parse_option(char **args, char *payload, struct appctx *ap cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_FREE); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -238,7 +238,7 @@ static int flt_ot_cli_parse_logging(char **args, char *payload, struct appctx *a cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_FREE); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -289,7 +289,7 @@ static int flt_ot_cli_parse_rate(char **args, char *payload, struct appctx *appc cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_FREE); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -343,7 +343,7 @@ static int flt_ot_cli_parse_status(char **args, char *payload, struct appctx *ap cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_FREE); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } diff --git a/addons/ot/src/conf.c b/addons/ot/src/conf.c index d07be2c66..d575e3a04 100644 --- a/addons/ot/src/conf.c +++ b/addons/ot/src/conf.c @@ -48,7 +48,7 @@ static void *flt_ot_conf_hdr_init(size_t size, const char *id, int linenum, stru if (strcmp(ptr->id, id) == 0) { FLT_OT_ERR("'%s' : already defined", id); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } retptr = FLT_OT_CALLOC(1, size); @@ -72,7 +72,7 @@ static void *flt_ot_conf_hdr_init(size_t size, const char *id, int linenum, stru FLT_OT_ERR("out of memory"); } - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -102,7 +102,7 @@ struct flt_ot_conf_ph *flt_ot_conf_ph_init(const char *id, int linenum, struct l if (retptr != NULL) FLT_OT_DBG_CONF_PH("- init ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -162,7 +162,7 @@ struct flt_ot_conf_sample_expr *flt_ot_conf_sample_expr_init(const char *id, int if (retptr != NULL) FLT_OT_DBG_CONF_SAMPLE_EXPR("- init ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -221,13 +221,13 @@ struct flt_ot_conf_sample *flt_ot_conf_sample_init(char **args, int linenum, str retptr = flt_ot_conf_hdr_init(sizeof(*retptr), args[1], linenum, head, err); if (retptr == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); flt_ot_args_to_str(args, 2, &(retptr->value)); if (retptr->value == NULL) { FLT_OT_FREE_CLEAR(retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } retptr->num_exprs = flt_ot_args_count(args) - 2; @@ -235,7 +235,7 @@ struct flt_ot_conf_sample *flt_ot_conf_sample_init(char **args, int linenum, str FLT_OT_DBG_CONF_SAMPLE("- init ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -297,7 +297,7 @@ struct flt_ot_conf_str *flt_ot_conf_str_init(const char *id, int linenum, struct if (retptr != NULL) FLT_OT_DBG_CONF_STR("- init ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -357,7 +357,7 @@ struct flt_ot_conf_context *flt_ot_conf_context_init(const char *id, int linenum if (retptr != NULL) FLT_OT_DBG_CONF_CONTEXT("- init ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -415,7 +415,7 @@ struct flt_ot_conf_span *flt_ot_conf_span_init(const char *id, int linenum, stru retptr = flt_ot_conf_hdr_init(sizeof(*retptr), id, linenum, head, err); if (retptr == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); LIST_INIT(&(retptr->tags)); LIST_INIT(&(retptr->logs)); @@ -423,7 +423,7 @@ struct flt_ot_conf_span *flt_ot_conf_span_init(const char *id, int linenum, stru FLT_OT_DBG_CONF_SPAN("- init ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -486,7 +486,7 @@ struct flt_ot_conf_scope *flt_ot_conf_scope_init(const char *id, int linenum, st retptr = flt_ot_conf_hdr_init(sizeof(*retptr), id, linenum, head, err); if (retptr == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); LIST_INIT(&(retptr->acls)); LIST_INIT(&(retptr->contexts)); @@ -495,7 +495,7 @@ struct flt_ot_conf_scope *flt_ot_conf_scope_init(const char *id, int linenum, st FLT_OT_DBG_CONF_SCOPE("- init ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } /*** @@ -566,13 +566,13 @@ struct flt_ot_conf_group *flt_ot_conf_group_init(const char *id, int linenum, st retptr = flt_ot_conf_hdr_init(sizeof(*retptr), id, linenum, head, err); if (retptr == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); LIST_INIT(&(retptr->ph_scopes)); FLT_OT_DBG_CONF_GROUP("- init ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -630,7 +630,7 @@ struct flt_ot_conf_tracer *flt_ot_conf_tracer_init(const char *id, int linenum, retptr = flt_ot_conf_hdr_init(sizeof(*retptr), id, linenum, NULL, err); if (retptr == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); retptr->rate_limit = FLT_OT_FLOAT_U32(FLT_OT_RATE_LIMIT_MAX, FLT_OT_RATE_LIMIT_MAX); init_new_proxy(&(retptr->proxy_log)); @@ -640,7 +640,7 @@ struct flt_ot_conf_tracer *flt_ot_conf_tracer_init(const char *id, int linenum, FLT_OT_DBG_CONF_TRACER("- init ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -713,7 +713,7 @@ struct flt_ot_conf *flt_ot_conf_init(struct proxy *px) retptr = FLT_OT_CALLOC(1, sizeof(*retptr)); if (retptr == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); retptr->proxy = px; LIST_INIT(&(retptr->groups)); @@ -721,7 +721,7 @@ struct flt_ot_conf *flt_ot_conf_init(struct proxy *px) FLT_OT_DBG_CONF("- init ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } diff --git a/addons/ot/src/event.c b/addons/ot/src/event.c index 0cb6b1d72..dc29d52a2 100644 --- a/addons/ot/src/event.c +++ b/addons/ot/src/event.c @@ -55,7 +55,7 @@ static int flt_ot_scope_run_span(struct stream *s, struct filter *f, struct chan FLT_OT_FUNC("%p, %p, %p, %u, %p, %p, %p, %p, %p:%p", s, f, chn, dir, span, data, conf_span, ts, FLT_OT_DPTR_ARGS(err)); if (span == NULL) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); if (span->span == NULL) { span->span = ot_span_init(conf->tracer->tracer, span->id, ts, NULL, span->ref_type, FLT_OT_DEREF(span->ref_ctx, idx, -1), span->ref_span, data->tags, data->num_tags, err); @@ -106,7 +106,7 @@ static int flt_ot_scope_run_span(struct stream *s, struct filter *f, struct chan } } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -181,7 +181,7 @@ int flt_ot_scope_run(struct stream *s, struct filter *f, struct channel *chn, st break; } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } } @@ -261,7 +261,7 @@ int flt_ot_scope_run(struct stream *s, struct filter *f, struct channel *chn, st flt_ot_scope_finish_marked(f->ctx, ts); flt_ot_scope_free_unused(f->ctx, chn); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -325,7 +325,7 @@ int flt_ot_event_run(struct stream *s, struct filter *f, struct channel *chn, in FLT_OT_DBG(3, "event = %d, chn = %p, s->req = %p, s->res = %p", event, chn, &(s->req), &(s->res)); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } /* diff --git a/addons/ot/src/filter.c b/addons/ot/src/filter.c index bd71186a6..cf67fd207 100644 --- a/addons/ot/src/filter.c +++ b/addons/ot/src/filter.c @@ -162,7 +162,7 @@ static int flt_ot_init(struct proxy *p, struct flt_conf *fconf) FLT_OT_FUNC("%p, %p", p, fconf); if (conf == NULL) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); flt_ot_cli_init(); @@ -178,7 +178,7 @@ static int flt_ot_init(struct proxy *p, struct flt_conf *fconf) FLT_OT_ERR_FREE(err); } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -256,7 +256,7 @@ static int flt_ot_check(struct proxy *p, struct flt_conf *fconf) FLT_OT_FUNC("%p, %p", p, fconf); if (conf == NULL) - FLT_OT_RETURN(++retval); + FLT_OT_RETURN_INT(++retval); /* * If only the proxy specified with the

parameter is checked, then @@ -421,7 +421,7 @@ static int flt_ot_check(struct proxy *p, struct flt_conf *fconf) FLT_OT_DBG_LIST(conf->tracer, ph_scope, " ", "used", _scope, FLT_OT_DBG_CONF_PH(" ", _scope)); } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -450,7 +450,7 @@ static int flt_ot_init_per_thread(struct proxy *p, struct flt_conf *fconf) FLT_OT_FUNC("%p, %p", p, fconf); if (conf == NULL) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); /* * Start the OpenTracing library tracer thread. @@ -469,7 +469,7 @@ static int flt_ot_init_per_thread(struct proxy *p, struct flt_conf *fconf) retval = FLT_OT_RET_OK; } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -529,7 +529,7 @@ static int flt_ot_attach(struct stream *s, struct filter *f) if (conf->tracer->flag_disabled) { FLT_OT_DBG(2, "filter '%s', type: %s (disabled)", conf->id, flt_ot_type(f)); - FLT_OT_RETURN(FLT_OT_RET_IGNORE); + FLT_OT_RETURN_INT(FLT_OT_RET_IGNORE); } else if (conf->tracer->rate_limit < FLT_OT_FLOAT_U32(FLT_OT_RATE_LIMIT_MAX, FLT_OT_RATE_LIMIT_MAX)) { uint32_t rnd = ha_random32(); @@ -537,7 +537,7 @@ static int flt_ot_attach(struct stream *s, struct filter *f) if (conf->tracer->rate_limit <= rnd) { FLT_OT_DBG(2, "filter '%s', type: %s (ignored: %u <= %u)", conf->id, flt_ot_type(f), conf->tracer->rate_limit, rnd); - FLT_OT_RETURN(FLT_OT_RET_IGNORE); + FLT_OT_RETURN_INT(FLT_OT_RET_IGNORE); } } @@ -548,7 +548,7 @@ static int flt_ot_attach(struct stream *s, struct filter *f) if (f->ctx == NULL) { FLT_OT_LOG(LOG_EMERG, "failed to create context"); - FLT_OT_RETURN(FLT_OT_RET_IGNORE); + FLT_OT_RETURN_INT(FLT_OT_RET_IGNORE); } /* @@ -565,7 +565,7 @@ static int flt_ot_attach(struct stream *s, struct filter *f) #endif flt_ot_http_headers_dump(&(s->req)); - FLT_OT_RETURN(FLT_OT_RET_OK); + FLT_OT_RETURN_INT(FLT_OT_RET_OK); } @@ -595,9 +595,9 @@ static int flt_ot_stream_start(struct stream *s, struct filter *f) FLT_OT_FUNC("%p, %p", s, f); if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, -1))) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); - FLT_OT_RETURN(flt_ot_return_int(f, &err, retval)); + FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval)); } @@ -626,11 +626,11 @@ static int flt_ot_stream_set_backend(struct stream *s, struct filter *f, struct FLT_OT_FUNC("%p, %p, %p", s, f, be); if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, -1))) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); FLT_OT_DBG(3, "backend: %s", be->id); - FLT_OT_RETURN(flt_ot_return_int(f, &err, retval)); + FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval)); } @@ -750,7 +750,7 @@ static int flt_ot_channel_start_analyze(struct stream *s, struct filter *f, stru FLT_OT_FUNC("%p, %p, %p", s, f, chn); if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, (chn->flags & CF_ISRESP) ? FLT_OT_EVENT_RES_SERVER_SESS_START : FLT_OT_EVENT_REQ_CLIENT_SESS_START))) - FLT_OT_RETURN(FLT_OT_RET_OK); + FLT_OT_RETURN_INT(FLT_OT_RET_OK); FLT_OT_DBG(3, "channel: %s, mode: %s (%s)", flt_ot_chn_label(chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s)); @@ -774,7 +774,7 @@ static int flt_ot_channel_start_analyze(struct stream *s, struct filter *f, stru // register_data_filter(s, chn, f); - FLT_OT_RETURN(flt_ot_return_int(f, &err, retval)); + FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval)); } @@ -810,7 +810,7 @@ static int flt_ot_channel_pre_analyze(struct stream *s, struct filter *f, struct } if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, event))) - FLT_OT_RETURN(FLT_OT_RET_OK); + FLT_OT_RETURN_INT(FLT_OT_RET_OK); FLT_OT_DBG(3, "channel: %s, mode: %s (%s), analyzer: %s", flt_ot_chn_label(chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s), flt_ot_analyzer(an_bit)); @@ -821,7 +821,7 @@ static int flt_ot_channel_pre_analyze(struct stream *s, struct filter *f, struct channel_dont_close(chn); } - FLT_OT_RETURN(flt_ot_return_int(f, &err, retval)); + FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval)); } @@ -859,13 +859,13 @@ static int flt_ot_channel_post_analyze(struct stream *s, struct filter *f, struc } if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, event))) - FLT_OT_RETURN(FLT_OT_RET_OK); + FLT_OT_RETURN_INT(FLT_OT_RET_OK); FLT_OT_DBG(3, "channel: %s, mode: %s (%s), analyzer: %s", flt_ot_chn_label(chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s), flt_ot_analyzer(an_bit)); retval = flt_ot_event_run(s, f, chn, event, &err); - FLT_OT_RETURN(flt_ot_return_int(f, &err, retval)); + FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval)); } @@ -893,7 +893,7 @@ static int flt_ot_channel_end_analyze(struct stream *s, struct filter *f, struct FLT_OT_FUNC("%p, %p, %p", s, f, chn); if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, (chn->flags & CF_ISRESP) ? FLT_OT_EVENT_RES_SERVER_SESS_END : FLT_OT_EVENT_REQ_CLIENT_SESS_END))) - FLT_OT_RETURN(FLT_OT_RET_OK); + FLT_OT_RETURN_INT(FLT_OT_RET_OK); FLT_OT_DBG(3, "channel: %s, mode: %s (%s)", flt_ot_chn_label(chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s)); @@ -915,7 +915,7 @@ static int flt_ot_channel_end_analyze(struct stream *s, struct filter *f, struct } } - FLT_OT_RETURN(flt_ot_return_int(f, &err, retval)); + FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval)); } @@ -947,11 +947,11 @@ static int flt_ot_http_headers(struct stream *s, struct filter *f, struct http_m FLT_OT_FUNC("%p, %p, %p", s, f, msg); if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, -1))) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); FLT_OT_DBG(3, "channel: %s, mode: %s (%s), %.*s %.*s %.*s", flt_ot_chn_label(msg->chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s), HTX_SL_P1_LEN(sl), HTX_SL_P1_PTR(sl), HTX_SL_P2_LEN(sl), HTX_SL_P2_PTR(sl), HTX_SL_P3_LEN(sl), HTX_SL_P3_PTR(sl)); - FLT_OT_RETURN(flt_ot_return_int(f, &err, retval)); + FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval)); } @@ -980,14 +980,14 @@ static int flt_ot_http_payload(struct stream *s, struct filter *f, struct http_m FLT_OT_FUNC("%p, %p, %p, %u, %u", s, f, msg, offset, len); if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, -1))) - FLT_OT_RETURN(len); + FLT_OT_RETURN_INT(len); FLT_OT_DBG(3, "channel: %s, mode: %s (%s), offset: %u, len: %u, forward: %d", flt_ot_chn_label(msg->chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s), offset, len, retval); if (retval != len) task_wakeup(s->task, TASK_WOKEN_MSG); - FLT_OT_RETURN(flt_ot_return_int(f, &err, retval)); + FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval)); } @@ -1015,11 +1015,11 @@ static int flt_ot_http_end(struct stream *s, struct filter *f, struct http_msg * FLT_OT_FUNC("%p, %p, %p", s, f, msg); if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, -1))) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); FLT_OT_DBG(3, "channel: %s, mode: %s (%s)", flt_ot_chn_label(msg->chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s)); - FLT_OT_RETURN(flt_ot_return_int(f, &err, retval)); + FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval)); } @@ -1113,7 +1113,7 @@ static int flt_ot_tcp_payload(struct stream *s, struct filter *f, struct channel FLT_OT_FUNC("%p, %p, %p, %u, %u", s, f, chn, offset, len); if (flt_ot_is_disabled(f FLT_OT_DBG_ARGS(, -1))) - FLT_OT_RETURN(len); + FLT_OT_RETURN_INT(len); FLT_OT_DBG(3, "channel: %s, mode: %s (%s), offset: %u, len: %u, forward: %d", flt_ot_chn_label(chn), flt_ot_pr_mode(s), flt_ot_stream_pos(s), offset, len, retval); @@ -1124,7 +1124,7 @@ static int flt_ot_tcp_payload(struct stream *s, struct filter *f, struct channel if (retval != len) task_wakeup(s->task, TASK_WOKEN_MSG); - FLT_OT_RETURN(flt_ot_return_int(f, &err, retval)); + FLT_OT_RETURN_INT(flt_ot_return_int(f, &err, retval)); } #endif /* DEBUG_OT */ diff --git a/addons/ot/src/group.c b/addons/ot/src/group.c index f9fdeccb9..52b872dcc 100644 --- a/addons/ot/src/group.c +++ b/addons/ot/src/group.c @@ -66,13 +66,13 @@ static enum act_return flt_ot_group_action(struct act_rule *rule, struct proxy * if ((fconf == NULL) || (conf == NULL) || (conf_group == NULL)) { FLT_OT_LOG(LOG_ERR, FLT_OT_ACTION_GROUP ": internal error, invalid group action"); - FLT_OT_RETURN(ACT_RET_CONT); + FLT_OT_RETURN_EX(ACT_RET_CONT, enum act_return, "%d"); } if (conf->tracer->flag_disabled) { FLT_OT_DBG(1, "filter '%s' disabled, group action '%s' ignored", conf->id, conf_group->id); - FLT_OT_RETURN(ACT_RET_CONT); + FLT_OT_RETURN_EX(ACT_RET_CONT, enum act_return, "%d"); } /* Find the OpenTracing filter instance from the current stream. */ @@ -86,10 +86,10 @@ static enum act_return flt_ot_group_action(struct act_rule *rule, struct proxy * if (rt_ctx == NULL) { FLT_OT_DBG(1, "cannot find filter, probably not attached to the stream"); - FLT_OT_RETURN(ACT_RET_CONT); + FLT_OT_RETURN_EX(ACT_RET_CONT, enum act_return, "%d"); } else if (flt_ot_is_disabled(filter FLT_OT_DBG_ARGS(, -1))) { - FLT_OT_RETURN(ACT_RET_CONT); + FLT_OT_RETURN_EX(ACT_RET_CONT, enum act_return, "%d"); } else { FLT_OT_DBG(3, "run group '%s'", conf_group->id); @@ -107,7 +107,7 @@ static enum act_return flt_ot_group_action(struct act_rule *rule, struct proxy * if (i >= FLT_OT_TABLESIZE(flt_ot_group_data)) { FLT_OT_LOG(LOG_ERR, FLT_OT_ACTION_GROUP ": internal error, invalid rule->from=%d", rule->from); - FLT_OT_RETURN(ACT_RET_CONT); + FLT_OT_RETURN_EX(ACT_RET_CONT, enum act_return, "%d"); } list_for_each_entry(ph_scope, &(conf_group->ph_scopes), list) { @@ -117,7 +117,7 @@ static enum act_return flt_ot_group_action(struct act_rule *rule, struct proxy * } } - FLT_OT_RETURN(ACT_RET_CONT); + FLT_OT_RETURN_EX(ACT_RET_CONT, enum act_return, "%d"); } @@ -166,7 +166,7 @@ static int flt_ot_group_check(struct act_rule *rule, struct proxy *px, char **er if (i >= FLT_OT_TABLESIZE(flt_ot_group_data)) { FLT_OT_ERR("internal error, unexpected rule->from=%d, please report this bug!", rule->from); - FLT_OT_RETURN(0); + FLT_OT_RETURN_INT(0); } /* @@ -191,7 +191,7 @@ static int flt_ot_group_check(struct act_rule *rule, struct proxy *px, char **er if (fconf == NULL) { FLT_OT_ERR("unable to find the OpenTracing filter '%s' used by the " FLT_OT_ACTION_GROUP " '%s'", filter_id, group_id); - FLT_OT_RETURN(0); + FLT_OT_RETURN_INT(0); } /* @@ -208,7 +208,7 @@ static int flt_ot_group_check(struct act_rule *rule, struct proxy *px, char **er if (!flag_found) { FLT_OT_ERR("unable to find group '%s' in the OpenTracing filter '%s' configuration", group_id, filter_id); - FLT_OT_RETURN(0); + FLT_OT_RETURN_INT(0); } FLT_OT_FREE_CLEAR(rule->arg.act.p[FLT_OT_ARG_FILTER_ID]); @@ -218,7 +218,7 @@ static int flt_ot_group_check(struct act_rule *rule, struct proxy *px, char **er rule->arg.act.p[FLT_OT_ARG_CONF] = conf; rule->arg.act.p[FLT_OT_ARG_GROUP] = ph_group; - FLT_OT_RETURN(1); + FLT_OT_RETURN_INT(1); } @@ -272,7 +272,7 @@ static enum act_parse_ret flt_ot_group_parse(const char **args, int *cur_arg, st (strcmp(args[*cur_arg + 2], FLT_OT_CONDITION_UNLESS) != 0))) { FLT_OT_ERR("expects: [{ if | unless } ...]"); - FLT_OT_RETURN(ACT_RET_PRS_ERR); + FLT_OT_RETURN_EX(ACT_RET_PRS_ERR, enum act_parse_ret, "%d"); } /* Copy the OpenTracing filter id. */ @@ -280,7 +280,7 @@ static enum act_parse_ret flt_ot_group_parse(const char **args, int *cur_arg, st if (rule->arg.act.p[FLT_OT_ARG_FILTER_ID] == NULL) { FLT_OT_ERR("%s : out of memory", args[*cur_arg]); - FLT_OT_RETURN(ACT_RET_PRS_ERR); + FLT_OT_RETURN_EX(ACT_RET_PRS_ERR, enum act_parse_ret, "%d"); } /* Copy the OpenTracing group id. */ @@ -290,7 +290,7 @@ static enum act_parse_ret flt_ot_group_parse(const char **args, int *cur_arg, st FLT_OT_FREE_CLEAR(rule->arg.act.p[FLT_OT_ARG_FILTER_ID]); - FLT_OT_RETURN(ACT_RET_PRS_ERR); + FLT_OT_RETURN_EX(ACT_RET_PRS_ERR, enum act_parse_ret, "%d"); } rule->action = ACT_CUSTOM; @@ -300,7 +300,7 @@ static enum act_parse_ret flt_ot_group_parse(const char **args, int *cur_arg, st *cur_arg += 2; - FLT_OT_RETURN(ACT_RET_PRS_OK); + FLT_OT_RETURN_EX(ACT_RET_PRS_OK, enum act_parse_ret, "%d"); } diff --git a/addons/ot/src/http.c b/addons/ot/src/http.c index 3376a3b00..517bd0de3 100644 --- a/addons/ot/src/http.c +++ b/addons/ot/src/http.c @@ -97,7 +97,7 @@ struct otc_text_map *flt_ot_http_headers_get(struct channel *chn, const char *pr FLT_OT_FUNC("%p, \"%s\", %zu, %p:%p", chn, prefix, len, FLT_OT_DPTR_ARGS(err)); if (chn == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); /* * The keyword 'inject' allows you to define the name of the OpenTracing @@ -172,7 +172,7 @@ struct otc_text_map *flt_ot_http_headers_get(struct channel *chn, const char *pr otc_text_map_destroy(&retptr, OTC_TEXT_MAP_FREE_KEY | OTC_TEXT_MAP_FREE_VALUE); } - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -205,7 +205,7 @@ int flt_ot_http_header_set(struct channel *chn, const char *prefix, const char * FLT_OT_FUNC("%p, \"%s\", \"%s\", \"%s\", %p:%p", chn, prefix, name, value, FLT_OT_DPTR_ARGS(err)); if ((chn == NULL) || (!FLT_OT_STR_ISVALID(prefix) && !FLT_OT_STR_ISVALID(name))) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); htx = htxbuf(&(chn->buf)); @@ -216,7 +216,7 @@ int flt_ot_http_header_set(struct channel *chn, const char *prefix, const char * if (htx_is_empty(htx)) { FLT_OT_ERR("HTX is empty"); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } if (!FLT_OT_STR_ISVALID(prefix)) { @@ -228,7 +228,7 @@ int flt_ot_http_header_set(struct channel *chn, const char *prefix, const char * else { buffer = flt_ot_trash_alloc(0, err); if (buffer == NULL) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); (void)chunk_printf(buffer, "%s-%s", prefix, name); @@ -272,7 +272,7 @@ int flt_ot_http_header_set(struct channel *chn, const char *prefix, const char * flt_ot_trash_free(&buffer); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -299,7 +299,7 @@ int flt_ot_http_headers_remove(struct channel *chn, const char *prefix, char **e retval = flt_ot_http_header_set(chn, prefix, NULL, NULL, err); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } /* diff --git a/addons/ot/src/opentracing.c b/addons/ot/src/opentracing.c index b79ba2955..8ae5f021c 100644 --- a/addons/ot/src/opentracing.c +++ b/addons/ot/src/opentracing.c @@ -162,13 +162,13 @@ int ot_init(struct otc_tracer **tracer, const char *plugin, char **err) if (getcwd(cwd, sizeof(cwd)) == NULL) { FLT_OT_ERR("failed to get current working directory"); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } rc = snprintf(path, sizeof(path), "%s/%s", cwd, plugin); if ((rc == -1) || (rc >= sizeof(path))) { FLT_OT_ERR("failed to construct the OpenTracing plugin path"); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } *tracer = otc_tracer_load(path, errbuf, sizeof(errbuf)); @@ -180,7 +180,7 @@ int ot_init(struct otc_tracer **tracer, const char *plugin, char **err) retval = 0; } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -207,13 +207,13 @@ int ot_start(struct otc_tracer *tracer, const char *cfgbuf, char **err) FLT_OT_FUNC("%p, %p, %p:%p", tracer, cfgbuf, FLT_OT_DPTR_ARGS(err)); if (cfgbuf == NULL) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); retval = otc_tracer_start(NULL, cfgbuf, errbuf, sizeof(errbuf)); if (retval == -1) FLT_OT_ERR("%s", (*errbuf == '\0') ? "failed to start tracer" : errbuf); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -277,9 +277,9 @@ struct otc_span *ot_span_init(struct otc_tracer *tracer, const char *operation_n FLT_OT_FUNC("%p, \"%s\", %p, %p, %d, %d, %p, %p, %d, %p:%p", tracer, operation_name, ts_steady, ts_system, ref_type, ref_ctx_idx, ref_span, tags, num_tags, FLT_OT_DPTR_ARGS(err)); if (operation_name == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); else if (tracer == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); (void)memset(&options, 0, sizeof(options)); @@ -303,7 +303,7 @@ struct otc_span *ot_span_init(struct otc_tracer *tracer, const char *operation_n else FLT_OT_DBG(2, "span %p:%zd initialized", retptr, retptr->idx); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -354,7 +354,7 @@ struct otc_span *ot_span_init_va(struct otc_tracer *tracer, const char *operatio retptr = ot_span_init(tracer, operation_name, ts_steady, ts_system, ref_type, ref_ctx_idx, ref_span, tags, num_tags, err); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -380,12 +380,12 @@ int ot_span_tag(struct otc_span *span, const struct otc_tag *tags, int num_tags) FLT_OT_FUNC("%p, %p, %d", span, tags, num_tags); if ((span == NULL) || (tags == NULL)) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); for (retval = 0; retval < num_tags; retval++) span->set_tag(span, tags[retval].key, &(tags[retval].value)); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -414,7 +414,7 @@ int ot_span_tag_va(struct otc_span *span, const char *key, int type, ...) FLT_OT_FUNC("%p, \"%s\", %d, ...", span, key, type); if ((span == NULL) || (key == NULL)) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); va_start(ap, type); for (retval = 0; (key != NULL) && FLT_OT_IN_RANGE(type, otc_value_bool, otc_value_null); retval++) { @@ -439,7 +439,7 @@ int ot_span_tag_va(struct otc_span *span, const char *key, int type, ...) } va_end(ap); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -465,13 +465,13 @@ int ot_span_log(struct otc_span *span, const struct otc_log_field *log_fields, i FLT_OT_FUNC("%p, %p, %d", span, log_fields, num_fields); if ((span == NULL) || (log_fields == NULL)) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); retval = MIN(OTC_MAXLOGFIELDS, num_fields); span->log_fields(span, log_fields, retval); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -499,7 +499,7 @@ int ot_span_log_va(struct otc_span *span, const char *key, const char *value, .. FLT_OT_FUNC("%p, \"%s\", \"%s\", ...", span, key, value); if ((span == NULL) || (key == NULL) || (value == NULL)) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); va_start(ap, value); for (retval = 0; (retval < FLT_OT_TABLESIZE(log_field)) && (key != NULL); retval++) { @@ -515,7 +515,7 @@ int ot_span_log_va(struct otc_span *span, const char *key, const char *value, .. span->log_fields(span, log_field, retval); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -543,7 +543,7 @@ int ot_span_log_fmt(struct otc_span *span, const char *key, const char *format, FLT_OT_FUNC("%p, \"%s\", \"%s\", ...", span, key, format); if ((span == NULL) || (key == NULL) || (format == NULL)) - FLT_OT_RETURN(-1); + FLT_OT_RETURN_INT(-1); va_start(ap, format); n = vsnprintf(value, sizeof(value), format, ap); @@ -554,7 +554,7 @@ int ot_span_log_fmt(struct otc_span *span, const char *key, const char *format, } va_end(ap); - FLT_OT_RETURN(ot_span_log_va(span, key, value, NULL)); + FLT_OT_RETURN_INT(ot_span_log_va(span, key, value, NULL)); } @@ -580,10 +580,10 @@ int ot_span_set_baggage(struct otc_span *span, const struct otc_text_map *baggag FLT_OT_FUNC("%p, %p", span, baggage); if ((span == NULL) || (baggage == NULL)) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); if ((baggage->key == NULL) || (baggage->value == NULL)) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); for (retval = i = 0; i < baggage->count; i++) { FLT_OT_DBG(3, "set baggage: \"%s\" -> \"%s\"", baggage->key[i], baggage->value[i]); @@ -595,7 +595,7 @@ int ot_span_set_baggage(struct otc_span *span, const struct otc_text_map *baggag } } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -622,7 +622,7 @@ int ot_span_set_baggage_va(struct otc_span *span, const char *key, const char *v FLT_OT_FUNC("%p, \"%s\", \"%s\", ...", span, key, value); if ((span == NULL) || (key == NULL) || (value == NULL)) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); va_start(ap, value); for (retval = 0; (key != NULL); retval++) { @@ -636,7 +636,7 @@ int ot_span_set_baggage_va(struct otc_span *span, const char *key, const char *v } va_end(ap); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -663,7 +663,7 @@ struct otc_text_map *ot_span_baggage_va(const struct otc_span *span, const char FLT_OT_FUNC("%p, \"%s\", ...", span, key); if ((span == NULL) || (key == NULL)) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); va_start(ap, key); for (n = 1; va_arg(ap, typeof(key)) != NULL; n++); @@ -671,7 +671,7 @@ struct otc_text_map *ot_span_baggage_va(const struct otc_span *span, const char retptr = otc_text_map_new(NULL, n); if (retptr == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); va_start(ap, key); for (i = 0; (i < n) && (key != NULL); i++) { @@ -689,7 +689,7 @@ struct otc_text_map *ot_span_baggage_va(const struct otc_span *span, const char } va_end(ap); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -716,13 +716,13 @@ struct otc_span_context *ot_inject_text_map(struct otc_tracer *tracer, const str FLT_OT_FUNC("%p, %p, %p", tracer, span, carrier); if ((span == NULL) || (carrier == NULL)) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); else if (tracer == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); retptr = span->span_context((struct otc_span *)span); if (retptr == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); (void)memset(carrier, 0, sizeof(*carrier)); @@ -737,7 +737,7 @@ struct otc_span_context *ot_inject_text_map(struct otc_tracer *tracer, const str #endif } - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -765,15 +765,15 @@ struct otc_span_context *ot_inject_http_headers(struct otc_tracer *tracer, const FLT_OT_FUNC("%p, %p, %p, %p:%p", tracer, span, carrier, FLT_OT_DPTR_ARGS(err)); if ((span == NULL) || (carrier == NULL)) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); else if (tracer == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); retptr = span->span_context((struct otc_span *)span); if (retptr == NULL) { FLT_OT_ERR("failed to create span context"); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } (void)memset(carrier, 0, sizeof(*carrier)); @@ -791,7 +791,7 @@ struct otc_span_context *ot_inject_http_headers(struct otc_tracer *tracer, const #endif } - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -818,13 +818,13 @@ struct otc_span_context *ot_inject_binary(struct otc_tracer *tracer, const struc FLT_OT_FUNC("%p, %p, %p", tracer, span, carrier); if ((span == NULL) || (carrier == NULL)) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); else if (tracer == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); retptr = span->span_context((struct otc_span *)span); if (retptr == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); (void)memset(carrier, 0, sizeof(*carrier)); @@ -844,7 +844,7 @@ struct otc_span_context *ot_inject_binary(struct otc_tracer *tracer, const struc #endif } - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -871,9 +871,9 @@ struct otc_span_context *ot_extract_text_map(struct otc_tracer *tracer, struct o FLT_OT_FUNC("%p, %p, %p", tracer, carrier, text_map); if (carrier == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); else if (tracer == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); if (text_map != NULL) { (void)memset(carrier, 0, sizeof(*carrier)); @@ -888,7 +888,7 @@ struct otc_span_context *ot_extract_text_map(struct otc_tracer *tracer, struct o else if (retptr != NULL) FLT_OT_DBG_SPAN_CONTEXT(retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -916,9 +916,9 @@ struct otc_span_context *ot_extract_http_headers(struct otc_tracer *tracer, stru FLT_OT_FUNC("%p, %p, %p, %p:%p", tracer, carrier, text_map, FLT_OT_DPTR_ARGS(err)); if (carrier == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); else if (tracer == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); if (text_map != NULL) { (void)memset(carrier, 0, sizeof(*carrier)); @@ -936,7 +936,7 @@ struct otc_span_context *ot_extract_http_headers(struct otc_tracer *tracer, stru else if (retptr != NULL) FLT_OT_DBG_SPAN_CONTEXT(retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -963,9 +963,9 @@ struct otc_span_context *ot_extract_binary(struct otc_tracer *tracer, struct otc FLT_OT_FUNC("%p, %p, %p", tracer, carrier, binary_data); if (carrier == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); else if (tracer == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); if ((FLT_OT_DEREF(binary_data, data, NULL) != NULL) && (binary_data->size > 0)) { (void)memset(carrier, 0, sizeof(*carrier)); @@ -980,7 +980,7 @@ struct otc_span_context *ot_extract_binary(struct otc_tracer *tracer, struct otc else if (retptr != NULL) FLT_OT_DBG_SPAN_CONTEXT(retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } diff --git a/addons/ot/src/parser.c b/addons/ot/src/parser.c index ae09e027e..aed328614 100644 --- a/addons/ot/src/parser.c +++ b/addons/ot/src/parser.c @@ -67,7 +67,7 @@ static int flt_ot_parse_strdup(char **ptr, const char *str, char **err, const ch retval |= ERR_ABORT | ERR_ALERT; } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -112,7 +112,7 @@ static int flt_ot_parse_keyword(char **ptr, char **args, int cur_arg, int pos, c retval = flt_ot_parse_strdup(ptr, args[pos + 1], err, args[cur_arg]); } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -137,7 +137,7 @@ static const char *flt_ot_parse_invalid_char(const char *name, int type) FLT_OT_FUNC("\"%s\", %d", name, type); if (!FLT_OT_STR_ISVALID(name)) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_EX(retptr, const char *, "%p"); if (type == 1) { retptr = invalid_char(name); @@ -162,7 +162,7 @@ static const char *flt_ot_parse_invalid_char(const char *name, int type) retptr = NULL; } - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_EX(retptr, const char *, "%p"); } @@ -241,7 +241,7 @@ static int flt_ot_parse_cfg_check(const char *file, int linenum, char **args, co if (!(retval & ERR_CODE) && (*pdata)->flag_check_id && (id == NULL)) FLT_OT_PARSE_ERR(err, "'%s' : %s ID not set (use '%s%s')", args[0], parse_data[1].name, parse_data[1].name, parse_data[1].usage); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -285,7 +285,7 @@ static int flt_ot_parse_cfg_sample_expr(const char *file, int linenum, char **ar if (retval & ERR_CODE) flt_ot_conf_sample_expr_free(&expr); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -335,7 +335,7 @@ static int flt_ot_parse_cfg_sample(const char *file, int linenum, char **args, s else FLT_OT_DBG(3, "sample '%s' -> '%s' added", sample->key, sample->value); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -371,7 +371,7 @@ static int flt_ot_parse_cfg_str(const char *file, int linenum, char **args, stru if (retval & ERR_CODE) flt_ot_conf_str_free(&str); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -409,7 +409,7 @@ static int flt_ot_parse_cfg_file(char **ptr, const char *file, int linenum, char else retval = flt_ot_parse_keyword(ptr, args, 0, 0, err, err_msg); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -470,13 +470,13 @@ static int flt_ot_parse_cfg_tracer(const char *file, int linenum, char **args, i FLT_OT_FUNC("\"%s\", %d, %p, 0x%08x", file, linenum, args, kw_mod); if (flt_ot_parse_check_scope()) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); retval = flt_ot_parse_cfg_check(file, linenum, args, flt_ot_current_tracer, parse_data, FLT_OT_TABLESIZE(parse_data), &pdata, &err); if (retval & ERR_CODE) { FLT_OT_PARSE_IFERR_ALERT(); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } if (pdata->keyword == FLT_OT_PARSE_TRACER_ID) { @@ -554,7 +554,7 @@ static int flt_ot_parse_cfg_tracer(const char *file, int linenum, char **args, i if ((retval & ERR_CODE) && (flt_ot_current_tracer != NULL)) flt_ot_conf_tracer_free(&flt_ot_current_tracer); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -580,12 +580,12 @@ static int flt_ot_post_parse_cfg_tracer(void) FLT_OT_FUNC(""); if (flt_ot_current_tracer == NULL) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); flt_ot_current_config->tracer = flt_ot_current_tracer; if (flt_ot_current_tracer->id == NULL) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); if (flt_ot_current_tracer->config == NULL) { FLT_OT_POST_PARSE_ALERT("tracer '%s' has no configuration file specified", flt_ot_current_tracer->cfg_line, flt_ot_current_tracer->id); @@ -600,7 +600,7 @@ static int flt_ot_post_parse_cfg_tracer(void) flt_ot_current_tracer = NULL; - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -633,13 +633,13 @@ static int flt_ot_parse_cfg_group(const char *file, int linenum, char **args, in FLT_OT_FUNC("\"%s\", %d, %p, 0x%08x", file, linenum, args, kw_mod); if (flt_ot_parse_check_scope()) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); retval = flt_ot_parse_cfg_check(file, linenum, args, flt_ot_current_group, parse_data, FLT_OT_TABLESIZE(parse_data), &pdata, &err); if (retval & ERR_CODE) { FLT_OT_PARSE_IFERR_ALERT(); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } if (pdata->keyword == FLT_OT_PARSE_GROUP_ID) { @@ -658,7 +658,7 @@ static int flt_ot_parse_cfg_group(const char *file, int linenum, char **args, in if ((retval & ERR_CODE) && (flt_ot_current_group != NULL)) flt_ot_conf_group_free(&flt_ot_current_group); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -683,7 +683,7 @@ static int flt_ot_post_parse_cfg_group(void) FLT_OT_FUNC(""); if (flt_ot_current_group == NULL) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); /* Check that the group has at least one scope defined. */ if (LIST_ISEMPTY(&(flt_ot_current_group->ph_scopes))) @@ -691,7 +691,7 @@ static int flt_ot_post_parse_cfg_group(void) flt_ot_current_group = NULL; - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -736,7 +736,7 @@ static int flt_ot_parse_cfg_scope_ctx(char **args, int cur_arg, char **err) FLT_OT_DBG(2, "ctx_flags: 0x%02hhx (0x%02hhx)", flt_ot_current_span->ctx_flags, flags); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -776,7 +776,7 @@ static struct acl_cond *flt_ot_parse_acl(const char *file, int linenum, struct p if ((retptr != NULL) && (err != NULL)) FLT_OT_FREE_CLEAR(*err); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -809,13 +809,13 @@ static int flt_ot_parse_cfg_scope(const char *file, int linenum, char **args, in FLT_OT_FUNC("\"%s\", %d, %p, 0x%08x", file, linenum, args, kw_mod); if (flt_ot_parse_check_scope()) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); retval = flt_ot_parse_cfg_check(file, linenum, args, flt_ot_current_span, parse_data, FLT_OT_TABLESIZE(parse_data), &pdata, &err); if (retval & ERR_CODE) { FLT_OT_PARSE_IFERR_ALERT(); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } if (pdata->keyword == FLT_OT_PARSE_SCOPE_ID) { @@ -1009,7 +1009,7 @@ static int flt_ot_parse_cfg_scope(const char *file, int linenum, char **args, in flt_ot_current_span = NULL; } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -1038,7 +1038,7 @@ static int flt_ot_post_parse_cfg_scope(void) FLT_OT_FUNC(""); if (flt_ot_current_scope == NULL) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); /* If span context inject is used, check that this is possible. */ list_for_each_entry(conf_span, &(flt_ot_current_scope->spans), list) @@ -1052,7 +1052,7 @@ static int flt_ot_post_parse_cfg_scope(void) flt_ot_current_scope = NULL; flt_ot_current_span = NULL; - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -1103,7 +1103,7 @@ static int flt_ot_parse_cfg(struct flt_ot_conf *conf, const char *flt_name, char flt_ot_current_config = NULL; - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -1148,7 +1148,7 @@ static int flt_ot_parse(char **args, int *cur_arg, struct proxy *px, struct flt_ if (otc_dbg_mem_init(&dbg_mem, dbg_mem_data, FLT_OT_TABLESIZE(dbg_mem_data), 0xff) == -1) { FLT_OT_PARSE_ERR(err, "cannot initialize memory debugger"); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } ); #endif @@ -1159,7 +1159,7 @@ static int flt_ot_parse(char **args, int *cur_arg, struct proxy *px, struct flt_ if (conf == NULL) { FLT_OT_PARSE_ERR(err, "'%s' : out of memory", args[*cur_arg]); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } for (pos = *cur_arg + 1; !(retval & ERR_CODE) && FLT_OT_ARG_ISVALID(pos); pos++) { @@ -1202,7 +1202,7 @@ static int flt_ot_parse(char **args, int *cur_arg, struct proxy *px, struct flt_ FLT_OT_DBG(3, "filter set: id '%s', config '%s'", conf->id, conf->cfg_file); } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } diff --git a/addons/ot/src/pool.c b/addons/ot/src/pool.c index 0ee542654..fbcdbfc21 100644 --- a/addons/ot/src/pool.c +++ b/addons/ot/src/pool.c @@ -55,7 +55,7 @@ void *flt_ot_pool_alloc(struct pool_head *pool, size_t size, bool flag_clear, ch else if (flag_clear) (void)memset(retptr, 0, size); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -97,7 +97,7 @@ void *flt_ot_pool_strndup(struct pool_head *pool, const char *s, size_t size, ch else FLT_OT_ERR("out of memory"); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -175,7 +175,7 @@ struct buffer *flt_ot_trash_alloc(bool flag_clear, char **err) else if (flag_clear) (void)memset(retptr->area, 0, retptr->size); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } diff --git a/addons/ot/src/scope.c b/addons/ot/src/scope.c index 80b0bc21b..efe8fe29f 100644 --- a/addons/ot/src/scope.c +++ b/addons/ot/src/scope.c @@ -102,7 +102,7 @@ struct flt_ot_runtime_context *flt_ot_runtime_context_init(struct stream *s, str retptr = flt_ot_pool_alloc(pool_head_ot_runtime_context, sizeof(*retptr), 1, err); if (retptr == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); retptr->stream = s; retptr->filter = f; @@ -126,7 +126,7 @@ struct flt_ot_runtime_context *flt_ot_runtime_context_init(struct stream *s, str FLT_OT_DBG_RUNTIME_CONTEXT("session context: ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -210,13 +210,13 @@ struct flt_ot_scope_span *flt_ot_scope_span_init(struct flt_ot_runtime_context * FLT_OT_FUNC("%p, \"%s\", %zu, %d, \"%s\", %zu, %u, %p:%p", rt_ctx, id, id_len, ref_type, ref_id, ref_id_len, dir, FLT_OT_DPTR_ARGS(err)); if ((rt_ctx == NULL) || (id == NULL)) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); list_for_each_entry(span, &(rt_ctx->spans), list) if ((span->id_len == id_len) && (memcmp(span->id, id, id_len) == 0)) { FLT_OT_DBG(2, "found span %p", span); - FLT_OT_RETURN(span); + FLT_OT_RETURN_PTR(span); } if (ref_id != NULL) { @@ -242,14 +242,14 @@ struct flt_ot_scope_span *flt_ot_scope_span_init(struct flt_ot_runtime_context * } else { FLT_OT_ERR("cannot find referenced span/context '%s'", ref_id); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } } } retptr = flt_ot_pool_alloc(pool_head_ot_scope_span, sizeof(*retptr), 1, err); if (retptr == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); retptr->id = id; retptr->id_len = id_len; @@ -261,7 +261,7 @@ struct flt_ot_scope_span *flt_ot_scope_span_init(struct flt_ot_runtime_context * FLT_OT_DBG_SCOPE_SPAN("new span ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -329,24 +329,24 @@ struct flt_ot_scope_context *flt_ot_scope_context_init(struct flt_ot_runtime_con FLT_OT_FUNC("%p, %p, \"%s\", %zu, %p, %u, %p:%p", rt_ctx, tracer, id, id_len, text_map, dir, FLT_OT_DPTR_ARGS(err)); if ((rt_ctx == NULL) || (tracer == NULL) || (id == NULL) || (text_map == NULL)) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); list_for_each_entry(retptr, &(rt_ctx->contexts), list) if ((retptr->id_len == id_len) && (memcmp(retptr->id, id, id_len) == 0)) { FLT_OT_DBG(2, "found context %p", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } retptr = flt_ot_pool_alloc(pool_head_ot_scope_context, sizeof(*retptr), 1, err); if (retptr == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); span_ctx = ot_extract_http_headers(tracer, &reader, text_map, err); if (span_ctx == NULL) { flt_ot_scope_context_free(&retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } retptr->id = id; @@ -357,7 +357,7 @@ struct flt_ot_scope_context *flt_ot_scope_context_init(struct flt_ot_runtime_con FLT_OT_DBG_SCOPE_CONTEXT("new context ", retptr); - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } @@ -524,7 +524,7 @@ int flt_ot_scope_finish_mark(const struct flt_ot_runtime_context *rt_ctx, const retval = span_cnt + ctx_cnt; - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } diff --git a/addons/ot/src/util.c b/addons/ot/src/util.c index f6812bcc2..767685ea9 100644 --- a/addons/ot/src/util.c +++ b/addons/ot/src/util.c @@ -327,7 +327,7 @@ ssize_t flt_ot_chunk_add(struct buffer *chk, const void *src, size_t n, char **e FLT_OT_FUNC("%p, %p, %zu, %p:%p", chk, src, n, FLT_OT_DPTR_ARGS(err)); if ((chk == NULL) || (src == NULL)) - FLT_OT_RETURN(-1); + FLT_OT_RETURN_EX(-1, ssize_t, "%ld"); if (chk->area == NULL) chunk_init(chk, FLT_OT_CALLOC(1, global.tune.bufsize), global.tune.bufsize); @@ -335,18 +335,18 @@ ssize_t flt_ot_chunk_add(struct buffer *chk, const void *src, size_t n, char **e if (chk->area == NULL) { FLT_OT_ERR("out of memory"); - FLT_OT_RETURN(-1); + FLT_OT_RETURN_EX(-1, ssize_t, "%ld"); } else if (n > (chk->size - chk->data)) { FLT_OT_ERR("chunk size too small"); - FLT_OT_RETURN(-1); + FLT_OT_RETURN_EX(-1, ssize_t, "%ld"); } (void)memcpy(chk->area + chk->data, src, n); chk->data += n; - FLT_OT_RETURN(chk->data); + FLT_OT_RETURN_EX(chk->data, ssize_t, "%ld"); } @@ -512,7 +512,7 @@ int flt_ot_sample_to_str(const struct sample_data *data, char *value, size_t siz FLT_OT_FUNC("%p, %p, %zu, %p:%p", data, value, size, FLT_OT_DPTR_ARGS(err)); if ((data == NULL) || (value == NULL) || (size == 0)) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); *value = '\0'; @@ -623,7 +623,7 @@ int flt_ot_sample_to_str(const struct sample_data *data, char *value, size_t siz FLT_OT_ERR("invalid HTTP method"); } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -650,7 +650,7 @@ int flt_ot_sample_to_value(const char *key, const struct sample_data *data, stru FLT_OT_FUNC("\"%s\", %p, %p, %p:%p", key, data, value, FLT_OT_DPTR_ARGS(err)); if ((data == NULL) || (value == NULL)) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); if (data->type == SMP_T_BOOL) { value->type = otc_value_bool; @@ -674,7 +674,7 @@ int flt_ot_sample_to_value(const char *key, const struct sample_data *data, stru retval = flt_ot_sample_to_str(data, (char *)value->value.string_value, global.tune.bufsize, err); } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -802,7 +802,7 @@ int flt_ot_sample_add(struct stream *s, uint dir, struct flt_ot_conf_sample *sam FLT_OT_DBG(3, "baggage[%zu]: '%s' -> '%s'", data->baggage->count - 1, data->baggage->key[data->baggage->count - 1], data->baggage->value[data->baggage->count - 1]); } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } /* diff --git a/addons/ot/src/vars.c b/addons/ot/src/vars.c index 4a2b11dce..f2e1050a4 100644 --- a/addons/ot/src/vars.c +++ b/addons/ot/src/vars.c @@ -174,7 +174,7 @@ static int flt_ot_normalize_name(char *var_name, size_t size, int *len, const ch FLT_OT_FUNC("%p, %zu, %p, \"%s\", %hhu, %p:%p", var_name, size, len, name, flag_cpy, FLT_OT_DPTR_ARGS(err)); if (!FLT_OT_STR_ISVALID(name)) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); /* * In case the name of the variable consists of several elements, @@ -232,7 +232,7 @@ static int flt_ot_normalize_name(char *var_name, size_t size, int *len, const ch if (retval == -1) *len = retval; - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -270,7 +270,7 @@ static int flt_ot_var_name(const char *scope, const char *prefix, const char *na if (retval == -1) FLT_OT_ERR("failed to construct variable name '%s.%s.%s'", scope, prefix, name); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -300,7 +300,7 @@ int flt_ot_var_register(const char *scope, const char *prefix, const char *name, var_name_len = flt_ot_var_name(scope, prefix, name, 0, var_name, sizeof(var_name), err); if (var_name_len == -1) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); /* Set to 0 to not release var_name memory in vars_check_arg(). */ (void)memset(&arg, 0, sizeof(arg)); @@ -316,7 +316,7 @@ int flt_ot_var_register(const char *scope, const char *prefix, const char *name, retval = var_name_len; } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -349,7 +349,7 @@ int flt_ot_var_set(struct stream *s, const char *scope, const char *prefix, cons var_name_len = flt_ot_var_name(scope, prefix, name, 0, var_name, sizeof(var_name), err); if (var_name_len == -1) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); flt_ot_smp_init(s, &smp, opt, SMP_T_STR, value); @@ -361,7 +361,7 @@ int flt_ot_var_set(struct stream *s, const char *scope, const char *prefix, cons retval = var_name_len; } - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -395,11 +395,11 @@ int flt_ot_vars_unset(struct stream *s, const char *scope, const char *prefix, u vars = flt_ot_get_vars(s, scope); if (vars == NULL) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); var_prefix_len = flt_ot_var_name(NULL, prefix, NULL, 0, var_prefix, sizeof(var_prefix), err); if (var_prefix_len == -1) - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); retval = 0; @@ -426,7 +426,7 @@ int flt_ot_vars_unset(struct stream *s, const char *scope, const char *prefix, u } vars_wrunlock(vars); - FLT_OT_RETURN(retval); + FLT_OT_RETURN_INT(retval); } @@ -459,11 +459,11 @@ struct otc_text_map *flt_ot_vars_get(struct stream *s, const char *scope, const vars = flt_ot_get_vars(s, scope); if (vars == NULL) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); rc = flt_ot_var_name(NULL, prefix, NULL, 0, var_name, sizeof(var_name), err); if (rc == -1) - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); vars_rdlock(vars); list_for_each_entry(var, &(vars->head), l) { @@ -529,7 +529,7 @@ struct otc_text_map *flt_ot_vars_get(struct stream *s, const char *scope, const otc_text_map_destroy(&retptr, OTC_TEXT_MAP_FREE_KEY | OTC_TEXT_MAP_FREE_VALUE); } - FLT_OT_RETURN(retptr); + FLT_OT_RETURN_PTR(retptr); } /*