From: Willy Tarreau Date: Mon, 16 May 2022 15:29:42 +0000 (+0200) Subject: CLEANUP: conn_stream: rename the cs_endpoint's target to "se" X-Git-Tag: v2.6-dev12~99 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65d0597b2ba2e96045d22b69aafce09f7bfea8c4;p=thirdparty%2Fhaproxy.git CLEANUP: conn_stream: rename the cs_endpoint's target to "se" That's the "stream endpoint" pointer. Let's change it now while it's not much spread. The function __cs_endp_target() wasn't yet renamed because that will change more globally soon. --- diff --git a/include/haproxy/conn_stream-t.h b/include/haproxy/conn_stream-t.h index a6d52ff176..88964f6923 100644 --- a/include/haproxy/conn_stream-t.h +++ b/include/haproxy/conn_stream-t.h @@ -157,13 +157,13 @@ struct data_cb { * transfers the whole responsibility to the mux/applet and eventually create a * new cs-endpoint (for instance on connection retries). * - * is the mux or the appctx + * is the stream endpoint, i.e. the mux stream or the appctx * is the connection for connection-based streams * is the conn_stream we're attached to, or NULL * SE_FL_* */ struct cs_endpoint { - void *target; + void *se; struct connection *conn; struct conn_stream *cs; unsigned int flags; diff --git a/include/haproxy/conn_stream.h b/include/haproxy/conn_stream.h index f79feea512..b27bb824c6 100644 --- a/include/haproxy/conn_stream.h +++ b/include/haproxy/conn_stream.h @@ -127,7 +127,7 @@ static forceinline uint sc_ep_get(const struct conn_stream *sc) /* Returns the endpoint target without any control */ static inline void *__cs_endp_target(const struct conn_stream *cs) { - return cs->endp->target; + return cs->endp->se; } /* Returns the connection from a cs if the endpoint is a mux stream. Otherwise diff --git a/include/haproxy/mux_quic.h b/include/haproxy/mux_quic.h index fc7f98611d..31055e10c5 100644 --- a/include/haproxy/mux_quic.h +++ b/include/haproxy/mux_quic.h @@ -100,8 +100,8 @@ static inline struct conn_stream *qc_attach_cs(struct qcs *qcs, struct buffer *b if (!qcs->endp) return NULL; - qcs->endp->target = qcs; - qcs->endp->conn = qcc->conn; + qcs->endp->se = qcs; + qcs->endp->conn = qcc->conn; se_fl_set(qcs->endp, SE_FL_T_MUX | SE_FL_ORPHAN | SE_FL_NOT_FIRST); /* TODO duplicated from mux_h2 */ diff --git a/src/applet.c b/src/applet.c index c19749e0b2..db493f3c38 100644 --- a/src/applet.c +++ b/src/applet.c @@ -50,7 +50,7 @@ struct appctx *appctx_new(struct applet *applet, struct cs_endpoint *endp, unsig endp = cs_endpoint_new(); if (!endp) goto fail_endp; - endp->target = appctx; + endp->se = appctx; se_fl_set(endp, SE_FL_T_APPLET | SE_FL_ORPHAN); } appctx->endp = endp; diff --git a/src/conn_stream.c b/src/conn_stream.c index 5fe04c48f0..a99841a10f 100644 --- a/src/conn_stream.c +++ b/src/conn_stream.c @@ -84,7 +84,7 @@ struct data_cb cs_data_applet_cb = { /* Initializes an endpoint */ void cs_endpoint_init(struct cs_endpoint *endp) { - endp->target = NULL; + endp->se = NULL; endp->conn = NULL; endp->cs = NULL; se_fl_setall(endp, SE_FL_NONE); @@ -243,11 +243,11 @@ static void cs_free_cond(struct conn_stream **csp) * -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 conn_stream *cs, void *target, void *ctx) +int cs_attach_mux(struct conn_stream *cs, void *endp, void *ctx) { struct connection *conn = ctx; - cs->endp->target = target; + cs->endp->se = endp; cs->endp->conn = ctx; sc_ep_set(cs, SE_FL_T_MUX); sc_ep_clr(cs, SE_FL_DETACHED); @@ -286,9 +286,9 @@ int cs_attach_mux(struct conn_stream *cs, void *target, void *ctx) * removed. This function is called by a stream when a backend applet is * registered. */ -static void cs_attach_applet(struct conn_stream *cs, void *target) +static void cs_attach_applet(struct conn_stream *cs, void *endp) { - cs->endp->target = target; + cs->endp->se = endp; sc_ep_set(cs, SE_FL_T_APPLET); sc_ep_clr(cs, SE_FL_DETACHED); if (cs_strm(cs)) { @@ -380,7 +380,7 @@ static void cs_detach_endp(struct conn_stream **csp) if (cs->endp) { /* the cs is the only one one the endpoint */ - cs->endp->target = NULL; + cs->endp->se = NULL; cs->endp->conn = NULL; sc_ep_clr(cs, ~SE_FL_APP_MASK); sc_ep_set(cs, SE_FL_DETACHED); diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index 8a75169570..2c4e4aa995 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -3583,7 +3583,7 @@ static void fcgi_destroy(void *ctx) */ static void fcgi_detach(struct cs_endpoint *endp) { - struct fcgi_strm *fstrm = endp->target; + struct fcgi_strm *fstrm = endp->se; struct fcgi_conn *fconn; struct session *sess; diff --git a/src/mux_h1.c b/src/mux_h1.c index 3caee7c82a..e6ef886249 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -821,7 +821,7 @@ static struct h1s *h1c_frt_stream_new(struct h1c *h1c, struct conn_stream *cs, s h1s->endp = cs_endpoint_new(); if (!h1s->endp) goto fail; - h1s->endp->target = h1s; + h1s->endp->se = h1s; h1s->endp->conn = h1c->conn; se_fl_set(h1s->endp, SE_FL_T_MUX | SE_FL_ORPHAN); } @@ -3359,7 +3359,7 @@ static void h1_destroy(void *ctx) */ static void h1_detach(struct cs_endpoint *endp) { - struct h1s *h1s = endp->target; + struct h1s *h1s = endp->se; struct h1c *h1c; struct session *sess; int is_not_first; diff --git a/src/mux_h2.c b/src/mux_h2.c index 935d611250..ffa54d284f 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -1612,7 +1612,7 @@ static struct h2s *h2c_frt_stream_new(struct h2c *h2c, int id, struct buffer *in h2s->endp = cs_endpoint_new(); if (!h2s->endp) goto out_close; - h2s->endp->target = h2s; + h2s->endp->se = h2s; h2s->endp->conn = h2c->conn; se_fl_set(h2s->endp, SE_FL_T_MUX | SE_FL_ORPHAN | SE_FL_NOT_FIRST); @@ -4370,7 +4370,7 @@ static void h2_destroy(void *ctx) */ static void h2_detach(struct cs_endpoint *endp) { - struct h2s *h2s = endp->target; + struct h2s *h2s = endp->se; struct h2c *h2c; struct session *sess; diff --git a/src/mux_pt.c b/src/mux_pt.c index e93c2d65e7..8750facae9 100644 --- a/src/mux_pt.c +++ b/src/mux_pt.c @@ -298,7 +298,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio TRACE_ERROR("CS allocation failure", PT_EV_STRM_NEW|PT_EV_STRM_END|PT_EV_STRM_ERR, conn); goto fail_free_ctx; } - ctx->endp->target = ctx; + ctx->endp->se = ctx; ctx->endp->conn = conn; se_fl_set(ctx->endp, SE_FL_T_MUX | SE_FL_ORPHAN); diff --git a/src/mux_quic.c b/src/mux_quic.c index 878b44cc8a..8e9bda99b1 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -1424,7 +1424,7 @@ static void qc_destroy(void *ctx) static void qc_detach(struct cs_endpoint *endp) { - struct qcs *qcs = endp->target; + struct qcs *qcs = endp->se; struct qcc *qcc = qcs->qcc; TRACE_ENTER(QMUX_EV_STRM_END, qcc->conn, qcs); diff --git a/src/stream.c b/src/stream.c index d5e2d8ad29..91ceeb4e4a 100644 --- a/src/stream.c +++ b/src/stream.c @@ -3308,7 +3308,7 @@ static int stats_dump_full_strm_to_buffer(struct conn_stream *cs, struct stream chunk_appendf(&trash, " csf=%p flags=0x%08x state=%s endp=%s,%p,0x%08x sub=%d\n", csf, csf->flags, cs_state_str(csf->state), (sc_ep_test(csf, SE_FL_T_MUX) ? "CONN" : (sc_ep_test(csf, SE_FL_T_APPLET) ? "APPCTX" : "NONE")), - csf->endp->target, sc_ep_get(csf), csf->wait_event.events); + csf->endp->se, sc_ep_get(csf), csf->wait_event.events); if ((conn = cs_conn(csf)) != NULL) { chunk_appendf(&trash, @@ -3347,7 +3347,7 @@ static int stats_dump_full_strm_to_buffer(struct conn_stream *cs, struct stream chunk_appendf(&trash, " csb=%p flags=0x%08x state=%s endp=%s,%p,0x%08x sub=%d\n", csb, csb->flags, cs_state_str(csb->state), (sc_ep_test(csb, SE_FL_T_MUX) ? "CONN" : (sc_ep_test(csb, SE_FL_T_APPLET) ? "APPCTX" : "NONE")), - csb->endp->target, sc_ep_get(csb), csb->wait_event.events); + csb->endp->se, sc_ep_get(csb), csb->wait_event.events); if ((conn = cs_conn(csb)) != NULL) { chunk_appendf(&trash,