]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stick-table: make skttable_data_cast to use only std types
authorEmeric Brun <ebrun@haproxy.com>
Wed, 30 Jun 2021 15:18:28 +0000 (17:18 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 6 Jul 2021 05:24:42 +0000 (07:24 +0200)
This patch replaces all advanced data type aliases on
stktable_data_cast calls by standard types.

This way we could call the same stktable_data_cast
regardless of the used advanced data type as long they
are using the same std type.

It also removes all the advanced data type aliases.

include/haproxy/session.h
include/haproxy/stick_table-t.h
include/haproxy/stick_table.h
include/haproxy/stream.h
src/http_act.c
src/session.c
src/stick_table.c
src/stream.c

index 1842b7aa72714cb984bfe11ba42be52ff02480f7..d838fd99bfb5c83f8525f48129bb6da10d72ccfa 100644 (file)
@@ -60,8 +60,8 @@ static inline void session_store_counters(struct session *sess)
                if (ptr) {
                        HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
-                       if (stktable_data_cast(ptr, conn_cur) > 0)
-                               stktable_data_cast(ptr, conn_cur)--;
+                       if (stktable_data_cast(ptr, std_t_uint) > 0)
+                               stktable_data_cast(ptr, std_t_uint)--;
 
                        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 
index 237bfbe682bf5c39e5c62f5910a2d62dc2eba9a0..f09956aaf21145da220de4b504104baa4ff3bb0f 100644 (file)
@@ -118,30 +118,6 @@ union stktable_data {
        unsigned long long std_t_ull;
        struct freq_ctr std_t_frqp;
        struct dict_entry *std_t_dict;
-
-       /* types of each storable data */
-       int server_id;
-       struct dict_entry *server_key;
-       unsigned int gpt0;
-       unsigned int gpc0;
-       struct freq_ctr gpc0_rate;
-       unsigned int gpc1;
-       struct freq_ctr gpc1_rate;
-       unsigned int conn_cnt;
-       struct freq_ctr conn_rate;
-       unsigned int conn_cur;
-       unsigned int sess_cnt;
-       struct freq_ctr sess_rate;
-       unsigned int http_req_cnt;
-       struct freq_ctr http_req_rate;
-       unsigned int http_err_cnt;
-       struct freq_ctr http_err_rate;
-       unsigned long long bytes_in_cnt;
-       struct freq_ctr bytes_in_rate;
-       unsigned long long bytes_out_cnt;
-       struct freq_ctr bytes_out_rate;
-       unsigned int http_fail_cnt;
-       struct freq_ctr http_fail_rate;
 };
 
 /* known data types */
index c9fb85eeff1acbbe68fe152027e6db89dccd555a..4dffe2a854309e9b5647eaaa8cc86061817a851d 100644 (file)
@@ -232,11 +232,11 @@ static inline int stkctr_inc_http_req_ctr(struct stkctr *stkctr)
 
        ptr1 = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_HTTP_REQ_CNT);
        if (ptr1)
-               stktable_data_cast(ptr1, http_req_cnt)++;
+               stktable_data_cast(ptr1, std_t_uint)++;
 
        ptr2 = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_HTTP_REQ_RATE);
        if (ptr2)
-               update_freq_ctr_period(&stktable_data_cast(ptr2, http_req_rate),
+               update_freq_ctr_period(&stktable_data_cast(ptr2, std_t_frqp),
                                       stkctr->table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
 
        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
@@ -264,11 +264,11 @@ static inline int stkctr_inc_http_err_ctr(struct stkctr *stkctr)
 
        ptr1 = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_HTTP_ERR_CNT);
        if (ptr1)
-               stktable_data_cast(ptr1, http_err_cnt)++;
+               stktable_data_cast(ptr1, std_t_uint)++;
 
        ptr2 = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_HTTP_ERR_RATE);
        if (ptr2)
