From 105ba6cc54b45011ee8110cee5c4ecdb4946f6e6 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 18 Dec 2019 14:41:51 +0100 Subject: [PATCH] MINOR: actions: Rename the act_flag enum into act_opt The flags in the act_flag enum have been renamed act_opt. It means ACT_OPT prefix is used instead of ACT_FLAG. The purpose of this patch is to reserve the action flags for the actions configuration. --- include/types/action.h | 12 ++++++------ src/flt_spoe.c | 2 +- src/hlua.c | 2 +- src/http_ana.c | 16 ++++++++-------- src/stream.c | 2 +- src/tcp_rules.c | 20 ++++++++++---------- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/types/action.h b/include/types/action.h index 5b4ede7c9..d13a54903 100644 --- a/include/types/action.h +++ b/include/types/action.h @@ -52,11 +52,11 @@ enum act_parse_ret { ACT_RET_PRS_ERR, /* abort processing. */ }; -/* flags passed to custom actions */ -enum act_flag { - ACT_FLAG_NONE = 0x00000000, /* no flag */ - ACT_FLAG_FINAL = 0x00000001, /* last call, cannot yield */ - ACT_FLAG_FIRST = 0x00000002, /* first call for this action */ +/* Option flags passed to custom actions */ +enum act_opt { + ACT_OPT_NONE = 0x00000000, /* no flag */ + ACT_OPT_FINAL = 0x00000001, /* last call, cannot yield */ + ACT_OPT_FIRST = 0x00000002, /* first call for this action */ }; /* known actions to be used without any action function pointer. This enum is @@ -112,7 +112,7 @@ struct act_rule { enum act_name action; /* ACT_ACTION_* */ enum act_from from; /* ACT_F_* */ enum act_return (*action_ptr)(struct act_rule *rule, struct proxy *px, /* ptr to custom action */ - struct session *sess, struct stream *s, int flags); + struct session *sess, struct stream *s, int opts); int (*check_ptr)(struct act_rule *rule, struct proxy *px, char **err); /* ptr to check function */ void (*release_ptr)(struct act_rule *rule); /* ptr to release function */ struct action_kw *kw; diff --git a/src/flt_spoe.c b/src/flt_spoe.c index d458f19d6..e3328cc01 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -4538,7 +4538,7 @@ spoe_send_group(struct act_rule *rule, struct proxy *px, if (ret == 1) return ACT_RET_CONT; else if (ret == 0) { - if (flags & ACT_FLAG_FINAL) { + if (flags & ACT_OPT_FINAL) { SPOE_PRINTF(stderr, "%d.%06d [SPOE/%-15s] %s: stream=%p" " - failed to process group '%s': interrupted by caller\n", (int)now.tv_sec, (int)now.tv_usec, diff --git a/src/hlua.c b/src/hlua.c index ee36cd9c2..694b3ffc2 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -6221,7 +6221,7 @@ static enum act_return hlua_action(struct act_rule *rule, struct proxy *px, } /* Execute the function. */ - switch (hlua_ctx_resume(s->hlua, !(flags & ACT_FLAG_FINAL))) { + switch (hlua_ctx_resume(s->hlua, !(flags & ACT_OPT_FINAL))) { /* finished. */ case HLUA_E_OK: if (!consistency_check(s, dir, &s->hlua->cons)) { diff --git a/src/http_ana.c b/src/http_ana.c index 7f14c4b8a..171ddfdc2 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -2927,7 +2927,7 @@ static enum rule_result http_req_get_intercept_rule(struct proxy *px, struct lis struct http_hdr_ctx ctx; const char *auth_realm; enum rule_result rule_ret = HTTP_RULE_RES_CONT; - int act_flags = 0; + int act_opts = 0; int early_hints = 0; htx = htxbuf(&s->req.buf); @@ -2963,7 +2963,7 @@ static enum rule_result http_req_get_intercept_rule(struct proxy *px, struct lis continue; } - act_flags |= ACT_FLAG_FIRST; + act_opts |= ACT_OPT_FIRST; resume_execution: if (early_hints && rule->action != ACT_HTTP_EARLY_HINT) { early_hints = 0; @@ -2978,9 +2978,9 @@ static enum rule_result http_req_get_intercept_rule(struct proxy *px, struct lis if ((s->req.flags & CF_READ_ERROR) || ((s->req.flags & (CF_SHUTR|CF_READ_NULL)) && (px->options & PR_O_ABRT_CLOSE))) - act_flags |= ACT_FLAG_FINAL; + act_opts |= ACT_OPT_FINAL; - switch (rule->action_ptr(rule, px, sess, s, act_flags)) { + switch (rule->action_ptr(rule, px, sess, s, act_opts)) { case ACT_RET_CONT: break; case ACT_RET_STOP: @@ -3341,7 +3341,7 @@ static enum rule_result http_res_get_intercept_rule(struct proxy *px, struct lis struct act_rule *rule; struct http_hdr_ctx ctx; enum rule_result rule_ret = HTTP_RULE_RES_CONT; - int act_flags = 0; + int act_opts = 0; htx = htxbuf(&s->res.buf); @@ -3376,7 +3376,7 @@ static enum rule_result http_res_get_intercept_rule(struct proxy *px, struct lis continue; } - act_flags |= ACT_FLAG_FIRST; + act_opts |= ACT_OPT_FIRST; resume_execution: /* Always call the action function if defined */ @@ -3384,9 +3384,9 @@ resume_execution: if ((s->req.flags & CF_READ_ERROR) || ((s->req.flags & (CF_SHUTR|CF_READ_NULL)) && (px->options & PR_O_ABRT_CLOSE))) - act_flags |= ACT_FLAG_FINAL; + act_opts |= ACT_OPT_FINAL; - switch (rule->action_ptr(rule, px, sess, s, act_flags)) { + switch (rule->action_ptr(rule, px, sess, s, act_opts)) { case ACT_RET_CONT: break; case ACT_RET_STOP: diff --git a/src/stream.c b/src/stream.c index d16def53d..941e98e39 100644 --- a/src/stream.c +++ b/src/stream.c @@ -987,7 +987,7 @@ enum act_return process_use_service(struct act_rule *rule, struct proxy *px, struct appctx *appctx; /* Initialises the applet if it is required. */ - if (flags & ACT_FLAG_FIRST) { + if (flags & ACT_OPT_FIRST) { /* Register applet. this function schedules the applet. */ s->target = &rule->applet.obj_type; if (unlikely(!si_register_handler(&s->si[1], objt_applet(s->target)))) diff --git a/src/tcp_rules.c b/src/tcp_rules.c index 988c8e9b4..ebf4e05c7 100644 --- a/src/tcp_rules.c +++ b/src/tcp_rules.c @@ -104,7 +104,7 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit) struct stksess *ts; struct stktable *t; int partial; - int act_flags = 0; + int act_opts = 0; DBG_TRACE_ENTER(STRM_EV_STRM_ANA|STRM_EV_TCP_ANA, s); @@ -151,15 +151,15 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit) } if (ret) { - act_flags |= ACT_FLAG_FIRST; + act_opts |= ACT_OPT_FIRST; resume_execution: /* Always call the action function if defined */ if (rule->action_ptr) { if (partial & SMP_OPT_FINAL) - act_flags |= ACT_FLAG_FINAL; + act_opts |= ACT_OPT_FINAL; - switch (rule->action_ptr(rule, s->be, s->sess, s, act_flags)) { + switch (rule->action_ptr(rule, s->be, s->sess, s, act_opts)) { case ACT_RET_CONT: break; case ACT_RET_STOP: @@ -303,7 +303,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit) struct session *sess = s->sess; struct act_rule *rule; int partial; - int act_flags = 0; + int act_opts = 0; DBG_TRACE_ENTER(STRM_EV_STRM_ANA|STRM_EV_TCP_ANA, s); @@ -354,14 +354,14 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit) } if (ret) { - act_flags |= ACT_FLAG_FIRST; + act_opts |= ACT_OPT_FIRST; resume_execution: /* Always call the action function if defined */ if (rule->action_ptr) { if (partial & SMP_OPT_FINAL) - act_flags |= ACT_FLAG_FINAL; + act_opts |= ACT_OPT_FINAL; - switch (rule->action_ptr(rule, s->be, s->sess, s, act_flags)) { + switch (rule->action_ptr(rule, s->be, s->sess, s, act_opts)) { case ACT_RET_CONT: break; case ACT_RET_STOP: @@ -486,7 +486,7 @@ int tcp_exec_l4_rules(struct session *sess) if (ret) { /* Always call the action function if defined */ if (rule->action_ptr) { - switch (rule->action_ptr(rule, sess->fe, sess, NULL, ACT_FLAG_FINAL | ACT_FLAG_FIRST)) { + switch (rule->action_ptr(rule, sess->fe, sess, NULL, ACT_OPT_FINAL | ACT_OPT_FIRST)) { case ACT_RET_YIELD: /* yield is not allowed at this point. If this return code is * used it is a bug, so I prefer to abort the process. @@ -588,7 +588,7 @@ int tcp_exec_l5_rules(struct session *sess) if (ret) { /* Always call the action function if defined */ if (rule->action_ptr) { - switch (rule->action_ptr(rule, sess->fe, sess, NULL, ACT_FLAG_FINAL | ACT_FLAG_FIRST)) { + switch (rule->action_ptr(rule, sess->fe, sess, NULL, ACT_OPT_FINAL | ACT_OPT_FIRST)) { case ACT_RET_YIELD: /* yield is not allowed at this point. If this return code is * used it is a bug, so I prefer to abort the process.