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.
This commit is contained in:
Willy Tarreau 2022-05-16 17:29:42 +02:00
parent b605c4213f
commit 65d0597b2b
11 changed files with 21 additions and 21 deletions

View File

@ -157,13 +157,13 @@ struct data_cb {
* transfers the whole responsibility to the mux/applet and eventually create a * transfers the whole responsibility to the mux/applet and eventually create a
* new cs-endpoint (for instance on connection retries). * new cs-endpoint (for instance on connection retries).
* *
* <target> is the mux or the appctx * <se> is the stream endpoint, i.e. the mux stream or the appctx
* <conn> is the connection for connection-based streams * <conn> is the connection for connection-based streams
* <cs> is the conn_stream we're attached to, or NULL * <cs> is the conn_stream we're attached to, or NULL
* <flags> SE_FL_* * <flags> SE_FL_*
*/ */
struct cs_endpoint { struct cs_endpoint {
void *target; void *se;
struct connection *conn; struct connection *conn;
struct conn_stream *cs; struct conn_stream *cs;
unsigned int flags; unsigned int flags;

View File

@ -127,7 +127,7 @@ static forceinline uint sc_ep_get(const struct conn_stream *sc)
/* Returns the endpoint target without any control */ /* Returns the endpoint target without any control */
static inline void *__cs_endp_target(const struct conn_stream *cs) 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 /* Returns the connection from a cs if the endpoint is a mux stream. Otherwise

View File

@ -100,8 +100,8 @@ static inline struct conn_stream *qc_attach_cs(struct qcs *qcs, struct buffer *b
if (!qcs->endp) if (!qcs->endp)
return NULL; return NULL;
qcs->endp->target = qcs; qcs->endp->se = qcs;
qcs->endp->conn = qcc->conn; qcs->endp->conn = qcc->conn;
se_fl_set(qcs->endp, SE_FL_T_MUX | SE_FL_ORPHAN | SE_FL_NOT_FIRST); se_fl_set(qcs->endp, SE_FL_T_MUX | SE_FL_ORPHAN | SE_FL_NOT_FIRST);
/* TODO duplicated from mux_h2 */ /* TODO duplicated from mux_h2 */

View File

@ -50,7 +50,7 @@ struct appctx *appctx_new(struct applet *applet, struct cs_endpoint *endp, unsig
endp = cs_endpoint_new(); endp = cs_endpoint_new();
if (!endp) if (!endp)
goto fail_endp; goto fail_endp;
endp->target = appctx; endp->se = appctx;
se_fl_set(endp, SE_FL_T_APPLET | SE_FL_ORPHAN); se_fl_set(endp, SE_FL_T_APPLET | SE_FL_ORPHAN);
} }
appctx->endp = endp; appctx->endp = endp;

View File

@ -84,7 +84,7 @@ struct data_cb cs_data_applet_cb = {
/* Initializes an endpoint */ /* Initializes an endpoint */
void cs_endpoint_init(struct cs_endpoint *endp) void cs_endpoint_init(struct cs_endpoint *endp)
{ {
endp->target = NULL; endp->se = NULL;
endp->conn = NULL; endp->conn = NULL;
endp->cs = NULL; endp->cs = NULL;
se_fl_setall(endp, SE_FL_NONE); 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 * -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. * 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; struct connection *conn = ctx;
cs->endp->target = target; cs->endp->se = endp;
cs->endp->conn = ctx; cs->endp->conn = ctx;
sc_ep_set(cs, SE_FL_T_MUX); sc_ep_set(cs, SE_FL_T_MUX);
sc_ep_clr(cs, SE_FL_DETACHED); 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 * removed. This function is called by a stream when a backend applet is
* registered. * 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_set(cs, SE_FL_T_APPLET);
sc_ep_clr(cs, SE_FL_DETACHED); sc_ep_clr(cs, SE_FL_DETACHED);
if (cs_strm(cs)) { if (cs_strm(cs)) {
@ -380,7 +380,7 @@ static void cs_detach_endp(struct conn_stream **csp)
if (cs->endp) { if (cs->endp) {
/* the cs is the only one one the endpoint */ /* the cs is the only one one the endpoint */
cs->endp->target = NULL; cs->endp->se = NULL;
cs->endp->conn = NULL; cs->endp->conn = NULL;
sc_ep_clr(cs, ~SE_FL_APP_MASK); sc_ep_clr(cs, ~SE_FL_APP_MASK);
sc_ep_set(cs, SE_FL_DETACHED); sc_ep_set(cs, SE_FL_DETACHED);

View File

@ -3583,7 +3583,7 @@ static void fcgi_destroy(void *ctx)
*/ */
static void fcgi_detach(struct cs_endpoint *endp) 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 fcgi_conn *fconn;
struct session *sess; struct session *sess;

View File

@ -821,7 +821,7 @@ static struct h1s *h1c_frt_stream_new(struct h1c *h1c, struct conn_stream *cs, s
h1s->endp = cs_endpoint_new(); h1s->endp = cs_endpoint_new();
if (!h1s->endp) if (!h1s->endp)
goto fail; goto fail;
h1s->endp->target = h1s; h1s->endp->se = h1s;
h1s->endp->conn = h1c->conn; h1s->endp->conn = h1c->conn;
se_fl_set(h1s->endp, SE_FL_T_MUX | SE_FL_ORPHAN); 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) static void h1_detach(struct cs_endpoint *endp)
{ {
struct h1s *h1s = endp->target; struct h1s *h1s = endp->se;
struct h1c *h1c; struct h1c *h1c;
struct session *sess; struct session *sess;
int is_not_first; int is_not_first;

View File

@ -1612,7 +1612,7 @@ static struct h2s *h2c_frt_stream_new(struct h2c *h2c, int id, struct buffer *in
h2s->endp = cs_endpoint_new(); h2s->endp = cs_endpoint_new();
if (!h2s->endp) if (!h2s->endp)
goto out_close; goto out_close;
h2s->endp->target = h2s; h2s->endp->se = h2s;
h2s->endp->conn = h2c->conn; h2s->endp->conn = h2c->conn;
se_fl_set(h2s->endp, SE_FL_T_MUX | SE_FL_ORPHAN | SE_FL_NOT_FIRST); 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) static void h2_detach(struct cs_endpoint *endp)
{ {
struct h2s *h2s = endp->target; struct h2s *h2s = endp->se;
struct h2c *h2c; struct h2c *h2c;
struct session *sess; struct session *sess;

View File

@ -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); TRACE_ERROR("CS allocation failure", PT_EV_STRM_NEW|PT_EV_STRM_END|PT_EV_STRM_ERR, conn);
goto fail_free_ctx; goto fail_free_ctx;
} }
ctx->endp->target = ctx; ctx->endp->se = ctx;
ctx->endp->conn = conn; ctx->endp->conn = conn;
se_fl_set(ctx->endp, SE_FL_T_MUX | SE_FL_ORPHAN); se_fl_set(ctx->endp, SE_FL_T_MUX | SE_FL_ORPHAN);

View File

@ -1424,7 +1424,7 @@ static void qc_destroy(void *ctx)
static void qc_detach(struct cs_endpoint *endp) static void qc_detach(struct cs_endpoint *endp)
{ {
struct qcs *qcs = endp->target; struct qcs *qcs = endp->se;
struct qcc *qcc = qcs->qcc; struct qcc *qcc = qcs->qcc;
TRACE_ENTER(QMUX_EV_STRM_END, qcc->conn, qcs); TRACE_ENTER(QMUX_EV_STRM_END, qcc->conn, qcs);

View File

@ -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", 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), 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")), (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) { if ((conn = cs_conn(csf)) != NULL) {
chunk_appendf(&trash, 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", 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), 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")), (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) { if ((conn = cs_conn(csb)) != NULL) {
chunk_appendf(&trash, chunk_appendf(&trash,