-               update_freq_ctr_period(&stktable_data_cast(ptr2, http_err_rate),
+               update_freq_ctr_period(&stktable_data_cast(ptr2, std_t_frqp),
                                       stkctr->table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u, 1);
 
        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
@@ -296,11 +296,11 @@ static inline int stkctr_inc_http_fail_ctr(struct stkctr *stkctr)
 
        ptr1 = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_HTTP_FAIL_CNT);
        if (ptr1)
-               stktable_data_cast(ptr1, http_fail_cnt)++;
+               stktable_data_cast(ptr1, std_t_uint)++;
 
        ptr2 = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_HTTP_FAIL_RATE);
        if (ptr2)
-               update_freq_ctr_period(&stktable_data_cast(ptr2, http_fail_rate),
+               update_freq_ctr_period(&stktable_data_cast(ptr2, std_t_frqp),
                                       stkctr->table->data_arg[STKTABLE_DT_HTTP_FAIL_RATE].u, 1);
 
        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
@@ -327,11 +327,11 @@ static inline int stkctr_inc_bytes_in_ctr(struct stkctr *stkctr, unsigned long l
        HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
        ptr1 = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_BYTES_IN_CNT);
        if (ptr1)
-               stktable_data_cast(ptr1, bytes_in_cnt) += bytes;
+               stktable_data_cast(ptr1, std_t_ull) += bytes;
 
        ptr2 = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_BYTES_IN_RATE);
        if (ptr2)
-               update_freq_ctr_period(&stktable_data_cast(ptr2, bytes_in_rate),
+               update_freq_ctr_period(&stktable_data_cast(ptr2, std_t_frqp),
                                       stkctr->table->data_arg[STKTABLE_DT_BYTES_IN_RATE].u, bytes);
        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 
@@ -358,11 +358,11 @@ static inline int stkctr_inc_bytes_out_ctr(struct stkctr *stkctr, unsigned long
        HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
        ptr1 = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_BYTES_OUT_CNT);
        if (ptr1)
-               stktable_data_cast(ptr1, bytes_out_cnt) += bytes;
+               stktable_data_cast(ptr1, std_t_ull) += bytes;
 
        ptr2 = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_BYTES_OUT_RATE);
        if (ptr2)
-               update_freq_ctr_period(&stktable_data_cast(ptr2, bytes_out_rate),
+               update_freq_ctr_period(&stktable_data_cast(ptr2, std_t_frqp),
                                       stkctr->table->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u, bytes);
        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 
index 9a7ffa1d2df8fb4a8209d64e3a8df25d2bc2ca78..e89383da0c524a3fbf625e6866043bf6e7184469 100644 (file)
@@ -126,8 +126,8 @@ static inline void stream_store_counters(struct stream *s)
                if (ptr) {
                        HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
-                       if (stktable_data_cast(ptr, conn_cur) > 0)
-                               stktable_data_cast(ptr, conn_cur)--;
+                       if (stktable_data_cast(ptr, std_t_uint) > 0)
+                               stktable_data_cast(ptr, std_t_uint)--;
 
                        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 
@@ -165,8 +165,8 @@ static inline void stream_stop_content_counters(struct stream *s)
                if (ptr) {
                        HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
-                       if (stktable_data_cast(ptr, conn_cur) > 0)
-                               stktable_data_cast(ptr, conn_cur)--;
+                       if (stktable_data_cast(ptr, std_t_uint) > 0)
+                               stktable_data_cast(ptr, std_t_uint)--;
 
                        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 
@@ -190,15 +190,15 @@ static inline void stream_start_counters(struct stktable *t, struct stksess *ts)
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_CUR);
        if (ptr)
-               stktable_data_cast(ptr, conn_cur)++;
+               stktable_data_cast(ptr, std_t_uint)++;
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_CNT);
        if (ptr)
-               stktable_data_cast(ptr, conn_cnt)++;
+               stktable_data_cast(ptr, std_t_uint)++;
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_RATE);
        if (ptr)
-               update_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
+               update_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                       t->data_arg[STKTABLE_DT_CONN_RATE].u, 1);
        if (tick_isset(t->expire))
                ts->expire = tick_add(now_ms, MS_TO_TICKS(t->expire));
