]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: actions: Rename the act_flag enum into act_opt
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 18 Dec 2019 13:41:51 +0000 (14:41 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 20 Jan 2020 14:18:45 +0000 (15:18 +0100)
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
src/flt_spoe.c
src/hlua.c
src/http_ana.c
src/stream.c
src/tcp_rules.c

index 5b4ede7c96d310cacc85d9b36977032b1015012b..d13a54903fd077c3854bc0c33df750c48f13617f 100644 (file)
@@ -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;
index d458f19d6c1ca3dd2fde205ff524a5ee2fe7fadf..e3328cc0127dac58d2c7e37d265efd2e6332cce4 100644 (file)
@@ -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,
index ee36cd9c2342b45380dc367b971ce144ed8a5553..694b3ffc22640c6f72043085594c6d68b1d7a7b6 100644 (file)
@@ -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)) {
index 7f14c4b8aff00789bca7b57b42fc5c412e9667a8..171ddfdc26773f927502ccc17bff73f1f6ecea0b 100644 (file)
@@ -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:
index d16def53dcc41ef145657f7e7554814d7801d5e9..941e98e395f78e5ff3d3cea3542277b065468a63 100644 (file)
@@ -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))))
index 988c8e9b4dd871348a07cc0b86a2e7cc1b0de676..ebf4e05c72366956b49017e6f1dbb24d2dfc1cd9 100644 (file)
@@ -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.