]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: tree-wide: replace most DECLARE_POOL with DECLARE_TYPED_POOL
authorWilly Tarreau <w@1wt.eu>
Wed, 6 Aug 2025 14:43:27 +0000 (16:43 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 11 Aug 2025 17:55:30 +0000 (19:55 +0200)
This will make the pools size and alignment automatically inherit
the type declaration. It was done like this:

   sed -i -e 's:DECLARE_POOL(\([^,]*,[^,]*,\s*\)sizeof(\([^)]*\))):DECLARE_TYPED_POOL(\1\2):g' $(git grep -lw DECLARE_POOL src addons)
   sed -i -e 's:DECLARE_STATIC_POOL(\([^,]*,[^,]*,\s*\)sizeof(\([^)]*\))):DECLARE_STATIC_TYPED_POOL(\1\2):g' $(git grep -lw DECLARE_STATIC_POOL src addons)

81 replacements were made. The only remaining ones are those which set
their own size without depending on a structure. The few ones with an
extra size were manually handled.

It also means that the requested alignments are now checked against the
type's. Given that none is specified for now, no issue is reported.

It was verified with "show pools detailed" that the definitions are
exactly the same, and that the binaries are similar.

43 files changed:
addons/promex/service-prometheus.c
src/applet.c
src/cache.c
src/compression.c
src/connection.c
src/dns.c
src/event_hdl.c
src/fcgi-app.c
src/filters.c
src/flt_bwlim.c
src/flt_http_comp.c
src/flt_spoe.c
src/h3.c
src/hlua.c
src/hlua_fcn.c
src/http_ana.c
src/lb_fwlc.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/mux_pt.c
src/mux_quic.c
src/mux_spop.c
src/pipe.c
src/queue.c
src/quic_ack.c
src/quic_conn.c
src/quic_frame.c
src/quic_rx.c
src/quic_ssl.c
src/quic_stream.c
src/quic_tls.c
src/quic_tx.c
src/resolvers.c
src/session.c
src/signal.c
src/ssl_sock.c
src/stconn.c
src/stream.c
src/task.c
src/tcpcheck.c
src/vars.c
src/xprt_handshake.c

index 33e6f5a73df3283279e4d4c56a94a1e7cb5940cc..74310a366628cbfcdff53fc9f49006344377ee9a 100644 (file)
@@ -242,8 +242,8 @@ void promex_register_module(struct promex_module *m)
 }
 
 /* Pools used to allocate ref on Promex modules and filters */
-DECLARE_STATIC_POOL(pool_head_promex_mod_ref,    "promex_module_ref",  sizeof(struct promex_module_ref));
-DECLARE_STATIC_POOL(pool_head_promex_metric_flt, "promex_metric_filter", sizeof(struct promex_metric_filter));
+DECLARE_STATIC_TYPED_POOL(pool_head_promex_mod_ref,    "promex_module_ref",  struct promex_module_ref);
+DECLARE_STATIC_TYPED_POOL(pool_head_promex_metric_flt, "promex_metric_filter", struct promex_metric_filter);
 
 /* Return the server status. */
 enum promex_srv_state promex_srv_status(struct server *sv)
index 6bfff12de22df05c2284893afe6f84ed436e3547..584d2b9f097a05a7afd56484879cb93d3675c439 100644 (file)
@@ -29,7 +29,7 @@
 
 unsigned int nb_applets = 0;
 
-DECLARE_POOL(pool_head_appctx,  "appctx",  sizeof(struct appctx));
+DECLARE_TYPED_POOL(pool_head_appctx,  "appctx",  struct appctx);
 
 
 /* trace source and events */
index 1b3c2dcff01267d1fb717c0f632f47cc1419f965..7e86e6b96baf536c1e378817931361d9935c3234 100644 (file)
@@ -229,7 +229,7 @@ static struct list caches = LIST_HEAD_INIT(caches);
 static struct list caches_config = LIST_HEAD_INIT(caches_config); /* cache config to init */
 static struct cache *tmp_cache_config = NULL;
 
-DECLARE_STATIC_POOL(pool_head_cache_st, "cache_st", sizeof(struct cache_st));
+DECLARE_STATIC_TYPED_POOL(pool_head_cache_st, "cache_st", struct cache_st);
 
 static struct eb32_node *insert_entry(struct cache *cache, struct cache_tree *tree, struct cache_entry *new_entry);
 static void delete_entry(struct cache_entry *del_entry);
index 1fe5aec3bfdaa57de0f1384e3926237dfc554975..ed154b3c87d8658c77bf1b4314eb8299ec34a2bd 100644 (file)
@@ -156,7 +156,7 @@ int comp_append_algo(struct comp_algo **algos, const char *algo)
 }
 
 #if defined(USE_ZLIB) || defined(USE_SLZ)