index b77fd9361dae7ae34d72ed30e0cff8b2d25a67ca..f16b6390b2e18df5c44845f571a7a61439741d5e 100644 (file)
@@ -2011,19 +2011,19 @@ static enum act_return http_action_track_sc(struct act_rule *rule, struct proxy
                HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
                if (ptr1)
-                       stktable_data_cast(ptr1, http_req_cnt)++;
+                       stktable_data_cast(ptr1, std_t_uint)++;
                if (ptr2)
-                       update_freq_ctr_period(&stktable_data_cast(ptr2, http_req_rate),
+                       update_freq_ctr_period(&stktable_data_cast(ptr2, std_t_frqp),
                                               t->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
                if (ptr3)
-                       stktable_data_cast(ptr3, http_err_cnt)++;
+                       stktable_data_cast(ptr3, std_t_uint)++;
                if (ptr4)
-                       update_freq_ctr_period(&stktable_data_cast(ptr4, http_err_rate),
+                       update_freq_ctr_period(&stktable_data_cast(ptr4, std_t_frqp),
                                               t->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u, 1);
                if (ptr5)
-                       stktable_data_cast(ptr5, http_fail_cnt)++;
+                       stktable_data_cast(ptr5, std_t_uint)++;
                if (ptr6)
-                       update_freq_ctr_period(&stktable_data_cast(ptr6, http_fail_rate),
+                       update_freq_ctr_period(&stktable_data_cast(ptr6, std_t_frqp),
                                               t->data_arg[STKTABLE_DT_HTTP_FAIL_RATE].u, 1);
 
                HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
index 0f2658849e42fbf8b2b05b2536f9756eae17d05e..4789ca972199e63e4b64f7ba1d330e6c436ffe80 100644 (file)
@@ -119,11 +119,11 @@ static void session_count_new(struct session *sess)
 
                ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_SESS_CNT);
                if (ptr)
-                       HA_ATOMIC_INC(&stktable_data_cast(ptr, sess_cnt));
+                       HA_ATOMIC_INC(&stktable_data_cast(ptr, std_t_uint));
 
                ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_SESS_RATE);
                if (ptr)
-                       update_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
+                       update_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                               stkctr->table->data_arg[STKTABLE_DT_SESS_RATE].u, 1);
        }
 }
index b1873f076931dc6f7b4105be1f27de0cb243b668..73c8fc184fa99d94abb4e7e1aa3d49430db10e41 100644 (file)
@@ -98,8 +98,8 @@ void stksess_free(struct stktable *t, struct stksess *ts)
        void *data;
        data = stktable_data_ptr(t, ts, STKTABLE_DT_SERVER_KEY);
        if (data) {
-               dict_entry_unref(&server_key_dict, stktable_data_cast(data, server_key));
-               stktable_data_cast(data, server_key) = NULL;
+               dict_entry_unref(&server_key_dict, stktable_data_cast(data, std_t_dict));
+               stktable_data_cast(data, std_t_dict) = NULL;
        }
        HA_SPIN_LOCK(STK_TABLE_LOCK, &t->lock);
        __stksess_free(t, ts);
@@ -1228,7 +1228,7 @@ static int sample_conv_table_bytes_in_rate(const struct arg *arg_p, struct sampl
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_BYTES_IN_RATE);
        if (ptr)
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                                        t->data_arg[STKTABLE_DT_BYTES_IN_RATE].u);
 
        stktable_release(t, ts);
@@ -1265,7 +1265,7 @@ static int sample_conv_table_conn_cnt(const struct arg *arg_p, struct sample *sm
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_CNT);
        if (ptr)
-               smp->data.u.sint = stktable_data_cast(ptr, conn_cnt);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
        stktable_release(t, ts);
        return !!ptr;
@@ -1301,7 +1301,7 @@ static int sample_conv_table_conn_cur(const struct arg *arg_p, struct sample *sm
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_CUR);
        if (ptr)
-               smp->data.u.sint = stktable_data_cast(ptr, conn_cur);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
        stktable_release(t, ts);
        return !!ptr;
