CLEANUP: stconn: rename cs_{new,create,free,destroy}_* to sc_*
This renames the following functions:
cs_new_from_endp() -> sc_new_from_endp()
cs_new_from_strm() -> sc_new_from_strm()
cs_new_from_check() -> sc_new_from_check()
cs_applet_create() -> sc_applet_create()
cs_destroy() -> sc_destroy()
cs_free() -> sc_free()
diff --git a/include/haproxy/conn_stream.h b/include/haproxy/conn_stream.h
index b48b4f1..d5c8b19 100644
--- a/include/haproxy/conn_stream.h
+++ b/include/haproxy/conn_stream.h
@@ -38,18 +38,18 @@
struct sedesc *sedesc_new();
void sedesc_free(struct sedesc *sedesc);
-struct stconn *cs_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input);
-struct stconn *cs_new_from_strm(struct stream *strm, unsigned int flags);
-struct stconn *cs_new_from_check(struct check *check, unsigned int flags);
-void cs_free(struct stconn *cs);
+struct stconn *sc_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input);
+struct stconn *sc_new_from_strm(struct stream *strm, unsigned int flags);
+struct stconn *sc_new_from_check(struct check *check, unsigned int flags);
+void sc_free(struct stconn *cs);
int cs_attach_mux(struct stconn *cs, void *target, void *ctx);
int cs_attach_strm(struct stconn *cs, struct stream *strm);
-void cs_destroy(struct stconn *cs);
+void sc_destroy(struct stconn *cs);
int cs_reset_endp(struct stconn *cs);
-struct appctx *cs_applet_create(struct stconn *cs, struct applet *app);
+struct appctx *sc_applet_create(struct stconn *cs, struct applet *app);
/* The se_fl_*() set of functions manipulate the stream endpoint flags from
* the stream endpoint itself. The sc_ep_*() set of functions manipulate the
diff --git a/include/haproxy/mux_quic.h b/include/haproxy/mux_quic.h
index 11da819..bfae337 100644
--- a/include/haproxy/mux_quic.h
+++ b/include/haproxy/mux_quic.h
@@ -107,7 +107,7 @@
/* TODO duplicated from mux_h2 */
sess->t_idle = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake;
- if (!cs_new_from_endp(qcs->endp, sess, buf))
+ if (!sc_new_from_endp(qcs->endp, sess, buf))
return NULL;
++qcc->nb_cs;
diff --git a/src/applet.c b/src/applet.c
index 834c479..0586411 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -98,7 +98,7 @@
sess = session_new(px, NULL, &appctx->obj_type);
if (!sess)
return -1;
- if (!cs_new_from_endp(appctx->sedesc, sess, input)) {
+ if (!sc_new_from_endp(appctx->sedesc, sess, input)) {
session_free(sess);
return -1;
}
diff --git a/src/backend.c b/src/backend.c
index 091c598..2447813 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -2175,7 +2175,7 @@
* in SC_ST_RDY state. So, try to create the appctx now.
*/
BUG_ON(sc_appctx(cs));
- appctx = cs_applet_create(cs, objt_applet(s->target));
+ appctx = sc_applet_create(cs, objt_applet(s->target));
if (!appctx) {
/* No more memory, let's immediately abort. Force the
* error code to ignore the ERR_LOCAL which is not a
diff --git a/src/cache.c b/src/cache.c
index db75169..7b4e125 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1840,7 +1840,7 @@
}
s->target = &http_cache_applet.obj_type;
- if ((appctx = cs_applet_create(s->scb, objt_applet(s->target)))) {
+ if ((appctx = sc_applet_create(s->scb, objt_applet(s->target)))) {
struct cache_appctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
appctx->st0 = HTX_CACHE_INIT;
diff --git a/src/check.c b/src/check.c
index 438e4b3..95203cb 100644
--- a/src/check.c
+++ b/src/check.c
@@ -1119,7 +1119,7 @@
check->current_step = NULL;
- check->cs = cs_new_from_check(check, SC_FL_NONE);
+ check->cs = sc_new_from_check(check, SC_FL_NONE);
if (!check->cs) {
set_server_check_status(check, HCHK_STATUS_SOCKERR, NULL);
goto end;
@@ -1180,7 +1180,7 @@
}
if (cs) {
- cs_destroy(cs);
+ sc_destroy(cs);
cs = check->cs = NULL;
conn = NULL;
}
@@ -1341,7 +1341,7 @@
check_release_buf(check, &check->bi);
check_release_buf(check, &check->bo);
if (check->cs) {
- cs_destroy(check->cs);
+ sc_destroy(check->cs);
check->cs = NULL;
}
}
diff --git a/src/conn_stream.c b/src/conn_stream.c
index 1695541..a788b78 100644
--- a/src/conn_stream.c
+++ b/src/conn_stream.c
@@ -121,7 +121,7 @@
* function. The caller must, at least, set the SE_FL_ORPHAN or SE_FL_DETACHED
* flag.
*/
-static struct stconn *cs_new(struct sedesc *sedesc)
+static struct stconn *sc_new(struct sedesc *sedesc)
{
struct stconn *cs;
@@ -161,11 +161,11 @@
* defined. It returns NULL on error. On success, the new stream connector is
* returned. In this case, SE_FL_ORPHAN flag is removed.
*/
-struct stconn *cs_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input)
+struct stconn *sc_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input)
{
struct stconn *cs;
- cs = cs_new(sedesc);
+ cs = sc_new(sedesc);
if (unlikely(!cs))
return NULL;
if (unlikely(!stream_new(sess, cs, input))) {
@@ -177,14 +177,14 @@
}
/* Creates a new stream connector from an stream. There is no endpoint here, thus it
- * will be created by cs_new(). So the SE_FL_DETACHED flag is set. It returns
+ * will be created by sc_new(). So the SE_FL_DETACHED flag is set. It returns
* NULL on error. On success, the new stream connector is returned.
*/
-struct stconn *cs_new_from_strm(struct stream *strm, unsigned int flags)
+struct stconn *sc_new_from_strm(struct stream *strm, unsigned int flags)
{
struct stconn *cs;
- cs = cs_new(NULL);
+ cs = sc_new(NULL);
if (unlikely(!cs))
return NULL;
cs->flags |= flags;
@@ -195,14 +195,14 @@
}
/* Creates a new stream connector from an health-check. There is no endpoint here,
- * thus it will be created by cs_new(). So the SE_FL_DETACHED flag is set. It
+ * thus it will be created by sc_new(). So the SE_FL_DETACHED flag is set. It
* returns NULL on error. On success, the new stream connector is returned.
*/
-struct stconn *cs_new_from_check(struct check *check, unsigned int flags)
+struct stconn *sc_new_from_check(struct check *check, unsigned int flags)
{
struct stconn *cs;
- cs = cs_new(NULL);
+ cs = sc_new(NULL);
if (unlikely(!cs))
return NULL;
cs->flags |= flags;
@@ -212,10 +212,10 @@
return cs;
}
-/* Releases a stconn previously allocated by cs_new(), as well as its
+/* Releases a stconn previously allocated by sc_new(), as well as its
* endpoint, if it exists. This function is called internally or on error path.
*/
-void cs_free(struct stconn *cs)
+void sc_free(struct stconn *cs)
{
sockaddr_free(&cs->src);
sockaddr_free(&cs->dst);
@@ -232,12 +232,12 @@
* layer defined. Except on error path, this one must be used. if release, the
* pointer on the CS is set to NULL.
*/
-static void cs_free_cond(struct stconn **csp)
+static void sc_free_cond(struct stconn **csp)
{
struct stconn *cs = *csp;
if (!cs->app && (!cs->sedesc || sc_ep_test(cs, SE_FL_DETACHED))) {
- cs_free(cs);
+ sc_free(cs);
*csp = NULL;
}
}
@@ -394,7 +394,7 @@
cs->app_ops = &sc_app_embedded_ops;
else
cs->app_ops = NULL;
- cs_free_cond(csp);
+ sc_free_cond(csp);
}
/* Detaches the stconn from the app layer. If there is no endpoint attached
@@ -416,13 +416,13 @@
tasklet_free(cs->wait_event.tasklet);
cs->wait_event.tasklet = NULL;
cs->wait_event.events = 0;
- cs_free_cond(csp);
+ sc_free_cond(csp);
}
/* Destroy the stconn. It is detached from its endpoint and its
* application. After this call, the stconn must be considered as released.
*/
-void cs_destroy(struct stconn *cs)
+void sc_destroy(struct stconn *cs)
{
cs_detach_endp(&cs);
cs_detach_app(&cs);
@@ -478,7 +478,7 @@
* It also pre-initializes the applet's context and returns it (or NULL in case
* it could not be allocated).
*/
-struct appctx *cs_applet_create(struct stconn *cs, struct applet *app)
+struct appctx *sc_applet_create(struct stconn *cs, struct applet *app)
{
struct appctx *appctx;
diff --git a/src/http_ana.c b/src/http_ana.c
index 9bcca5d..8a58287 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -430,7 +430,7 @@
*/
if (!s->target && http_stats_check_uri(s, txn, px)) {
s->target = &http_stats_applet.obj_type;
- if (unlikely(!cs_applet_create(s->scb, objt_applet(s->target)))) {
+ if (unlikely(!sc_applet_create(s->scb, objt_applet(s->target)))) {
s->logs.tv_request = now;
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_RESOURCE;
diff --git a/src/mux_h1.c b/src/mux_h1.c
index 2c3f118..07b40de 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -732,7 +732,7 @@
if (h1s->req.flags & H1_MF_UPG_WEBSOCKET)
se_fl_set(h1s->endp, SE_FL_WEBSOCKET);
- if (!cs_new_from_endp(h1s->endp, h1c->conn->owner, input)) {
+ if (!sc_new_from_endp(h1s->endp, h1c->conn->owner, input)) {
TRACE_ERROR("CS allocation failure", H1_EV_STRM_NEW|H1_EV_STRM_END|H1_EV_STRM_ERR, h1c->conn, h1s);
goto err;
}
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 1e50bed..dde2392 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -1635,7 +1635,7 @@
*/
sess->t_idle = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake;
- if (!cs_new_from_endp(h2s->endp, sess, input))
+ if (!sc_new_from_endp(h2s->endp, sess, input))
goto out_close;
h2c->nb_cs++;
diff --git a/src/mux_pt.c b/src/mux_pt.c
index b8a375e..5f4c041 100644
--- a/src/mux_pt.c
+++ b/src/mux_pt.c
@@ -308,7 +308,7 @@
ctx->endp->conn = conn;
se_fl_set(ctx->endp, SE_FL_T_MUX | SE_FL_ORPHAN);
- cs = cs_new_from_endp(ctx->endp, sess, input);
+ cs = sc_new_from_endp(ctx->endp, sess, input);
if (!cs) {
TRACE_ERROR("CS allocation failure", PT_EV_STRM_NEW|PT_EV_STRM_END|PT_EV_STRM_ERR, conn);
goto fail_free_endp;
diff --git a/src/stream.c b/src/stream.c
index 16456e0..3c9184c 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -449,7 +449,7 @@
if (cs_attach_strm(s->scf, s) < 0)
goto out_fail_attach_scf;
- s->scb = cs_new_from_strm(s, SC_FL_ISBACK);
+ s->scb = sc_new_from_strm(s, SC_FL_ISBACK);
if (!s->scb)
goto out_fail_alloc_scb;
@@ -568,7 +568,7 @@
flt_stream_release(s, 0);
LIST_DELETE(&s->list);
out_fail_attach_scf:
- cs_free(s->scb);
+ sc_free(s->scb);
out_fail_alloc_scb:
task_destroy(t);
out_fail_alloc:
@@ -708,8 +708,8 @@
}
LIST_DELETE(&s->list);
- cs_destroy(s->scb);
- cs_destroy(s->scf);
+ sc_destroy(s->scb);
+ sc_destroy(s->scf);
pool_free(pool_head_stream, s);
@@ -992,7 +992,7 @@
if (flags & ACT_OPT_FIRST) {
/* Register applet. this function schedules the applet. */
s->target = &rule->applet.obj_type;
- appctx = cs_applet_create(s->scb, objt_applet(s->target));
+ appctx = sc_applet_create(s->scb, objt_applet(s->target));
if (unlikely(!appctx))
return ACT_RET_ERR;