-DECLARE_STATIC_POOL(pool_comp_ctx, "comp_ctx", sizeof(struct comp_ctx));
+DECLARE_STATIC_TYPED_POOL(pool_comp_ctx, "comp_ctx", struct comp_ctx);
 
 /*
  * Alloc the comp_ctx
index 458e6b0da83c07bceaaa85bdc97cc84ef9425da6..0235e3a2a9199e4c10ce17a99d0c16419f4a29f3 100644 (file)
 #include <haproxy/xxhash.h>
 
 
-DECLARE_POOL(pool_head_connection,     "connection",     sizeof(struct connection));
-DECLARE_POOL(pool_head_conn_hash_node, "conn_hash_node", sizeof(struct conn_hash_node));
-DECLARE_POOL(pool_head_sockaddr,       "sockaddr",       sizeof(struct sockaddr_storage));
-DECLARE_POOL(pool_head_pp_tlv_128,     "pp_tlv_128",     sizeof(struct conn_tlv_list) + HA_PP2_TLV_VALUE_128);
-DECLARE_POOL(pool_head_pp_tlv_256,     "pp_tlv_256",     sizeof(struct conn_tlv_list) + HA_PP2_TLV_VALUE_256);
+DECLARE_TYPED_POOL(pool_head_connection,     "connection",     struct connection);
+DECLARE_TYPED_POOL(pool_head_conn_hash_node, "conn_hash_node", struct conn_hash_node);
+DECLARE_TYPED_POOL(pool_head_sockaddr,       "sockaddr",       struct sockaddr_storage);
+DECLARE_TYPED_POOL(pool_head_pp_tlv_128,     "pp_tlv_128",     struct conn_tlv_list, HA_PP2_TLV_VALUE_128);
+DECLARE_TYPED_POOL(pool_head_pp_tlv_256,     "pp_tlv_256",     struct conn_tlv_list, HA_PP2_TLV_VALUE_256);
 
 struct idle_conns idle_conns[MAX_THREADS] = { };
 struct xprt_ops *registered_xprt[XPRT_ENTRIES] = { NULL, };
index 16b3ef76ed4eeed46815fa7a9b8ff0ac6f1dcb58..054f90a0c2db4a77a3ca54bad60208b767aad524 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -39,8 +39,8 @@
 
 static THREAD_LOCAL char *dns_msg_trash;
 
-DECLARE_STATIC_POOL(dns_session_pool, "dns_session", sizeof(struct dns_session));
-DECLARE_STATIC_POOL(dns_query_pool, "dns_query", sizeof(struct dns_query));
+DECLARE_STATIC_TYPED_POOL(dns_session_pool, "dns_session", struct dns_session);
+DECLARE_STATIC_TYPED_POOL(dns_query_pool, "dns_query", struct dns_query);
 DECLARE_STATIC_POOL(dns_msg_buf, "dns_msg_buf", DNS_TCP_MSG_RING_MAX_SIZE);
 
 /* Opens an UDP socket on the namesaver's IP/Port, if required. Returns 0 on
index 51553b08212ce694c40d46e6919a761817e8d577..1929f00f73ace569fe3ac540827cd64929ebcdf8 100644 (file)
@@ -58,10 +58,10 @@ struct event_hdl_async_task_default_ctx
 };
 
 /* memory pools declarations */
-DECLARE_STATIC_POOL(pool_head_sub, "ehdl_sub", sizeof(struct event_hdl_sub));
-DECLARE_STATIC_POOL(pool_head_sub_event, "ehdl_sub_e", sizeof(struct event_hdl_async_event));
-DECLARE_STATIC_POOL(pool_head_sub_event_data, "ehdl_sub_ed", sizeof(struct event_hdl_async_event_data));
-DECLARE_STATIC_POOL(pool_head_sub_taskctx, "ehdl_sub_tctx", sizeof(struct event_hdl_async_task_default_ctx));
+DECLARE_STATIC_TYPED_POOL(pool_head_sub, "ehdl_sub", struct event_hdl_sub);
+DECLARE_STATIC_TYPED_POOL(pool_head_sub_event, "ehdl_sub_e", struct event_hdl_async_event);
+DECLARE_STATIC_TYPED_POOL(pool_head_sub_event_data, "ehdl_sub_ed", struct event_hdl_async_event_data);
+DECLARE_STATIC_TYPED_POOL(pool_head_sub_taskctx, "ehdl_sub_tctx", struct event_hdl_async_task_default_ctx);
 
 /* global event_hdl tunables (public variable) */
 struct event_hdl_tune event_hdl_tune;
index ae3a79153f5852a26c191f6b2e11904957a9d145..1c957a794ec7953c49f2157b64008dbc1eaf94f5 100644 (file)
@@ -35,9 +35,9 @@ static struct fcgi_app *fcgi_apps = NULL;
 struct flt_ops fcgi_flt_ops;
 const char *fcgi_flt_id = "FCGI filter";
 
-DECLARE_STATIC_POOL(pool_head_fcgi_flt_ctx, "fcgi_flt_ctx", sizeof(struct fcgi_flt_ctx));
-DECLARE_STATIC_POOL(pool_head_fcgi_param_rule, "fcgi_param_rule", sizeof(struct fcgi_param_rule));
-DECLARE_STATIC_POOL(pool_head_fcgi_hdr_rule, "fcgi_hdr_rule", sizeof(struct fcgi_hdr_rule));
+DECLARE_STATIC_TYPED_POOL(pool_head_fcgi_flt_ctx, "fcgi_flt_ctx", struct fcgi_flt_ctx);
+DECLARE_STATIC_TYPED_POOL(pool_head_fcgi_param_rule, "fcgi_param_rule", struct fcgi_param_rule);
+DECLARE_STATIC_TYPED_POOL(pool_head_fcgi_hdr_rule, "fcgi_hdr_rule", struct fcgi_hdr_rule);
 
 /**************************************************************************/
 /***************************** Uitls **************************************/