@@ -1337,7 +1337,7 @@ static int sample_conv_table_conn_rate(const struct arg *arg_p, struct sample *s
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_RATE);
        if (ptr)
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                                        t->data_arg[STKTABLE_DT_CONN_RATE].u);
 
        stktable_release(t, ts);
@@ -1374,7 +1374,7 @@ static int sample_conv_table_bytes_out_rate(const struct arg *arg_p, struct samp
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_BYTES_OUT_RATE);
        if (ptr)
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                                        t->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u);
 
        stktable_release(t, ts);
@@ -1411,7 +1411,7 @@ static int sample_conv_table_gpt0(const struct arg *arg_p, struct sample *smp, v
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_GPT0);
        if (ptr)
-               smp->data.u.sint = stktable_data_cast(ptr, gpt0);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
        stktable_release(t, ts);
        return !!ptr;
@@ -1447,7 +1447,7 @@ static int sample_conv_table_gpc0(const struct arg *arg_p, struct sample *smp, v
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_GPC0);
        if (ptr)
-               smp->data.u.sint = stktable_data_cast(ptr, gpc0);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
        stktable_release(t, ts);
        return !!ptr;
@@ -1483,7 +1483,7 @@ static int sample_conv_table_gpc0_rate(const struct arg *arg_p, struct sample *s
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_GPC0_RATE);
        if (ptr)
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc0_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                                        t->data_arg[STKTABLE_DT_GPC0_RATE].u);
 
        stktable_release(t, ts);
@@ -1520,7 +1520,7 @@ static int sample_conv_table_gpc1(const struct arg *arg_p, struct sample *smp, v
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_GPC1);
        if (ptr)
-               smp->data.u.sint = stktable_data_cast(ptr, gpc1);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
        stktable_release(t, ts);
        return !!ptr;
@@ -1556,7 +1556,7 @@ static int sample_conv_table_gpc1_rate(const struct arg *arg_p, struct sample *s
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_GPC1_RATE);
        if (ptr)
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc1_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                                        t->data_arg[STKTABLE_DT_GPC1_RATE].u);
 
        stktable_release(t, ts);
@@ -1593,7 +1593,7 @@ static int sample_conv_table_http_err_cnt(const struct arg *arg_p, struct sample
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_ERR_CNT);
        if (ptr)
-               smp->data.u.sint = stktable_data_cast(ptr, http_err_cnt);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
        stktable_release(t, ts);
        return !!ptr;
@@ -1629,7 +1629,7 @@ static int sample_conv_table_http_err_rate(const struct arg *arg_p, struct sampl
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_ERR_RATE);
        if (ptr)
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                                        t->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u);
 
        stktable_release(t, ts);
@@ -1666,7 +1666,7 @@ static int sample_conv_table_http_fail_cnt(const struct arg *arg_p, struct sampl
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_FAIL_CNT);
        if (ptr)
-               smp->data.u.sint = stktable_data_cast(ptr, http_fail_cnt);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
        stktable_release(t, ts);
        return !!ptr;
@@ -1702,7 +1702,7 @@ static int sample_conv_table_http_fail_rate(const struct arg *arg_p, struct samp
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_FAIL_RATE);
        if (ptr)
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_fail_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                                        t->data_arg[STKTABLE_DT_HTTP_FAIL_RATE].u);
 
        stktable_release(t, ts);
@@ -1739,7 +1739,7 @@ static int sample_conv_table_http_req_cnt(const struct arg *arg_p, struct sample
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_REQ_CNT);
        if (ptr)
-               smp->data.u.sint = stktable_data_cast(ptr, http_req_cnt);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
        stktable_release(t, ts);
        return !!ptr;
@@ -1775,7 +1775,7 @@ static int sample_conv_table_http_req_rate(const struct arg *arg_p, struct sampl
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_REQ_RATE);
        if (ptr)
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                                        t->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u);
 
        stktable_release(t, ts);
@@ -1812,7 +1812,7 @@ static int sample_conv_table_kbytes_in(const struct arg *arg_p, struct sample *s
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_BYTES_IN_CNT);
        if (ptr)
