CLEANUP: pools: rename all pool functions and pointers to remove this "2"
During the migration to the second version of the pools, the new
functions and pool pointers were all called "pool_something2()" and
"pool2_something". Now there's no more pool v1 code and it's a real
pain to still have to deal with this. Let's clean this up now by
removing the "2" everywhere, and by renaming the pool heads
"pool_head_something".
diff --git a/include/common/buffer.h b/include/common/buffer.h
index fe6913c..6f5c8dd 100644
--- a/include/common/buffer.h
+++ b/include/common/buffer.h
@@ -48,7 +48,7 @@
struct list list; /* Next element in the <buffer_wq> list */
};
-extern struct pool_head *pool2_buffer;
+extern struct pool_head *pool_head_buffer;
extern struct buffer buf_empty;
extern struct buffer buf_wanted;
extern struct list buffer_wq;
@@ -665,9 +665,9 @@
struct buffer *b;
*buf = &buf_wanted;
- b = pool_alloc_dirty(pool2_buffer);
+ b = pool_alloc_dirty(pool_head_buffer);
if (likely(b)) {
- b->size = pool2_buffer->size - sizeof(struct buffer);
+ b->size = pool_head_buffer->size - sizeof(struct buffer);
b_reset(b);
*buf = b;
}
@@ -686,9 +686,9 @@
struct buffer *b;
*buf = &buf_wanted;
- b = pool_get_first(pool2_buffer);
+ b = pool_get_first(pool_head_buffer);
if (likely(b)) {
- b->size = pool2_buffer->size - sizeof(struct buffer);
+ b->size = pool_head_buffer->size - sizeof(struct buffer);
b_reset(b);
*buf = b;
}
@@ -698,7 +698,7 @@
/* Releases buffer *buf (no check of emptiness) */
static inline void __b_drop(struct buffer **buf)
{
- pool_free2(pool2_buffer, *buf);
+ pool_free(pool_head_buffer, *buf);
}
/* Releases buffer *buf if allocated. */
@@ -735,14 +735,14 @@
return *buf;
*buf = &buf_wanted;
- HA_SPIN_LOCK(POOL_LOCK, &pool2_buffer->lock);
+ HA_SPIN_LOCK(POOL_LOCK, &pool_head_buffer->lock);
/* fast path */
- if ((pool2_buffer->allocated - pool2_buffer->used) > margin) {
- b = __pool_get_first(pool2_buffer);
+ if ((pool_head_buffer->allocated - pool_head_buffer->used) > margin) {
+ b = __pool_get_first(pool_head_buffer);
if (likely(b)) {
- HA_SPIN_UNLOCK(POOL_LOCK, &pool2_buffer->lock);
- b->size = pool2_buffer->size - sizeof(struct buffer);
+ HA_SPIN_UNLOCK(POOL_LOCK, &pool_head_buffer->lock);
+ b->size = pool_head_buffer->size - sizeof(struct buffer);
b_reset(b);
*buf = b;
return b;
@@ -750,12 +750,12 @@
}
/* slow path, uses malloc() */
- b = __pool_refill_alloc(pool2_buffer, margin);
+ b = __pool_refill_alloc(pool_head_buffer, margin);
- HA_SPIN_UNLOCK(POOL_LOCK, &pool2_buffer->lock);
+ HA_SPIN_UNLOCK(POOL_LOCK, &pool_head_buffer->lock);
if (b) {
- b->size = pool2_buffer->size - sizeof(struct buffer);
+ b->size = pool_head_buffer->size - sizeof(struct buffer);
b_reset(b);
*buf = b;
}
diff --git a/include/common/chunk.h b/include/common/chunk.h
index 1a12d0d..a511a59 100644
--- a/include/common/chunk.h
+++ b/include/common/chunk.h
@@ -36,7 +36,7 @@
int len; /* current size of the string from first to last char. <0 = uninit. */
};
-struct pool_head *pool2_trash;
+struct pool_head *pool_head_trash;
/* function prototypes */
@@ -60,7 +60,7 @@
*/
static inline void free_trash_chunk(struct chunk *chunk)
{
- pool_free2(pool2_trash, chunk);
+ pool_free(pool_head_trash, chunk);
}
diff --git a/include/common/memory.h b/include/common/memory.h
index 311354c..5096125 100644
--- a/include/common/memory.h
+++ b/include/common/memory.h
@@ -93,23 +93,23 @@
/*
* This function frees whatever can be freed in pool <pool>.
*/
-void pool_flush2(struct pool_head *pool);
+void pool_flush(struct pool_head *pool);
/*
* This function frees whatever can be freed in all pools, but respecting
* the minimum thresholds imposed by owners.
*
- * <pool_ctx> is used when pool_gc2 is called to release resources to allocate
+ * <pool_ctx> is used when pool_gc is called to release resources to allocate
* an element in __pool_refill_alloc. It is important because <pool_ctx> is
* already locked, so we need to skip the lock here.
*/
-void pool_gc2(struct pool_head *pool_ctx);
+void pool_gc(struct pool_head *pool_ctx);
/*
* This function destroys a pull by freeing it completely.
* This should be called only under extreme circumstances.
*/
-void *pool_destroy2(struct pool_head *pool);
+void *pool_destroy(struct pool_head *pool);
/*
* Returns a pointer to type <type> taken from the pool <pool_type> if
@@ -209,7 +209,7 @@
* dynamically allocated. In the first case, <pool_type> is updated to point to
* the next element in the list. Memory poisonning is performed if enabled.
*/
-static inline void *pool_alloc2(struct pool_head *pool)
+static inline void *pool_alloc(struct pool_head *pool)
{
void *p;
@@ -238,7 +238,7 @@
* pointer. Just like with the libc's free(), nothing
* is done if <ptr> is NULL.
*/
-static inline void pool_free2(struct pool_head *pool, void *ptr)
+static inline void pool_free(struct pool_head *pool, void *ptr)
{
if (likely(ptr != NULL)) {
HA_SPIN_LOCK(POOL_LOCK, &pool->lock);
diff --git a/include/proto/applet.h b/include/proto/applet.h
index 8024981..cdd4d90 100644
--- a/include/proto/applet.h
+++ b/include/proto/applet.h
@@ -55,14 +55,14 @@
/* Tries to allocate a new appctx and initialize its main fields. The appctx
* is returned on success, NULL on failure. The appctx must be released using
- * pool_free2(connection) or appctx_free(), since it's allocated from the
+ * pool_free(connection) or appctx_free(), since it's allocated from the
* connection pool. <applet> is assigned as the applet, but it can be NULL.
*/
static inline struct appctx *appctx_new(struct applet *applet, unsigned long thread_mask)
{
struct appctx *appctx;
- appctx = pool_alloc2(pool2_connection);
+ appctx = pool_alloc(pool_head_connection);
if (likely(appctx != NULL)) {
appctx->obj_type = OBJ_TYPE_APPCTX;
appctx->applet = applet;
@@ -93,7 +93,7 @@
HA_SPIN_UNLOCK(BUF_WQ_LOCK, &buffer_wq_lock);
}
- pool_free2(pool2_connection, appctx);
+ pool_free(pool_head_connection, appctx);
HA_ATOMIC_SUB(&nb_applets, 1);
}
static inline void appctx_free(struct appctx *appctx)
diff --git a/include/proto/connection.h b/include/proto/connection.h
index c68ae20..0efce99 100644
--- a/include/proto/connection.h
+++ b/include/proto/connection.h
@@ -30,8 +30,8 @@
#include <proto/fd.h>
#include <proto/obj_type.h>
-extern struct pool_head *pool2_connection;
-extern struct pool_head *pool2_connstream;
+extern struct pool_head *pool_head_connection;
+extern struct pool_head *pool_head_connstream;
extern struct xprt_ops *registered_xprt[XPRT_ENTRIES];
extern struct alpn_mux_list alpn_mux_list;
@@ -642,13 +642,13 @@
/* Tries to allocate a new connection and initialized its main fields. The
* connection is returned on success, NULL on failure. The connection must
- * be released using pool_free2() or conn_free().
+ * be released using pool_free() or conn_free().
*/
static inline struct connection *conn_new()
{
struct connection *conn;
- conn = pool_alloc2(pool2_connection);
+ conn = pool_alloc(pool_head_connection);
if (likely(conn != NULL))
conn_init(conn);
return conn;
@@ -657,13 +657,13 @@
/* Releases a conn_stream previously allocated by cs_new() */
static inline void cs_free(struct conn_stream *cs)
{
- pool_free2(pool2_connstream, cs);
+ pool_free(pool_head_connstream, cs);
}
/* Tries to allocate a new conn_stream and initialize its main fields. If
* <conn> is NULL, then a new connection is allocated on the fly, initialized,
* and assigned to cs->conn ; this connection will then have to be released
- * using pool_free2() or conn_free(). The conn_stream is initialized and added
+ * using pool_free() or conn_free(). The conn_stream is initialized and added
* to the mux's stream list on success, then returned. On failure, nothing is
* allocated and NULL is returned.
*/
@@ -671,7 +671,7 @@
{
struct conn_stream *cs;
- cs = pool_alloc2(pool2_connstream);
+ cs = pool_alloc(pool_head_connstream);
if (!likely(cs))
return NULL;
@@ -691,7 +691,7 @@
/* Releases a connection previously allocated by conn_new() */
static inline void conn_free(struct connection *conn)
{
- pool_free2(pool2_connection, conn);
+ pool_free(pool_head_connection, conn);
}
/* Release a conn_stream, and kill the connection if it was the last one */
diff --git a/include/proto/filters.h b/include/proto/filters.h
index 0d3e9ac..1be1637 100644
--- a/include/proto/filters.h
+++ b/include/proto/filters.h
@@ -93,7 +93,7 @@
FLT_STRM_DATA_CB_IMPL_2(strm, chn, call, ##__VA_ARGS__), \
FLT_STRM_DATA_CB_IMPL_1(strm, chn, call, ##__VA_ARGS__))
-extern struct pool_head *pool2_filter;
+extern struct pool_head *pool_head_filter;
void flt_deinit(struct proxy *p);
int flt_check(struct proxy *p);
diff --git a/include/proto/hdr_idx.h b/include/proto/hdr_idx.h
index 0536444..f65b3c6 100644
--- a/include/proto/hdr_idx.h
+++ b/include/proto/hdr_idx.h
@@ -25,7 +25,7 @@
#include <common/config.h>
#include <types/hdr_idx.h>
-extern struct pool_head *pool2_hdr_idx;
+extern struct pool_head *pool_head_hdr_idx;
/*
* Initialize the list pointers.
diff --git a/include/proto/log.h b/include/proto/log.h
index 95c1701..c92217c 100644
--- a/include/proto/log.h
+++ b/include/proto/log.h
@@ -34,8 +34,8 @@
#include <types/proxy.h>
#include <types/stream.h>
-extern struct pool_head *pool2_requri;
-extern struct pool_head *pool2_uniqueid;
+extern struct pool_head *pool_head_requri;
+extern struct pool_head *pool_head_uniqueid;
extern char *log_format;
extern char default_tcp_log_format[];
diff --git a/include/proto/queue.h b/include/proto/queue.h
index 19212d4..f66d809 100644
--- a/include/proto/queue.h
+++ b/include/proto/queue.h
@@ -34,7 +34,7 @@
#include <proto/backend.h>
-extern struct pool_head *pool2_pendconn;
+extern struct pool_head *pool_head_pendconn;
int init_pendconn();
struct pendconn *pendconn_add(struct stream *strm);
diff --git a/include/proto/session.h b/include/proto/session.h
index 7f95e2a..d63d29e 100644
--- a/include/proto/session.h
+++ b/include/proto/session.h
@@ -32,7 +32,7 @@
#include <proto/stick_table.h>
-extern struct pool_head *pool2_session;
+extern struct pool_head *pool_head_session;
struct session *session_new(struct proxy *fe, struct listener *li, enum obj_type *origin);
void session_free(struct session *sess);
int init_session();
diff --git a/include/proto/signal.h b/include/proto/signal.h
index 32f6ce6..063683f 100644
--- a/include/proto/signal.h
+++ b/include/proto/signal.h
@@ -20,7 +20,7 @@
extern int signal_queue_len;
extern struct signal_descriptor signal_state[];
-extern struct pool_head *pool2_sig_handlers;
+extern struct pool_head *pool_head_sig_handlers;
__decl_hathreads(extern HA_SPINLOCK_T signals_lock);
diff --git a/include/proto/stream.h b/include/proto/stream.h
index 1a31930..938c58d 100644
--- a/include/proto/stream.h
+++ b/include/proto/stream.h
@@ -30,7 +30,7 @@
#include <proto/stick_table.h>
#include <proto/task.h>
-extern struct pool_head *pool2_stream;
+extern struct pool_head *pool_head_stream;
extern struct list streams;
extern struct data_cb sess_conn_cb;
diff --git a/include/proto/task.h b/include/proto/task.h
index 7639ed7..4291482 100644
--- a/include/proto/task.h
+++ b/include/proto/task.h
@@ -88,8 +88,8 @@
extern unsigned int tasks_run_queue_cur;
extern unsigned int nb_tasks_cur;
extern unsigned int niced_tasks; /* number of niced tasks in the run queue */
-extern struct pool_head *pool2_task;
-extern struct pool_head *pool2_notification;
+extern struct pool_head *pool_head_task;
+extern struct pool_head *pool_head_notification;
__decl_hathreads(extern HA_SPINLOCK_T rq_lock); /* spin lock related to run queue */
__decl_hathreads(extern HA_SPINLOCK_T wq_lock); /* spin lock related to wait queue */
@@ -218,7 +218,7 @@
*/
static inline struct task *task_new(unsigned long thread_mask)
{
- struct task *t = pool_alloc2(pool2_task);
+ struct task *t = pool_alloc(pool_head_task);
if (t) {
HA_ATOMIC_ADD(&nb_tasks, 1);
task_init(t, thread_mask);
@@ -232,9 +232,9 @@
*/
static inline void task_free(struct task *t)
{
- pool_free2(pool2_task, t);
+ pool_free(pool_head_task, t);
if (unlikely(stopping))
- pool_flush2(pool2_task);
+ pool_flush(pool_head_task);
HA_ATOMIC_SUB(&nb_tasks, 1);
}
@@ -291,7 +291,7 @@
*/
static inline struct notification *notification_new(struct list *purge, struct list *event, struct task *wakeup)
{
- struct notification *com = pool_alloc2(pool2_notification);
+ struct notification *com = pool_alloc(pool_head_notification);
if (!com)
return NULL;
LIST_ADDQ(purge, &com->purge_me);
@@ -315,7 +315,7 @@
LIST_DEL(&com->purge_me);
if (!com->task) {
HA_SPIN_UNLOCK(NOTIF_LOCK, &com->lock);
- pool_free2(pool2_notification, com);
+ pool_free(pool_head_notification, com);
continue;
}
com->task = NULL;
@@ -337,7 +337,7 @@
LIST_DEL(&com->wake_me);
if (!com->task) {
HA_SPIN_UNLOCK(NOTIF_LOCK, &com->lock);
- pool_free2(pool2_notification, com);
+ pool_free(pool_head_notification, com);
continue;
}
task_wakeup(com->task, TASK_WOKEN_MSG);
diff --git a/include/types/capture.h b/include/types/capture.h
index cd8f2a7..a9ced25 100644
--- a/include/types/capture.h
+++ b/include/types/capture.h
@@ -34,7 +34,7 @@
struct pool_head *pool; /* pool of pre-allocated memory area of (len+1) bytes */
};
-extern struct pool_head *pool2_capture;
+extern struct pool_head *pool_head_capture;
#endif /* _TYPES_CAPTURE_H */
diff --git a/include/types/proto_http.h b/include/types/proto_http.h
index 9de1410..35a8cd2 100644
--- a/include/types/proto_http.h
+++ b/include/types/proto_http.h
@@ -357,7 +357,7 @@
extern const struct http_method_name http_known_methods[HTTP_METH_OTHER];
-extern struct pool_head *pool2_http_txn;
+extern struct pool_head *pool_head_http_txn;
#endif /* _TYPES_PROTO_HTTP_H */