index 3b0662b3c383f8a4b5e662a01f0667d36b88d6e8..22c09581b55e5d5e2f9ee413acb2952eda2c7bae 100644 (file)
@@ -30,7 +30,7 @@
 #define TRACE_SOURCE &trace_strm
 
 /* Pool used to allocate filters */
-DECLARE_STATIC_POOL(pool_head_filter, "filter", sizeof(struct filter));
+DECLARE_STATIC_TYPED_POOL(pool_head_filter, "filter", struct filter);
 
 static int handle_analyzer_result(struct stream *s, struct channel *chn, unsigned int an_bit, int ret);
 
index 3c75b9bb0e027c498c1ca1fed918b1ffabae9001..0ca7680918c26383a84594a82cd516ecedb40ff5 100644 (file)
@@ -65,7 +65,7 @@ struct bwlim_state {
 
 
 /* Pools used to allocate comp_state structs */
-DECLARE_STATIC_POOL(pool_head_bwlim_state, "bwlim_state", sizeof(struct bwlim_state));
+DECLARE_STATIC_TYPED_POOL(pool_head_bwlim_state, "bwlim_state", struct bwlim_state);
 
 
 /* Apply the bandwidth limitation of the filter <filter>. <len> is the maximum
index 9862f7d0de42d8a8b13ac72110c865508a5029de..5a5b65c04e2532e15981d6a6251c33279d802042 100644 (file)
@@ -42,7 +42,7 @@ struct comp_state {
 };
 
 /* Pools used to allocate comp_state structs */
-DECLARE_STATIC_POOL(pool_head_comp_state, "comp_state", sizeof(struct comp_state));
+DECLARE_STATIC_TYPED_POOL(pool_head_comp_state, "comp_state", struct comp_state);
 
 static THREAD_LOCAL struct buffer tmpbuf;
 static THREAD_LOCAL struct buffer zbuf;
index 3a42076cfc8aaaac5ec435501bcd9b0c21b3978c..8eb2681a0fb6ba4fef2ab09a353ab0e3c28fd39b 100644 (file)
@@ -245,8 +245,8 @@ int curpxopts;
 int curpxopts2;
 
 /* Pools used to allocate SPOE structs */
-DECLARE_STATIC_POOL(pool_head_spoe_ctx,    "spoe_ctx",    sizeof(struct spoe_context));
-DECLARE_STATIC_POOL(pool_head_spoe_appctx, "spoe_appctx", sizeof(struct spoe_appctx));
+DECLARE_STATIC_TYPED_POOL(pool_head_spoe_ctx,    "spoe_ctx",    struct spoe_context);
+DECLARE_STATIC_TYPED_POOL(pool_head_spoe_appctx, "spoe_appctx", struct spoe_appctx);
 
 struct flt_ops spoe_ops;
 
index d88d9bcd29641ad13196edd7e9c7f29bbf911648..f071748ee9a83a66e4e694590959fbd32903e1de 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -148,7 +148,7 @@ struct h3c {
        struct h3_counters *prx_counters;
 };
 
-DECLARE_STATIC_POOL(pool_head_h3c, "h3c", sizeof(struct h3c));
+DECLARE_STATIC_TYPED_POOL(pool_head_h3c, "h3c", struct h3c);
 
 #define H3_SF_UNI_INIT     0x00000001  /* stream type not parsed for unidirectional stream */
 #define H3_SF_UNI_NO_H3    0x00000002  /* unidirectional stream does not carry H3 frames */
@@ -171,7 +171,7 @@ struct h3s {
        int err; /* used for stream reset */
 };
 
-DECLARE_STATIC_POOL(pool_head_h3s, "h3s", sizeof(struct h3s));
+DECLARE_STATIC_TYPED_POOL(pool_head_h3s, "h3s", struct h3s);
 
 /* Initialize an uni-stream <qcs> by reading its type from <b>.
  *
index 398831a8863a75d6cd7b10a0045c65550afe98f0..5d17685f6bc6a4896d6cd9f9f41cc8a8017faff7 100644 (file)
@@ -456,7 +456,7 @@ struct hlua_cli_ctx {
        struct hlua_function *fcn;
 };
 
-DECLARE_STATIC_POOL(pool_head_hlua_flt_ctx, "hlua_flt_ctx", sizeof(struct hlua_flt_ctx));
+DECLARE_STATIC_TYPED_POOL(pool_head_hlua_flt_ctx, "hlua_flt_ctx", struct hlua_flt_ctx);
 
 static int hlua_filter_from_payload(struct filter *filter);
 
@@ -469,7 +469,7 @@ static struct list referenced_filters = LIST_HEAD_INIT(referenced_filters);
 /* This is the memory pool containing struct lua for applets
  * (including cli).
  */
-DECLARE_STATIC_POOL(pool_head_hlua, "hlua", sizeof(struct hlua));
+DECLARE_STATIC_TYPED_POOL(pool_head_hlua, "hlua", struct hlua);
 
 /* Used for Socket connection. */
 static struct proxy *socket_proxy;
@@ -692,7 +692,7 @@ struct hlua_event_sub {
 /* This is the memory pool containing struct hlua_event_sub
  * for event subscriptions from lua
  */
-DECLARE_STATIC_POOL(pool_head_hlua_event_sub, "hlua_esub", sizeof(struct hlua_event_sub));
+DECLARE_STATIC_TYPED_POOL(pool_head_hlua_event_sub, "hlua_esub", struct hlua_event_sub);
 
 /* These functions converts types between HAProxy internal args or
  * sample and LUA types. Another function permits to check if the
index 3e1cdef699a90b532ee616f0992fa8a7983ab7b0..6d371640447344551fd466eecdb4d9eb051b86b0 100644 (file)
@@ -517,7 +517,7 @@ struct hlua_queue_item {
 
 /* This is the memory pool containing struct hlua_queue_item (queue items)
  */
-DECLARE_STATIC_POOL(pool_head_hlua_queue, "hlua_queue", sizeof(struct hlua_queue_item));
+DECLARE_STATIC_TYPED_POOL(pool_head_hlua_queue, "hlua_queue", struct hlua_queue_item);
 
 static struct hlua_queue *hlua_check_queue(lua_State *L, int ud)
 {
index 568739050bb83a7aca850f7a97462c7625537749..ed9b03ec8f5f26600b46625487815a98ba7e5751 100644 (file)
@@ -5294,7 +5294,7 @@ void http_set_term_flags(struct stream *s)
 }
 
 
-DECLARE_POOL(pool_head_http_txn, "http_txn", sizeof(struct http_txn));
+DECLARE_TYPED_POOL(pool_head_http_txn, "http_txn", struct http_txn);
 
 /*
  * Local variables:
index ba2de9e416d2eaac0e01abba29a8ea3d75336763..aa9d679e07f02caf7b1e9cfbe529266ffa9b6cf1 100644 (file)
@@ -25,7 +25,7 @@ struct fwlc_tree_elt {
        unsigned int elements;
 };
 
-DECLARE_STATIC_POOL(pool_head_fwlc_elt, "fwlc_tree_elt", sizeof(struct fwlc_tree_elt));
+DECLARE_STATIC_TYPED_POOL(pool_head_fwlc_elt, "fwlc_tree_elt", struct fwlc_tree_elt);
 
 #define FWLC_LBPRM_SEQ(lbprm)          ((lbprm) & 0xffffffff)
 #define FWLC_LBPRM_SMALLEST(lbprm)     ((lbprm) >> 32)
index 33f7ef0ab84d96cb57bc295f9213fa24e52afc51..b217ec8f5b58a5042c207e90ea4e75292611971b 100644 (file)
@@ -285,8 +285,8 @@ static struct trace_source trace_fcgi __read_mostly = {
 INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE);
 
 /* FCGI connection and stream pools */
-DECLARE_STATIC_POOL(pool_head_fcgi_conn, "fcgi_conn", sizeof(struct fcgi_conn));
-DECLARE_STATIC_POOL(pool_head_fcgi_strm, "fcgi_strm", sizeof(struct fcgi_strm));
+DECLARE_STATIC_TYPED_POOL(pool_head_fcgi_conn, "fcgi_conn", struct fcgi_conn);
+DECLARE_STATIC_TYPED_POOL(pool_head_fcgi_strm, "fcgi_strm", struct fcgi_strm);
 
 struct task *fcgi_timeout_task(struct task *t, void *context, unsigned int state);
 static int fcgi_process(struct fcgi_conn *fconn);
index bc2e940c134e6e1a3ada5e3c7f510d66a718497c..839c9b9c3666c8452afbfa803be2f9c2db096a2e 100644 (file)
@@ -333,8 +333,8 @@ INITCALL1(STG_REGISTER, stats_register_module, &h1_stats_module);
 
 
 /* the h1c and h1s pools */
-DECLARE_STATIC_POOL(pool_head_h1c, "h1c", sizeof(struct h1c));
-DECLARE_STATIC_POOL(pool_head_h1s, "h1s", sizeof(struct h1s));
+DECLARE_STATIC_TYPED_POOL(pool_head_h1c, "h1c", struct h1c);
+DECLARE_STATIC_TYPED_POOL(pool_head_h1s, "h1s", struct h1s);
 
 static int h1_recv(struct h1c *h1c);
 static int h1_send(struct h1c *h1c);
index 76bea0a61dec3000841faf1feaf4df25e97841b7..f16e93cdbaf01b5219efce0d65d02778c2f1e7e8 100644 (file)
@@ -448,10 +448,10 @@ static struct stats_module h2_stats_module = {
 INITCALL1(STG_REGISTER, stats_register_module, &h2_stats_module);
 
 /* the h2c connection pool */
-DECLARE_STATIC_POOL(pool_head_h2c, "h2c", sizeof(struct h2c));
+DECLARE_STATIC_TYPED_POOL(pool_head_h2c, "h2c", struct h2c);
 
 /* the h2s stream pool */
-DECLARE_STATIC_POOL(pool_head_h2s, "h2s", sizeof(struct h2s));
+DECLARE_STATIC_TYPED_POOL(pool_head_h2s, "h2s", struct h2s);
 
 /* the shared rx_bufs pool */
 struct pool_head *pool_head_h2_rx_bufs __read_mostly = NULL;
index 31469c7d8e9599236a8d429c078405813db828ec..2c96a2f80715298292a05dfbe67d67d4d36f2cca 100644 (file)
@@ -27,7 +27,7 @@ struct mux_pt_ctx {
        struct wait_event wait_event;
 };
 
-DECLARE_STATIC_POOL(pool_head_pt_ctx, "mux_pt", sizeof(struct mux_pt_ctx));
+DECLARE_STATIC_TYPED_POOL(pool_head_pt_ctx, "mux_pt", struct mux_pt_ctx);
 
 /* trace source and events */
 static void pt_trace(enum trace_level level, uint64_t mask,
index 65ee6ae4434f18b0ad92b3912d106cf9e81ecd42..cdd2cb60153bad7ef6486e1326120b5537ec7d59 100644 (file)
@@ -33,9 +33,9 @@
 #include <haproxy/trace.h>
 #include <haproxy/xref.h>
 
-DECLARE_POOL(pool_head_qcc, "qcc", sizeof(struct qcc));
-DECLARE_POOL(pool_head_qcs, "qcs", sizeof(struct qcs));
-DECLARE_STATIC_POOL(pool_head_qc_stream_rxbuf, "qc_stream_rxbuf", sizeof(struct qc_stream_rxbuf));
+DECLARE_TYPED_POOL(pool_head_qcc, "qcc", struct qcc);
+DECLARE_TYPED_POOL(pool_head_qcs, "qcs", struct qcs);
+DECLARE_STATIC_TYPED_POOL(pool_head_qc_stream_rxbuf, "qc_stream_rxbuf", struct qc_stream_rxbuf);
 
 static void qmux_ctrl_send(struct qc_stream_desc *, uint64_t data, uint64_t offset);
 static void qmux_ctrl_room(struct qc_stream_desc *, uint64_t room);
index 4e376b66d7a3f078b362e8808feda2edba2dbd31..020d121d5c9a39d32133358cc714b691c310e9d0 100644 (file)
@@ -210,8 +210,8 @@ static struct trace_source trace_spop __read_mostly = {
 INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE);
 
 /* SPOP connection and stream pools */
-DECLARE_STATIC_POOL(pool_head_spop_conn, "spop_conn", sizeof(struct spop_conn));
-DECLARE_STATIC_POOL(pool_head_spop_strm, "spop_strm", sizeof(struct spop_strm));
+DECLARE_STATIC_TYPED_POOL(pool_head_spop_conn, "spop_conn", struct spop_conn);
+DECLARE_STATIC_TYPED_POOL(pool_head_spop_strm, "spop_strm", struct spop_strm);
 
 
 const struct ist spop_err_reasons[SPOP_ERR_ENTRIES] = {
index 5599fe018bff1e09befffddb6583cc0cfc5d31b7..794b881ec644873d5e69c7caff9047eac74c9ac1 100644 (file)
@@ -20,7 +20,7 @@
 #include <haproxy/thread.h>
 
 
-DECLARE_STATIC_POOL(pool_head_pipe, "pipe", sizeof(struct pipe));
+DECLARE_STATIC_TYPED_POOL(pool_head_pipe, "pipe", struct pipe);
 
 struct pipe *pipes_live = NULL; /* pipes which are still ready to use */
 
index 28a2e2dfe62e46746b0d0e512fa0f0580d27fbb6..f2afd713d7e25683c838772e9ab495e47b4f8428 100644 (file)
@@ -92,7 +92,7 @@ s *     queue's lock.
 #define KEY_CLASS_OFFSET_BOUNDARY(key) (KEY_CLASS(key) | NOW_OFFSET_BOUNDARY())
 #define MAKE_KEY(class, offset)        (((u32)(class + 0x7ff) << 20) | ((u32)(now_ms + offset) & 0xfffff))
 
-DECLARE_POOL(pool_head_pendconn, "pendconn", sizeof(struct pendconn));
+DECLARE_TYPED_POOL(pool_head_pendconn, "pendconn", struct pendconn);
 
 /* returns the effective dynamic maxconn for a server, considering the minconn
  * and the proxy's usage relative to its dynamic connections limit. It is
index d28a6985c5d1e0a4a5bd963a5fbf12f111a9c5b2..9a34c1b77911d7e941dafe69c0020c0616ed7490 100644 (file)
@@ -7,7 +7,7 @@
 #include <haproxy/quic_trace.h>
 #include <haproxy/trace.h>
 
-DECLARE_STATIC_POOL(pool_head_quic_arng, "quic_arng", sizeof(struct quic_arng_node));
+DECLARE_STATIC_TYPED_POOL(pool_head_quic_arng, "quic_arng", struct quic_arng_node);
 
 /* Deallocate <l> list of ACK ranges. */
 void quic_free_arngs(struct quic_conn *qc, struct quic_arngs *arngs)
index 340b85a1aec0c6f30ab19d2c8659a16f63043089..0e377bc5c81edde88184714fd134c887bdfff74c 100644 (file)
@@ -138,11 +138,10 @@ const struct quic_version *preferred_version;
  */
 const struct quic_version quic_version_VN_reserved = { .num = 0, };
 
-DECLARE_STATIC_POOL(pool_head_quic_conn, "quic_conn", sizeof(struct quic_conn));
-DECLARE_STATIC_POOL(pool_head_quic_conn_closed, "quic_conn_closed", sizeof(struct quic_conn_closed));
-DECLARE_STATIC_POOL(pool_head_quic_cids, "quic_cids", sizeof(struct eb_root));
-DECLARE_POOL(pool_head_quic_connection_id,
-             "quic_connection_id", sizeof(struct quic_connection_id));
+DECLARE_STATIC_TYPED_POOL(pool_head_quic_conn, "quic_conn", struct quic_conn);
+DECLARE_STATIC_TYPED_POOL(pool_head_quic_conn_closed, "quic_conn_closed", struct quic_conn_closed);
+DECLARE_STATIC_TYPED_POOL(pool_head_quic_cids, "quic_cids", struct eb_root);
+DECLARE_TYPED_POOL(pool_head_quic_connection_id, "quic_connection_id", struct quic_connection_id);
 
 struct task *quic_conn_app_io_cb(struct task *t, void *context, unsigned int state);
 static int quic_conn_init_timer(struct quic_conn *qc);
index 7e1dbba544986d42de02b0ce82e3e4fb3176550a..209f03e8bef5f79cd7c928dc4d54c3632d7d9993 100644 (file)
@@ -22,8 +22,8 @@
 #include <haproxy/quic_tx.h>
 #include <haproxy/trace.h>
 
-DECLARE_POOL(pool_head_quic_frame, "quic_frame", sizeof(struct quic_frame));
-DECLARE_POOL(pool_head_qf_crypto, "qf_crypto", sizeof(struct qf_crypto));
+DECLARE_TYPED_POOL(pool_head_quic_frame, "quic_frame", struct quic_frame);
+DECLARE_TYPED_POOL(pool_head_qf_crypto, "qf_crypto", struct qf_crypto);
 
 const char *quic_frame_type_string(enum quic_frame_type ft)
 {
index 9fe7b465f028e6dccc41451f6b3eccd33e4c1c05..6932f604b6960ca218afedf5c2c23a214a0e279e 100644 (file)
@@ -36,8 +36,8 @@
 #include <haproxy/trace.h>
 
 DECLARE_POOL(pool_head_quic_conn_rxbuf, "quic_conn_rxbuf", QUIC_CONN_RX_BUFSZ);
-DECLARE_POOL(pool_head_quic_dgram, "quic_dgram", sizeof(struct quic_dgram));
-DECLARE_POOL(pool_head_quic_rx_packet, "quic_rx_packet", sizeof(struct quic_rx_packet));
+DECLARE_TYPED_POOL(pool_head_quic_dgram, "quic_dgram", struct quic_dgram);
+DECLARE_TYPED_POOL(pool_head_quic_rx_packet, "quic_rx_packet", struct quic_rx_packet);
 
 /* Decode an expected packet number from <truncated_on> its truncated value,
  * depending on <largest_pn> the largest received packet number, and <pn_nbits>
index f39df08d3274bbbca2f09c3bd0de0ac3e6e03c52..1a291a61c3b03e263a4314db058784c5a6f1264c 100644 (file)
@@ -10,7 +10,7 @@
 #include <haproxy/ssl_sock.h>
 #include <haproxy/trace.h>
 
-DECLARE_POOL(pool_head_quic_ssl_sock_ctx, "quic_ssl_sock_ctx", sizeof(struct ssl_sock_ctx));
+DECLARE_TYPED_POOL(pool_head_quic_ssl_sock_ctx, "quic_ssl_sock_ctx", struct ssl_sock_ctx);
 const char *quic_ciphers = "TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384"
                            ":TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_CCM_SHA256";
 #ifdef HAVE_OPENSSL_QUIC
index 0d3a438ec3cc74875202562940cacfa76e3186ba..3640304777a726c11d829c3168a5bbbfc3e889e0 100644 (file)
 #include <haproxy/quic_utils.h>
 #include <haproxy/task.h>
 
-DECLARE_STATIC_POOL(pool_head_quic_stream_desc, "qc_stream_desc",
-                    sizeof(struct qc_stream_desc));
-DECLARE_STATIC_POOL(pool_head_quic_stream_buf, "qc_stream_buf",
-                    sizeof(struct qc_stream_buf));
-DECLARE_STATIC_POOL(pool_head_quic_stream_ack, "qc_stream_ack",
-                    sizeof(struct qc_stream_ack));
+DECLARE_STATIC_TYPED_POOL(pool_head_quic_stream_desc, "qc_stream_desc", struct qc_stream_desc);
+DECLARE_STATIC_TYPED_POOL(pool_head_quic_stream_buf, "qc_stream_buf", struct qc_stream_buf);
+DECLARE_STATIC_TYPED_POOL(pool_head_quic_stream_ack, "qc_stream_ack", struct qc_stream_ack);
 
 static struct pool_head *pool_head_sbuf;
 
index 30a323d2ea39c326f1f1a8894267d7ee56aad06c..40213a1bde89a65a608b7b6505f865719bb3a933 100644 (file)
 #include <haproxy/quic_stream.h>
 
 
-DECLARE_POOL(pool_head_quic_enc_level,  "quic_enc_level",  sizeof(struct quic_enc_level));
-DECLARE_POOL(pool_head_quic_pktns,      "quic_pktns",      sizeof(struct quic_pktns));
-DECLARE_POOL(pool_head_quic_tls_ctx,    "quic_tls_ctx",    sizeof(struct quic_tls_ctx));
+DECLARE_TYPED_POOL(pool_head_quic_enc_level,  "quic_enc_level",  struct quic_enc_level);
+DECLARE_TYPED_POOL(pool_head_quic_pktns,      "quic_pktns",      struct quic_pktns);
+DECLARE_TYPED_POOL(pool_head_quic_tls_ctx,    "quic_tls_ctx",    struct quic_tls_ctx);
 DECLARE_POOL(pool_head_quic_tls_secret, "quic_tls_secret", QUIC_TLS_SECRET_LEN);
 DECLARE_POOL(pool_head_quic_tls_iv,     "quic_tls_iv",     QUIC_TLS_IV_LEN);
 DECLARE_POOL(pool_head_quic_tls_key,    "quic_tls_key",    QUIC_TLS_KEY_LEN);
 
-DECLARE_POOL(pool_head_quic_crypto_buf, "quic_crypto_buf", sizeof(struct quic_crypto_buf));
-DECLARE_STATIC_POOL(pool_head_quic_cstream, "quic_cstream", sizeof(struct quic_cstream));
+DECLARE_TYPED_POOL(pool_head_quic_crypto_buf, "quic_crypto_buf", struct quic_crypto_buf);
+DECLARE_STATIC_TYPED_POOL(pool_head_quic_cstream, "quic_cstream", struct quic_cstream);
 
 /* Initial salt depending on QUIC version to derive client/server initial secrets.
  * This one is for draft-29 QUIC version.
index dc249d34915742b18a3001ca3f014cc706119690..160341695e377d00b325591430b1486c1ea4bf1c 100644 (file)
@@ -31,7 +31,7 @@
 #include <haproxy/quic_tune.h>
 #include <haproxy/ssl_sock-t.h>
 
-DECLARE_POOL(pool_head_quic_tx_packet, "quic_tx_packet", sizeof(struct quic_tx_packet));
+DECLARE_TYPED_POOL(pool_head_quic_tx_packet, "quic_tx_packet", struct quic_tx_packet);
 DECLARE_POOL(pool_head_quic_cc_buf, "quic_cc_buf", QUIC_MAX_CC_BUFSIZE);
 
 static struct quic_tx_packet *qc_build_pkt(unsigned char **pos, const unsigned char *buf_end,
index c788cd43705564f8b4f7e5df2779c81632b578bf..6daee3e141f4ed355d69484ee68f3954934a0995 100644 (file)
@@ -64,9 +64,9 @@ static THREAD_LOCAL unsigned int recurse = 0; /* counter to track calls to publi
 static THREAD_LOCAL uint64_t resolv_query_id_seed = 0; /* random seed */
 struct resolvers *curr_resolvers = NULL;
 
-DECLARE_STATIC_POOL(resolv_answer_item_pool, "resolv_answer_item", sizeof(struct resolv_answer_item));
-DECLARE_STATIC_POOL(resolv_resolution_pool,  "resolv_resolution",  sizeof(struct resolv_resolution));
-DECLARE_POOL(resolv_requester_pool,  "resolv_requester",  sizeof(struct resolv_requester));
+DECLARE_STATIC_TYPED_POOL(resolv_answer_item_pool, "resolv_answer_item", struct resolv_answer_item);
+DECLARE_STATIC_TYPED_POOL(resolv_resolution_pool,  "resolv_resolution",  struct resolv_resolution);
+DECLARE_TYPED_POOL(resolv_requester_pool,  "resolv_requester",  struct resolv_requester);
 
 static unsigned int resolution_uuid = 1;
 unsigned int resolv_failed_resolutions = 0;
index 21aff4ed81dac96d56f1346b0077cd6dfd3a74ff..c734d721c4850df4f050e9604340589f6cbc5cc3 100644 (file)
@@ -28,9 +28,8 @@
 #include <haproxy/vars.h>
 
 
-DECLARE_POOL(pool_head_session, "session", sizeof(struct session));
-DECLARE_POOL(pool_head_sess_priv_conns, "session priv conns list",
-             sizeof(struct sess_priv_conns));
+DECLARE_TYPED_POOL(pool_head_session, "session", struct session);
+DECLARE_TYPED_POOL(pool_head_sess_priv_conns, "session priv conns list", struct sess_priv_conns);
 
 int conn_complete_session(struct connection *conn);
 
index e5ca614e048d5821ac33d9ca96493b81765e5d3a..988c328cd831579e68e90c7a9bf8156c38bdcec5 100644 (file)
@@ -30,7 +30,7 @@ struct signal_descriptor signal_state[MAX_SIGNAL];
 sigset_t blocked_sig;
 int signal_pending = 0; /* non-zero if t least one signal remains unprocessed */
 
-DECLARE_STATIC_POOL(pool_head_sig_handlers, "sig_handlers", sizeof(struct sig_handler));
+DECLARE_STATIC_TYPED_POOL(pool_head_sig_handlers, "sig_handlers", struct sig_handler);
 
 /* Common signal handler, used by all signals. Received signals are queued.
  * Signal number zero has a specific status, as it cannot be delivered by the
index 1fad578c8fd1e16a39e29d126eef26257d148b65..e06239efb10883a89a0a4d0c8c450152f27722e8 100644 (file)
@@ -155,7 +155,7 @@ struct global_ssl global_ssl = {
 
 static BIO_METHOD *ha_meth;
 
-DECLARE_STATIC_POOL(ssl_sock_ctx_pool, "ssl_sock_ctx", sizeof(struct ssl_sock_ctx));
+DECLARE_STATIC_TYPED_POOL(ssl_sock_ctx_pool, "ssl_sock_ctx", struct ssl_sock_ctx);
 
 DECLARE_POOL(ssl_sock_client_sni_pool, "ssl_sock_client_sni", TLSEXT_MAXLEN_host_name + 1);
 
index be626447755062ffdb68a77534b58705ce67d208..a9ce03d4d7b442d70178f16681ca288a4cd2bc72 100644 (file)
@@ -24,8 +24,8 @@
 #include <haproxy/stconn.h>
 #include <haproxy/xref.h>
 
-DECLARE_POOL(pool_head_connstream, "stconn", sizeof(struct stconn));
-DECLARE_POOL(pool_head_sedesc, "sedesc", sizeof(struct sedesc));
+DECLARE_TYPED_POOL(pool_head_connstream, "stconn", struct stconn);
+DECLARE_TYPED_POOL(pool_head_sedesc, "sedesc", struct sedesc);
 
 /* functions used by default on a detached stream connector */
 static void sc_app_abort(struct stconn *sc);
index 06d1cd86e52055739f26a0a3ce6017245c0301c1..b94e682dc9e936b1575a00610d5e62858a8aaa5a 100644 (file)
@@ -62,7 +62,7 @@
 #include <haproxy/vars.h>
 
 
-DECLARE_POOL(pool_head_stream, "stream", sizeof(struct stream));
+DECLARE_TYPED_POOL(pool_head_stream, "stream", struct stream);
 DECLARE_POOL(pool_head_uniqueid, "uniqueid", UNIQUEID_LEN);
 
 /* incremented by each "show sess" to fix a delimiter between streams */
index d2c8f9b58b6bc6aa348283abcb1e3cd18ce53d2b..f60ee99bfefdba46f9ab72c4cd481c8703f5af63 100644 (file)
 extern struct task *process_stream(struct task *t, void *context, unsigned int state);
 extern void stream_update_timings(struct task *t, uint64_t lat, uint64_t cpu);
 
-DECLARE_POOL(pool_head_task,    "task",    sizeof(struct task));
-DECLARE_POOL(pool_head_tasklet, "tasklet", sizeof(struct tasklet));
+DECLARE_TYPED_POOL(pool_head_task,    "task",    struct task);
+DECLARE_TYPED_POOL(pool_head_tasklet, "tasklet", struct tasklet);
 
 /* This is the memory pool containing all the signal structs. These
  * struct are used to store each required signal between two tasks.
  */
-DECLARE_POOL(pool_head_notification, "notification", sizeof(struct notification));
+DECLARE_TYPED_POOL(pool_head_notification, "notification", struct notification);
 
 /* The lock protecting all wait queues at once. For now we have no better
  * alternative since a task may have to be removed from a queue and placed
index 9342f30d2a5c3f64754a38db643bb0a163898cc6..71712ac9d0f8e56f309c4a35dce7eae219aaa58b 100644 (file)
@@ -72,7 +72,7 @@
 struct eb_root shared_tcpchecks = EB_ROOT;
 
 
-DECLARE_POOL(pool_head_tcpcheck_rule, "tcpcheck_rule", sizeof(struct tcpcheck_rule));
+DECLARE_TYPED_POOL(pool_head_tcpcheck_rule, "tcpcheck_rule", struct tcpcheck_rule);
 
 /**************************************************************************/
 /*************** Init/deinit tcp-check rules and ruleset ******************/
index 7c4bdd4badfae0b359ee8e394fdf6eaa9ed61ee0..5cef93586f6b24d046dbb7156850b3523c076ef7 100644 (file)
@@ -24,7 +24,7 @@
 
 
 /* This contains a pool of struct vars */
-DECLARE_STATIC_POOL(var_pool, "vars", sizeof(struct var));
+DECLARE_STATIC_TYPED_POOL(var_pool, "vars", struct var);
 
 /* list of variables for the process scope. */
 struct vars proc_vars THREAD_ALIGNED(64);
index 4d6b4bb89e24d4ba647b6e97acdc356ce04283b7..9e7bdccca6c25ded4af6413b205d0a8028e48502 100644 (file)
@@ -20,7 +20,7 @@ struct xprt_handshake_ctx {
        void *xprt_ctx;
 };
 
-DECLARE_STATIC_POOL(xprt_handshake_ctx_pool, "xprt_handshake_ctx", sizeof(struct xprt_handshake_ctx));
+DECLARE_STATIC_TYPED_POOL(xprt_handshake_ctx_pool, "xprt_handshake_ctx", struct xprt_handshake_ctx);
 
 /* This XPRT doesn't take care of sending or receiving data, once its handshake
  * is done, it just removes itself