CLEANUP: stconn: rename remaining management functions from cs_* to sc_*
This is the end of the renaming for the generic SC management functions
and macros:
cs_applet_process() -> sc_applet_process()
cs_attach_applet() -> sc_attach_applet()
cs_attach_mux() -> sc_attach_mux()
cs_attach_strm() -> sc_attach_strm()
cs_detach_app() -> sc_detach_app()
cs_detach_endp() -> sc_detach_endp()
cs_notify() -> sc_notify()
cs_reset_endp() -> sc_reset_endp()
cs_state_in() -> sc_state_in()
cs_update() -> sc_update()
cs_update_rx() -> sc_update_rx()
cs_update_tx() -> sc_update_tx()
IS_HTX_CS() -> IS_HTX_SC()
diff --git a/include/haproxy/conn_stream.h b/include/haproxy/conn_stream.h
index d5c8b19..0e47285 100644
--- a/include/haproxy/conn_stream.h
+++ b/include/haproxy/conn_stream.h
@@ -33,7 +33,7 @@
struct stream;
struct check;
-#define IS_HTX_CS(cs) (sc_conn(cs) && IS_HTX_CONN(__sc_conn(cs)))
+#define IS_HTX_SC(cs) (sc_conn(cs) && IS_HTX_CONN(__sc_conn(cs)))
struct sedesc *sedesc_new();
void sedesc_free(struct sedesc *sedesc);
@@ -43,11 +43,11 @@
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);
+int sc_attach_mux(struct stconn *cs, void *target, void *ctx);
+int sc_attach_strm(struct stconn *cs, struct stream *strm);
void sc_destroy(struct stconn *cs);
-int cs_reset_endp(struct stconn *cs);
+int sc_reset_endp(struct stconn *cs);
struct appctx *sc_applet_create(struct stconn *cs, struct applet *app);
diff --git a/include/haproxy/cs_utils.h b/include/haproxy/cs_utils.h
index 7efe60e..2ea67d9 100644
--- a/include/haproxy/cs_utils.h
+++ b/include/haproxy/cs_utils.h
@@ -33,8 +33,8 @@
#include <haproxy/session.h>
#include <haproxy/stream.h>
-void cs_update_rx(struct stconn *cs);
-void cs_update_tx(struct stconn *cs);
+void sc_update_rx(struct stconn *cs);
+void sc_update_tx(struct stconn *cs);
struct task *sc_conn_io_cb(struct task *t, void *ctx, unsigned int state);
int sc_conn_sync_recv(struct stconn *cs);
@@ -340,11 +340,11 @@
cs->app_ops->chk_snd(cs);
}
-/* Combines both cs_update_rx() and cs_update_tx() at once */
-static inline void cs_update(struct stconn *cs)
+/* Combines both sc_update_rx() and sc_update_tx() at once */
+static inline void sc_update(struct stconn *cs)
{
- cs_update_rx(cs);
- cs_update_tx(cs);
+ sc_update_rx(cs);
+ sc_update_tx(cs);
}
/* for debugging, reports the stream connector state name */
diff --git a/src/backend.c b/src/backend.c
index 2447813..8b12afb 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1576,7 +1576,7 @@
if (avail >= 1) {
if (srv_conn->mux->attach(srv_conn, s->scb->sedesc, s->sess) == -1) {
srv_conn = NULL;
- if (cs_reset_endp(s->scb) < 0)
+ if (sc_reset_endp(s->scb) < 0)
return SF_ERR_INTERNAL;
sc_ep_clr(s->scb, ~SE_FL_DETACHED);
}
@@ -1651,7 +1651,7 @@
return SF_ERR_INTERNAL; /* how did we get there ? */
}
- if (cs_attach_mux(s->scb, NULL, srv_conn) < 0) {
+ if (sc_attach_mux(s->scb, NULL, srv_conn) < 0) {
conn_free(srv_conn);
return SF_ERR_INTERNAL; /* how did we get there ? */
}
@@ -2369,7 +2369,7 @@
* Note: the stream connector will be switched to ST_REQ, ST_ASS or
* ST_TAR and SE_FL_ERROR and SF_CONN_EXP flags will be unset.
*/
- if (cs_reset_endp(cs) < 0) {
+ if (sc_reset_endp(cs) < 0) {
if (!s->conn_err_type)
s->conn_err_type = STRM_ET_CONN_OTHER;
diff --git a/src/check.c b/src/check.c
index 95203cb..a7a7c51 100644
--- a/src/check.c
+++ b/src/check.c
@@ -1148,7 +1148,7 @@
TRACE_DEVEL("closing current connection", CHK_EV_TASK_WAKE|CHK_EV_HCHK_RUN, check);
check->state &= ~CHK_ST_CLOSE_CONN;
conn = NULL;
- if (!cs_reset_endp(check->cs)) {
+ if (!sc_reset_endp(check->cs)) {
/* error will be handled by tcpcheck_main().
* On success, remove all flags except SE_FL_DETACHED
*/
diff --git a/src/cli.c b/src/cli.c
index 1a1b418..685168b 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -2768,7 +2768,7 @@
*/
if (!sc_conn_ready(s->scb)) {
s->srv_conn = NULL;
- if (cs_reset_endp(s->scb) < 0) {
+ if (sc_reset_endp(s->scb) < 0) {
if (!s->conn_err_type)
s->conn_err_type = STRM_ET_CONN_OTHER;
if (s->srv_error)
diff --git a/src/conn_stream.c b/src/conn_stream.c
index a788b78..4aabf1f 100644
--- a/src/conn_stream.c
+++ b/src/conn_stream.c
@@ -44,7 +44,7 @@
static int sc_conn_process(struct stconn *cs);
static int sc_conn_recv(struct stconn *cs);
static int sc_conn_send(struct stconn *cs);
-static int cs_applet_process(struct stconn *cs);
+static int sc_applet_process(struct stconn *cs);
/* stream connector operations for connections */
struct sc_app_ops sc_app_conn_ops = {
@@ -72,7 +72,7 @@
.chk_snd = sc_app_chk_snd_applet,
.shutr = sc_app_shutr_applet,
.shutw = sc_app_shutw_applet,
- .wake = cs_applet_process,
+ .wake = sc_applet_process,
.name = "STRM",
};
@@ -247,7 +247,7 @@
* -1 on error and 0 on sucess. SE_FL_DETACHED flag is removed. This function is
* called from a mux when it is attached to a stream or a health-check.
*/
-int cs_attach_mux(struct stconn *cs, void *endp, void *ctx)
+int sc_attach_mux(struct stconn *cs, void *endp, void *ctx)
{
struct connection *conn = ctx;
struct sedesc *sedesc = cs->sedesc;
@@ -290,7 +290,7 @@
* removed. This function is called by a stream when a backend applet is
* registered.
*/
-static void cs_attach_applet(struct stconn *cs, void *endp)
+static void sc_attach_applet(struct stconn *cs, void *endp)
{
cs->sedesc->se = endp;
sc_ep_set(cs, SE_FL_T_APPLET);
@@ -304,7 +304,7 @@
* removed. This function is called by a stream when it is created to attach it
* on the stream connector on the client side.
*/
-int cs_attach_strm(struct stconn *cs, struct stream *strm)
+int sc_attach_strm(struct stconn *cs, struct stream *strm)
{
cs->app = &strm->obj_type;
sc_ep_clr(cs, SE_FL_ORPHAN);
@@ -334,7 +334,7 @@
* endpoint is reset and flag as detached. If the app layer is also detached,
* the stream connector is released.
*/
-static void cs_detach_endp(struct stconn **csp)
+static void sc_detach_endp(struct stconn **csp)
{
struct stconn *cs = *csp;
@@ -400,7 +400,7 @@
/* Detaches the stconn from the app layer. If there is no endpoint attached
* to the stconn
*/
-static void cs_detach_app(struct stconn **csp)
+static void sc_detach_app(struct stconn **csp)
{
struct stconn *cs = *csp;
@@ -424,8 +424,8 @@
*/
void sc_destroy(struct stconn *cs)
{
- cs_detach_endp(&cs);
- cs_detach_app(&cs);
+ sc_detach_endp(&cs);
+ sc_detach_app(&cs);
BUG_ON_HOT(cs);
}
@@ -436,7 +436,7 @@
* Only SE_FL_ERROR flag is removed on the endpoint. Orther flags are preserved.
* It is the caller responsibility to remove other flags if needed.
*/
-int cs_reset_endp(struct stconn *cs)
+int sc_reset_endp(struct stconn *cs)
{
struct sedesc *new_endp;
@@ -449,7 +449,7 @@
* reset. The app is still attached, the cs will not be
* released.
*/
- cs_detach_endp(&cs);
+ sc_detach_endp(&cs);
return 0;
}
@@ -463,7 +463,7 @@
se_fl_setall(new_endp, sc_ep_get(cs) & SE_FL_APP_MASK);
/* The app is still attached, the cs will not be released */
- cs_detach_endp(&cs);
+ sc_detach_endp(&cs);
BUG_ON(cs->sedesc);
cs->sedesc = new_endp;
cs->sedesc->sc = cs;
@@ -474,7 +474,7 @@
/* Create an applet to handle a stream connector as a new appctx. The CS will
* wake it up every time it is solicited. The appctx must be deleted by the task
- * handler using cs_detach_endp(), possibly from within the function itself.
+ * handler using sc_detach_endp(), possibly from within the function itself.
* It also pre-initializes the applet's context and returns it (or NULL in case
* it could not be allocated).
*/
@@ -487,7 +487,7 @@
appctx = appctx_new_here(app, cs->sedesc);
if (!appctx)
return NULL;
- cs_attach_applet(cs, appctx);
+ sc_attach_applet(cs, appctx);
appctx->t->nice = __sc_strm(cs)->task->nice;
applet_need_more_data(appctx);
appctx_wakeup(appctx);
@@ -1006,7 +1006,7 @@
* handler, as what it does will be used to compute the stream task's
* expiration.
*/
-void cs_update_rx(struct stconn *cs)
+void sc_update_rx(struct stconn *cs)
{
struct channel *ic = sc_ic(cs);
@@ -1048,7 +1048,7 @@
* handler, as what it does will be used to compute the stream task's
* expiration.
*/
-void cs_update_tx(struct stconn *cs)
+void sc_update_tx(struct stconn *cs)
{
struct channel *oc = sc_oc(cs);
struct channel *ic = sc_ic(cs);
@@ -1087,17 +1087,17 @@
}
}
-/* This function is the equivalent to cs_update() except that it's
+/* This function is the equivalent to sc_update() except that it's
* designed to be called from outside the stream handlers, typically the lower
* layers (applets, connections) after I/O completion. After updating the stream
* interface and timeouts, it will try to forward what can be forwarded, then to
* wake the associated task up if an important event requires special handling.
* It may update SE_FL_WAIT_DATA and/or SC_FL_NEED_ROOM, that the callers are
* encouraged to watch to take appropriate action.
- * It should not be called from within the stream itself, cs_update()
+ * It should not be called from within the stream itself, sc_update()
* is designed for this.
*/
-static void cs_notify(struct stconn *cs)
+static void sc_notify(struct stconn *cs)
{
struct channel *ic = sc_ic(cs);
struct channel *oc = sc_oc(cs);
@@ -1879,7 +1879,7 @@
* pending data, then possibly wake the stream up based on the new
* stream connector status.
*/
- cs_notify(cs);
+ sc_notify(cs);
stream_release_buffers(__sc_strm(cs));
return 0;
}
@@ -1913,7 +1913,7 @@
* may re-enable the applet's based on the channels and stream connector's final
* states.
*/
-static int cs_applet_process(struct stconn *cs)
+static int sc_applet_process(struct stconn *cs)
{
struct channel *ic = sc_ic(cs);
@@ -1933,10 +1933,10 @@
applet_have_more_data(__sc_appctx(cs));
/* update the stream connector, channels, and possibly wake the stream up */
- cs_notify(cs);
+ sc_notify(cs);
stream_release_buffers(__sc_strm(cs));
- /* cs_notify may have passed through chk_snd and released some blocking
+ /* sc_notify may have passed through chk_snd and released some blocking
* flags. Process_stream will consider those flags to wake up the
* appctx but in the case the task is not in runqueue we may have to
* wakeup the appctx immediately.
diff --git a/src/hlua.c b/src/hlua.c
index 292d8f2..ddc5ff2 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -1977,7 +1977,7 @@
* interface.
*/
if (!channel_is_empty(sc_ic(cs)))
- cs_update(cs);
+ sc_update(cs);
/* If write notifications are registered, we considers we want
* to write, so we clear the blocking flag.
diff --git a/src/http_ana.c b/src/http_ana.c
index 8a58287..d0ab215 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -1263,7 +1263,7 @@
res->analyse_exp = TICK_ETERNITY;
res->total = 0;
- if (cs_reset_endp(s->scb) < 0) {
+ if (sc_reset_endp(s->scb) < 0) {
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_INTERNAL;
return -1;
diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c
index 058ab3b..a78751b 100644
--- a/src/mux_fcgi.c
+++ b/src/mux_fcgi.c
@@ -1135,7 +1135,7 @@
TRACE_ERROR("fstream allocation failure", FCGI_EV_FSTRM_NEW|FCGI_EV_FSTRM_END|FCGI_EV_FSTRM_ERR, fconn->conn);
goto out;
}
- if (cs_attach_mux(cs, fstrm, fconn->conn) < 0)
+ if (sc_attach_mux(cs, fstrm, fconn->conn) < 0)
goto out;
fstrm->endp = cs->sedesc;
fstrm->sess = sess;
diff --git a/src/mux_h1.c b/src/mux_h1.c
index 07b40de..a30500e 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -819,7 +819,7 @@
goto fail;
if (cs) {
- if (cs_attach_mux(cs, h1s, h1c->conn) < 0)
+ if (sc_attach_mux(cs, h1s, h1c->conn) < 0)
goto fail;
h1s->endp = cs->sedesc;
}
@@ -858,7 +858,7 @@
if (!h1s)
goto fail;
- if (cs_attach_mux(cs, h1s, h1c->conn) < 0)
+ if (sc_attach_mux(cs, h1s, h1c->conn) < 0)
goto fail;
h1s->flags |= H1S_F_RX_BLK;
diff --git a/src/mux_h2.c b/src/mux_h2.c
index dde2392..cfffd69 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -1693,7 +1693,7 @@
goto out;
}
- if (cs_attach_mux(cs, h2s, h2c->conn) < 0) {
+ if (sc_attach_mux(cs, h2s, h2c->conn) < 0) {
TRACE_ERROR("Failed to allocate a new stream", H2_EV_H2S_NEW, h2c->conn);
h2s_destroy(h2s);
h2s = NULL;
diff --git a/src/mux_pt.c b/src/mux_pt.c
index 5f4c041..acebdee 100644
--- a/src/mux_pt.c
+++ b/src/mux_pt.c
@@ -316,7 +316,7 @@
TRACE_POINT(PT_EV_STRM_NEW, conn, cs);
}
else {
- if (cs_attach_mux(cs, ctx, conn) < 0)
+ if (sc_attach_mux(cs, ctx, conn) < 0)
goto fail_free_ctx;
ctx->endp = cs->sedesc;
}
@@ -386,7 +386,7 @@
TRACE_ENTER(PT_EV_STRM_NEW, conn);
if (ctx->wait_event.events)
conn->xprt->unsubscribe(ctx->conn, conn->xprt_ctx, SUB_RETRY_RECV, &ctx->wait_event);
- if (cs_attach_mux(endp->sc, ctx, conn) < 0)
+ if (sc_attach_mux(endp->sc, ctx, conn) < 0)
return -1;
ctx->endp = endp;
se_fl_set(ctx->endp, SE_FL_RCV_MORE);
diff --git a/src/payload.c b/src/payload.c
index 7e66f04..08d5826 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -65,7 +65,7 @@
struct check *check = __objt_check(smp->sess->origin);
/* Not accurate but kept for backward compatibility purpose */
- smp->data.u.sint = ((check->cs && IS_HTX_CS(check->cs)) ? (htxbuf(&check->bi))->data: b_data(&check->bi));
+ smp->data.u.sint = ((check->cs && IS_HTX_SC(check->cs)) ? (htxbuf(&check->bi))->data: b_data(&check->bi));
}
else
return 0;
@@ -1020,7 +1020,7 @@
struct check *check = __objt_check(smp->sess->origin);
/* meaningless for HTX buffers */
- if (check->cs && IS_HTX_CS(check->cs))
+ if (check->cs && IS_HTX_SC(check->cs))
return 0;
head = b_head(&check->bi);
data = b_data(&check->bi);
@@ -1089,7 +1089,7 @@
struct check *check = __objt_check(smp->sess->origin);
/* meaningless for HTX buffers */
- if (check->cs && IS_HTX_CS(check->cs))
+ if (check->cs && IS_HTX_SC(check->cs))
return 0;
head = b_head(&check->bi);
data = b_data(&check->bi);
diff --git a/src/stream.c b/src/stream.c
index 3c9184c..b141f17 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -446,7 +446,7 @@
s->flags |= SF_HTX;
s->scf = cs;
- if (cs_attach_strm(s->scf, s) < 0)
+ if (sc_attach_strm(s->scf, s) < 0)
goto out_fail_attach_scf;
s->scb = sc_new_from_strm(s, SC_FL_ISBACK);
@@ -1534,10 +1534,10 @@
/* let's recompute both sides states */
if (cs_state_in(scf->state, SC_SB_RDY|SC_SB_EST))
- cs_update(scf);
+ sc_update(scf);
if (cs_state_in(scb->state, SC_SB_RDY|SC_SB_EST))
- cs_update(scb);
+ sc_update(scb);
/* stream connectors are processed outside of process_stream() and must be
* handled at the latest moment.
diff --git a/src/tcpcheck.c b/src/tcpcheck.c
index d0d0525..d0012a2 100644
--- a/src/tcpcheck.c
+++ b/src/tcpcheck.c
@@ -1100,7 +1100,7 @@
TRACE_ERROR("stconn allocation error", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check);
goto out;
}
- if (cs_attach_mux(check->cs, NULL, conn) < 0) {
+ if (sc_attach_mux(check->cs, NULL, conn) < 0) {
TRACE_ERROR("mux attach error", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check);
conn_free(conn);
conn = NULL;
@@ -1569,7 +1569,7 @@
while (sc_ep_test(cs, SE_FL_RCV_MORE) ||
(!(conn->flags & CO_FL_ERROR) && !sc_ep_test(cs, SE_FL_ERROR | SE_FL_EOS))) {
- max = (IS_HTX_CS(cs) ? htx_free_space(htxbuf(&check->bi)) : b_room(&check->bi));
+ max = (IS_HTX_SC(cs) ? htx_free_space(htxbuf(&check->bi)) : b_room(&check->bi));
read = conn->mux->rcv_buf(cs, &check->bi, max, 0);
cur_read += read;
if (!read ||
@@ -1580,7 +1580,7 @@
}
end_recv:
- is_empty = (IS_HTX_CS(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi));
+ is_empty = (IS_HTX_SC(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi));
if (is_empty && ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR))) {
/* Report network errors only if we got no other data. Otherwise
* we'll let the upper layers decide whether the response is OK
@@ -2208,7 +2208,7 @@
/* Refresh connection */
conn = sc_conn(cs);
last_read = 0;
- must_read = (IS_HTX_CS(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi));
+ must_read = (IS_HTX_SC(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi));
break;
case TCPCHK_ACT_SEND:
check->current_step = rule;