From 0e3457b63ac993f7619f74aad2cc05ef21835521 Mon Sep 17 00:00:00 2001 From: Emeric Brun Date: Wed, 30 Jun 2021 17:18:28 +0200 Subject: [PATCH] MINOR: stick-table: make skttable_data_cast to use only std types 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 | 4 +- include/haproxy/stick_table-t.h | 24 ------- include/haproxy/stick_table.h | 20 +++--- include/haproxy/stream.h | 14 ++-- src/http_act.c | 12 ++-- src/session.c | 4 +- src/stick_table.c | 118 ++++++++++++++++---------------- src/stream.c | 8 +-- 8 files changed, 90 insertions(+), 114 deletions(-) diff --git a/include/haproxy/session.h b/include/haproxy/session.h index 1842b7aa7..d838fd99b 100644 --- a/include/haproxy/session.h +++ b/include/haproxy/session.h @@ -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); diff --git a/include/haproxy/stick_table-t.h b/include/haproxy/stick_table-t.h index 237bfbe68..f09956aaf 100644 --- a/include/haproxy/stick_table-t.h +++ b/include/haproxy/stick_table-t.h @@ -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 */ diff --git a/include/haproxy/stick_table.h b/include/haproxy/stick_table.h index c9fb85eef..4dffe2a85 100644 --- a/include/haproxy/stick_table.h +++ b/include/haproxy/stick_table.h @@ -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); diff --git a/include/haproxy/stream.h b/include/haproxy/stream.h index 9a7ffa1d2..e89383da0 100644 --- a/include/haproxy/stream.h +++ b/include/haproxy/stream.h @@ -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)); diff --git a/src/http_act.c b/src/http_act.c index b77fd9361..f16b6390b 100644 --- a/src/http_act.c +++ b/src/http_act.c @@ -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); diff --git a/src/session.c b/src/session.c index 0f2658849..4789ca972 100644 --- a/src/session.c +++ b/src/session.c @@ -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); } } diff --git a/src/stick_table.c b/src/stick_table.c index b1873f076..73c8fc184 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -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); diff --git a/src/stream.c b/src/stream.c index 31913e08b..c434708e2 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1245,7 +1245,7 @@ static inline void sticking_rule_find_target(struct stream *s, /* Look for the server name previously stored in 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);