-               smp->data.u.sint = stktable_data_cast(ptr, bytes_in_cnt) >> 10;
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_ull) >> 10;
 
        stktable_release(t, ts);
        return !!ptr;
@@ -1848,7 +1848,7 @@ static int sample_conv_table_kbytes_out(const struct arg *arg_p, struct sample *
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_BYTES_OUT_CNT);
        if (ptr)
-               smp->data.u.sint = stktable_data_cast(ptr, bytes_out_cnt) >> 10;
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_ull) >> 10;
 
        stktable_release(t, ts);
        return !!ptr;
@@ -1884,7 +1884,7 @@ static int sample_conv_table_server_id(const struct arg *arg_p, struct sample *s
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_SERVER_ID);
        if (ptr)
-               smp->data.u.sint = stktable_data_cast(ptr, server_id);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_sint);
 
        stktable_release(t, ts);
        return !!ptr;
@@ -1920,7 +1920,7 @@ static int sample_conv_table_sess_cnt(const struct arg *arg_p, struct sample *sm
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_SESS_CNT);
        if (ptr)
-               smp->data.u.sint = stktable_data_cast(ptr, sess_cnt);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
        stktable_release(t, ts);
        return !!ptr;
@@ -1956,7 +1956,7 @@ static int sample_conv_table_sess_rate(const struct arg *arg_p, struct sample *s
 
        ptr = stktable_data_ptr(t, ts, STKTABLE_DT_SESS_RATE);
        if (ptr)
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                                        t->data_arg[STKTABLE_DT_SESS_RATE].u);
 
        stktable_release(t, ts);
@@ -2020,11 +2020,11 @@ static enum act_return action_inc_gpc0(struct act_rule *rule, struct proxy *px,
                        HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
                        if (ptr1)
-                               update_freq_ctr_period(&stktable_data_cast(ptr1, gpc0_rate),
+                               update_freq_ctr_period(&stktable_data_cast(ptr1, std_t_frqp),
                                               stkctr->table->data_arg[STKTABLE_DT_GPC0_RATE].u, 1);
 
                        if (ptr2)
-                               stktable_data_cast(ptr2, gpc0)++;
+                               stktable_data_cast(ptr2, std_t_uint)++;
 
                        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 
@@ -2102,11 +2102,11 @@ static enum act_return action_inc_gpc1(struct act_rule *rule, struct proxy *px,
                        HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
                        if (ptr1)
-                               update_freq_ctr_period(&stktable_data_cast(ptr1, gpc1_rate),
+                               update_freq_ctr_period(&stktable_data_cast(ptr1, std_t_frqp),
                                               stkctr->table->data_arg[STKTABLE_DT_GPC1_RATE].u, 1);
 
                        if (ptr2)
-                               stktable_data_cast(ptr2, gpc1)++;
+                               stktable_data_cast(ptr2, std_t_uint)++;
 
                        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 
@@ -2213,7 +2213,7 @@ static enum act_return action_set_gpt0(struct act_rule *rule, struct proxy *px,
 
                HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
-               stktable_data_cast(ptr, gpt0) = value;
+               stktable_data_cast(ptr, std_t_uint) = value;
 
                HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 
@@ -2494,7 +2494,7 @@ smp_fetch_sc_get_gpt0(const struct arg *args, struct sample *smp, const char *kw
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, gpt0);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -2535,7 +2535,7 @@ smp_fetch_sc_get_gpc0(const struct arg *args, struct sample *smp, const char *kw
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, gpc0);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -2576,7 +2576,7 @@ smp_fetch_sc_get_gpc1(const struct arg *args, struct sample *smp, const char *kw
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, gpc1);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -2616,7 +2616,7 @@ smp_fetch_sc_gpc0_rate(const struct arg *args, struct sample *smp, const char *k
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc0_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                  stkctr->table->data_arg[STKTABLE_DT_GPC0_RATE].u);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
@@ -2657,7 +2657,7 @@ smp_fetch_sc_gpc1_rate(const struct arg *args, struct sample *smp, const char *k
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc1_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                  stkctr->table->data_arg[STKTABLE_DT_GPC1_RATE].u);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
@@ -2702,13 +2702,13 @@ smp_fetch_sc_inc_gpc0(const struct arg *args, struct sample *smp, const char *kw
                        HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
                        if (ptr1) {
-                               update_freq_ctr_period(&stktable_data_cast(ptr1, gpc0_rate),
+                               update_freq_ctr_period(&stktable_data_cast(ptr1, std_t_frqp),
                                                       stkctr->table->data_arg[STKTABLE_DT_GPC0_RATE].u, 1);
-                               smp->data.u.sint = (&stktable_data_cast(ptr1, gpc0_rate))->curr_ctr;
+                               smp->data.u.sint = (&stktable_data_cast(ptr1, std_t_frqp))->curr_ctr;
                        }
 
                        if (ptr2)
-                               smp->data.u.sint = ++stktable_data_cast(ptr2, gpc0);
+                               smp->data.u.sint = ++stktable_data_cast(ptr2, std_t_uint);
 
                        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -2755,13 +2755,13 @@ smp_fetch_sc_inc_gpc1(const struct arg *args, struct sample *smp, const char *kw
                        HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
                        if (ptr1) {
-                               update_freq_ctr_period(&stktable_data_cast(ptr1, gpc1_rate),
+                               update_freq_ctr_period(&stktable_data_cast(ptr1, std_t_frqp),
                                                       stkctr->table->data_arg[STKTABLE_DT_GPC1_RATE].u, 1);
-                               smp->data.u.sint = (&stktable_data_cast(ptr1, gpc1_rate))->curr_ctr;
+                               smp->data.u.sint = (&stktable_data_cast(ptr1, std_t_frqp))->curr_ctr;
                        }
 
                        if (ptr2)
-                               smp->data.u.sint = ++stktable_data_cast(ptr2, gpc1);
+                               smp->data.u.sint = ++stktable_data_cast(ptr2, std_t_uint);
 
                        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -2807,8 +2807,8 @@ smp_fetch_sc_clr_gpc0(const struct arg *args, struct sample *smp, const char *kw
 
                HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, gpc0);
-               stktable_data_cast(ptr, gpc0) = 0;
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
+               stktable_data_cast(ptr, std_t_uint) = 0;
 
                HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -2851,8 +2851,8 @@ smp_fetch_sc_clr_gpc1(const struct arg *args, struct sample *smp, const char *kw
 
                HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, gpc1);
-               stktable_data_cast(ptr, gpc1) = 0;
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
+               stktable_data_cast(ptr, std_t_uint) = 0;
 
                HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -2891,7 +2891,7 @@ smp_fetch_sc_conn_cnt(const struct arg *args, struct sample *smp, const char *kw
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, conn_cnt);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -2932,7 +2932,7 @@ smp_fetch_sc_conn_rate(const struct arg *args, struct sample *smp, const char *k
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                               stkctr->table->data_arg[STKTABLE_DT_CONN_RATE].u);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
@@ -2983,7 +2983,7 @@ smp_fetch_src_updt_conn_cnt(const struct arg *args, struct sample *smp, const ch
 
        HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
-       smp->data.u.sint = ++stktable_data_cast(ptr, conn_cnt);
+       smp->data.u.sint = ++stktable_data_cast(ptr, std_t_uint);
 
        HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 
@@ -3024,7 +3024,7 @@ smp_fetch_sc_conn_cur(const struct arg *args, struct sample *smp, const char *kw
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, conn_cur);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -3063,7 +3063,7 @@ smp_fetch_sc_sess_cnt(const struct arg *args, struct sample *smp, const char *kw
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, sess_cnt);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -3101,7 +3101,7 @@ smp_fetch_sc_sess_rate(const struct arg *args, struct sample *smp, const char *k
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                               stkctr->table->data_arg[STKTABLE_DT_SESS_RATE].u);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
@@ -3141,7 +3141,7 @@ smp_fetch_sc_http_req_cnt(const struct arg *args, struct sample *smp, const char
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, http_req_cnt);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -3180,7 +3180,7 @@ smp_fetch_sc_http_req_rate(const struct arg *args, struct sample *smp, const cha
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                               stkctr->table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
@@ -3220,7 +3220,7 @@ smp_fetch_sc_http_err_cnt(const struct arg *args, struct sample *smp, const char
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, http_err_cnt);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -3259,7 +3259,7 @@ smp_fetch_sc_http_err_rate(const struct arg *args, struct sample *smp, const cha
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                               stkctr->table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
@@ -3299,7 +3299,7 @@ smp_fetch_sc_http_fail_cnt(const struct arg *args, struct sample *smp, const cha
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, http_fail_cnt);
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_uint);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -3338,7 +3338,7 @@ smp_fetch_sc_http_fail_rate(const struct arg *args, struct sample *smp, const ch
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_fail_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                               stkctr->table->data_arg[STKTABLE_DT_HTTP_FAIL_RATE].u);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
@@ -3378,7 +3378,7 @@ smp_fetch_sc_kbytes_in(const struct arg *args, struct sample *smp, const char *k
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, bytes_in_cnt) >> 10;
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_ull) >> 10;
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -3417,7 +3417,7 @@ smp_fetch_sc_bytes_in_rate(const struct arg *args, struct sample *smp, const cha
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                               stkctr->table->data_arg[STKTABLE_DT_BYTES_IN_RATE].u);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
@@ -3457,7 +3457,7 @@ smp_fetch_sc_kbytes_out(const struct arg *args, struct sample *smp, const char *
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = stktable_data_cast(ptr, bytes_out_cnt) >> 10;
+               smp->data.u.sint = stktable_data_cast(ptr, std_t_ull) >> 10;
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
@@ -3496,7 +3496,7 @@ smp_fetch_sc_bytes_out_rate(const struct arg *args, struct sample *smp, const ch
 
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
 
-               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
+               smp->data.u.sint = read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
                                               stkctr->table->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u);
 
                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &stkctr_entry(stkctr)->lock);
index 31913e08b3dd3c0728e29bb08adc1e4a4aeb6e4d..c434708e2fb5a3d44061c4345753a1307600b802 100644 (file)
@@ -1245,7 +1245,7 @@ static inline void sticking_rule_find_target(struct stream *s,
        /* Look for the server name previously stored in <t> stick-table */
        HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &ts->lock);
        ptr = __stktable_data_ptr(t, ts, STKTABLE_DT_SERVER_KEY);
-       de = stktable_data_cast(ptr, server_key);
+       de = stktable_data_cast(ptr, std_t_dict);
        HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &ts->lock);
 
        if (de) {
@@ -1271,7 +1271,7 @@ static inline void sticking_rule_find_target(struct stream *s,
        /* Look for the server ID */
        HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &ts->lock);
        ptr = __stktable_data_ptr(t, ts, STKTABLE_DT_SERVER_ID);
-       node = eb32_lookup(&px->conf.used_server_id, stktable_data_cast(ptr, server_id));
+       node = eb32_lookup(&px->conf.used_server_id, stktable_data_cast(ptr, std_t_sint));
        HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &ts->lock);
 
        if (!node)
@@ -1449,7 +1449,7 @@ static int process_store_rules(struct stream *s, struct channel *rep, int an_bit
 
                HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
                ptr = __stktable_data_ptr(t, ts, STKTABLE_DT_SERVER_ID);
-               stktable_data_cast(ptr, server_id) = __objt_server(s->target)->puid;
+               stktable_data_cast(ptr, std_t_sint) = __objt_server(s->target)->puid;
                HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 
                if (t->server_key_type == STKTABLE_SRV_NAME)
@@ -1463,7 +1463,7 @@ static int process_store_rules(struct stream *s, struct channel *rep, int an_bit
                de = dict_insert(&server_key_dict, key);
                if (de) {
                        ptr = __stktable_data_ptr(t, ts, STKTABLE_DT_SERVER_KEY);
-                       stktable_data_cast(ptr, server_key) = de;
+                       stktable_data_cast(ptr, std_t_dict) = de;
                }
                HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);