From: Willy Tarreau Date: Wed, 18 May 2022 14:28:02 +0000 (+0200) Subject: CLEANUP: stconn: rename cs_mux() to sc_mux_strm() X-Git-Tag: v2.6-dev12~77 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6fe2b42e45b28ccf13759596727c761183395b0a;p=thirdparty%2Fhaproxy.git CLEANUP: stconn: rename cs_mux() to sc_mux_strm() The function doesn't return a pointer to the mux but to the mux stream (h1s, h2s etc). Let's adjust its name to reflect this. It's rarely used, the name can be enlarged a bit. And of course s/cs/sc to accommodate for the updated name. --- diff --git a/include/haproxy/conn_stream.h b/include/haproxy/conn_stream.h index 30ef61b36e..3d12b58c82 100644 --- a/include/haproxy/conn_stream.h +++ b/include/haproxy/conn_stream.h @@ -155,18 +155,18 @@ static inline const struct mux_ops *cs_conn_mux(const struct stconn *cs) return (conn ? conn->mux : NULL); } -/* Returns the mux from a cs if the endpoint is a mux. Otherwise - * NULL is returned. __cs_mux() returns the mux without any control - * while cs_mux() check the endpoint type. +/* Returns a pointer to the mux stream from a connector if the endpoint is + * a mux. Otherwise NULL is returned. __sc_mux_strm() returns the mux without + * any control while sc_mux_strm() checks the endpoint type. */ -static inline void *__cs_mux(const struct stconn *cs) +static inline void *__sc_mux_strm(const struct stconn *cs) { return __cs_endp_target(cs); } -static inline struct appctx *cs_mux(const struct stconn *cs) +static inline struct appctx *sc_mux_strm(const struct stconn *cs) { if (sc_ep_test(cs, SE_FL_T_MUX)) - return __cs_mux(cs); + return __sc_mux_strm(cs); return NULL; } diff --git a/src/h3.c b/src/h3.c index 0055eade3b..35c3784a6d 100644 --- a/src/h3.c +++ b/src/h3.c @@ -863,7 +863,7 @@ static int h3_resp_data_send(struct qcs *qcs, struct buffer *buf, size_t count) size_t h3_snd_buf(struct stconn *cs, struct buffer *buf, size_t count, int flags) { size_t total = 0; - struct qcs *qcs = __cs_mux(cs); + struct qcs *qcs = __sc_mux_strm(cs); struct htx *htx; enum htx_blk_type btype; struct htx_blk *blk; diff --git a/src/hq_interop.c b/src/hq_interop.c index ae5297082e..972ddaf089 100644 --- a/src/hq_interop.c +++ b/src/hq_interop.c @@ -96,7 +96,7 @@ static struct buffer *mux_get_buf(struct qcs *qcs) static size_t hq_interop_snd_buf(struct stconn *cs, struct buffer *buf, size_t count, int flags) { - struct qcs *qcs = __cs_mux(cs); + struct qcs *qcs = __sc_mux_strm(cs); struct htx *htx; enum htx_blk_type btype; struct htx_blk *blk; diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index 311a603c80..5bde48be27 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -3861,7 +3861,7 @@ struct task *fcgi_deferred_shut(struct task *t, void *ctx, unsigned int state) /* shutr() called by the stream conector (mux_ops.shutr) */ static void fcgi_shutr(struct stconn *cs, enum co_shr_mode mode) { - struct fcgi_strm *fstrm = __cs_mux(cs); + struct fcgi_strm *fstrm = __sc_mux_strm(cs); TRACE_POINT(FCGI_EV_STRM_SHUT, fstrm->fconn->conn, fstrm); if (!mode) @@ -3872,7 +3872,7 @@ static void fcgi_shutr(struct stconn *cs, enum co_shr_mode mode) /* shutw() called by the stream connector (mux_ops.shutw) */ static void fcgi_shutw(struct stconn *cs, enum co_shw_mode mode) { - struct fcgi_strm *fstrm = __cs_mux(cs); + struct fcgi_strm *fstrm = __sc_mux_strm(cs); TRACE_POINT(FCGI_EV_STRM_SHUT, fstrm->fconn->conn, fstrm); fcgi_do_shutw(fstrm); @@ -3885,7 +3885,7 @@ static void fcgi_shutw(struct stconn *cs, enum co_shw_mode mode) */ static int fcgi_subscribe(struct stconn *cs, int event_type, struct wait_event *es) { - struct fcgi_strm *fstrm = __cs_mux(cs); + struct fcgi_strm *fstrm = __sc_mux_strm(cs); struct fcgi_conn *fconn = fstrm->fconn; BUG_ON(event_type & ~(SUB_RETRY_SEND|SUB_RETRY_RECV)); @@ -3911,7 +3911,7 @@ static int fcgi_subscribe(struct stconn *cs, int event_type, struct wait_event * */ static int fcgi_unsubscribe(struct stconn *cs, int event_type, struct wait_event *es) { - struct fcgi_strm *fstrm = __cs_mux(cs); + struct fcgi_strm *fstrm = __sc_mux_strm(cs); struct fcgi_conn *fconn = fstrm->fconn; BUG_ON(event_type & ~(SUB_RETRY_SEND|SUB_RETRY_RECV)); @@ -3947,7 +3947,7 @@ static int fcgi_unsubscribe(struct stconn *cs, int event_type, struct wait_event */ static size_t fcgi_rcv_buf(struct stconn *cs, struct buffer *buf, size_t count, int flags) { - struct fcgi_strm *fstrm = __cs_mux(cs); + struct fcgi_strm *fstrm = __sc_mux_strm(cs); struct fcgi_conn *fconn = fstrm->fconn; size_t ret = 0; @@ -3991,7 +3991,7 @@ static size_t fcgi_rcv_buf(struct stconn *cs, struct buffer *buf, size_t count, */ static size_t fcgi_snd_buf(struct stconn *cs, struct buffer *buf, size_t count, int flags) { - struct fcgi_strm *fstrm = __cs_mux(cs); + struct fcgi_strm *fstrm = __sc_mux_strm(cs); struct fcgi_conn *fconn = fstrm->fconn; size_t total = 0; size_t ret; diff --git a/src/mux_h1.c b/src/mux_h1.c index 0c107fa425..2c3f118dcb 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -3472,7 +3472,7 @@ static void h1_detach(struct sedesc *endp) static void h1_shutr(struct stconn *cs, enum co_shr_mode mode) { - struct h1s *h1s = __cs_mux(cs); + struct h1s *h1s = __sc_mux_strm(cs); struct h1c *h1c; if (!h1s) @@ -3515,7 +3515,7 @@ static void h1_shutr(struct stconn *cs, enum co_shr_mode mode) static void h1_shutw(struct stconn *cs, enum co_shw_mode mode) { - struct h1s *h1s = __cs_mux(cs); + struct h1s *h1s = __sc_mux_strm(cs); struct h1c *h1c; if (!h1s) @@ -3575,7 +3575,7 @@ static void h1_shutw_conn(struct connection *conn) */ static int h1_unsubscribe(struct stconn *cs, int event_type, struct wait_event *es) { - struct h1s *h1s = __cs_mux(cs); + struct h1s *h1s = __sc_mux_strm(cs); if (!h1s) return 0; @@ -3605,7 +3605,7 @@ static int h1_unsubscribe(struct stconn *cs, int event_type, struct wait_event * */ static int h1_subscribe(struct stconn *cs, int event_type, struct wait_event *es) { - struct h1s *h1s = __cs_mux(cs); + struct h1s *h1s = __sc_mux_strm(cs); struct h1c *h1c; if (!h1s) @@ -3653,7 +3653,7 @@ static int h1_subscribe(struct stconn *cs, int event_type, struct wait_event *es */ static size_t h1_rcv_buf(struct stconn *cs, struct buffer *buf, size_t count, int flags) { - struct h1s *h1s = __cs_mux(cs); + struct h1s *h1s = __sc_mux_strm(cs); struct h1c *h1c = h1s->h1c; struct h1m *h1m = (!(h1c->flags & H1C_F_IS_BACK) ? &h1s->req : &h1s->res); size_t ret = 0; @@ -3689,7 +3689,7 @@ static size_t h1_rcv_buf(struct stconn *cs, struct buffer *buf, size_t count, in /* Called from the upper layer, to send data */ static size_t h1_snd_buf(struct stconn *cs, struct buffer *buf, size_t count, int flags) { - struct h1s *h1s = __cs_mux(cs); + struct h1s *h1s = __sc_mux_strm(cs); struct h1c *h1c; size_t total = 0; @@ -3754,7 +3754,7 @@ static size_t h1_snd_buf(struct stconn *cs, struct buffer *buf, size_t count, in /* Send and get, using splicing */ static int h1_rcv_pipe(struct stconn *cs, struct pipe *pipe, unsigned int count) { - struct h1s *h1s = __cs_mux(cs); + struct h1s *h1s = __sc_mux_strm(cs); struct h1c *h1c = h1s->h1c; struct h1m *h1m = (!(h1c->flags & H1C_F_IS_BACK) ? &h1s->req : &h1s->res); int ret = 0; @@ -3824,7 +3824,7 @@ static int h1_rcv_pipe(struct stconn *cs, struct pipe *pipe, unsigned int count) static int h1_snd_pipe(struct stconn *cs, struct pipe *pipe) { - struct h1s *h1s = __cs_mux(cs); + struct h1s *h1s = __sc_mux_strm(cs); struct h1c *h1c = h1s->h1c; struct h1m *h1m = (!(h1c->flags & H1C_F_IS_BACK) ? &h1s->res : &h1s->req); int ret = 0; diff --git a/src/mux_h2.c b/src/mux_h2.c index dde18dc25e..4a3a701655 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -4694,7 +4694,7 @@ struct task *h2_deferred_shut(struct task *t, void *ctx, unsigned int state) /* shutr() called by the stream connector (mux_ops.shutr) */ static void h2_shutr(struct stconn *cs, enum co_shr_mode mode) { - struct h2s *h2s = __cs_mux(cs); + struct h2s *h2s = __sc_mux_strm(cs); TRACE_ENTER(H2_EV_STRM_SHUT, h2s->h2c->conn, h2s); if (mode) @@ -4705,7 +4705,7 @@ static void h2_shutr(struct stconn *cs, enum co_shr_mode mode) /* shutw() called by the stream connector (mux_ops.shutw) */ static void h2_shutw(struct stconn *cs, enum co_shw_mode mode) { - struct h2s *h2s = __cs_mux(cs); + struct h2s *h2s = __sc_mux_strm(cs); TRACE_ENTER(H2_EV_STRM_SHUT, h2s->h2c->conn, h2s); h2_do_shutw(h2s); @@ -6379,7 +6379,7 @@ static size_t h2s_make_trailers(struct h2s *h2s, struct htx *htx) */ static int h2_subscribe(struct stconn *cs, int event_type, struct wait_event *es) { - struct h2s *h2s = __cs_mux(cs); + struct h2s *h2s = __sc_mux_strm(cs); struct h2c *h2c = h2s->h2c; TRACE_ENTER(H2_EV_STRM_SEND|H2_EV_STRM_RECV, h2c->conn, h2s); @@ -6413,7 +6413,7 @@ static int h2_subscribe(struct stconn *cs, int event_type, struct wait_event *es */ static int h2_unsubscribe(struct stconn *cs, int event_type, struct wait_event *es) { - struct h2s *h2s = __cs_mux(cs); + struct h2s *h2s = __sc_mux_strm(cs); TRACE_ENTER(H2_EV_STRM_SEND|H2_EV_STRM_RECV, h2s->h2c->conn, h2s); @@ -6453,7 +6453,7 @@ static int h2_unsubscribe(struct stconn *cs, int event_type, struct wait_event * */ static size_t h2_rcv_buf(struct stconn *cs, struct buffer *buf, size_t count, int flags) { - struct h2s *h2s = __cs_mux(cs); + struct h2s *h2s = __sc_mux_strm(cs); struct h2c *h2c = h2s->h2c; struct htx *h2s_htx = NULL; struct htx *buf_htx = NULL; @@ -6536,7 +6536,7 @@ static size_t h2_rcv_buf(struct stconn *cs, struct buffer *buf, size_t count, in */ static size_t h2_snd_buf(struct stconn *cs, struct buffer *buf, size_t count, int flags) { - struct h2s *h2s = __cs_mux(cs); + struct h2s *h2s = __sc_mux_strm(cs); size_t total = 0; size_t ret; struct htx *htx; diff --git a/src/mux_quic.c b/src/mux_quic.c index 9b37d05f54..a993a5aa83 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -1458,7 +1458,7 @@ static void qc_detach(struct sedesc *endp) static size_t qc_rcv_buf(struct stconn *cs, struct buffer *buf, size_t count, int flags) { - struct qcs *qcs = __cs_mux(cs); + struct qcs *qcs = __sc_mux_strm(cs); struct htx *qcs_htx = NULL; struct htx *cs_htx = NULL; size_t ret = 0; @@ -1528,7 +1528,7 @@ static size_t qc_rcv_buf(struct stconn *cs, struct buffer *buf, static size_t qc_snd_buf(struct stconn *cs, struct buffer *buf, size_t count, int flags) { - struct qcs *qcs = __cs_mux(cs); + struct qcs *qcs = __sc_mux_strm(cs); size_t ret; TRACE_ENTER(QMUX_EV_STRM_SEND, qcs->qcc->conn, qcs); @@ -1548,7 +1548,7 @@ static size_t qc_snd_buf(struct stconn *cs, struct buffer *buf, static int qc_subscribe(struct stconn *cs, int event_type, struct wait_event *es) { - return qcs_subscribe(__cs_mux(cs), event_type, es); + return qcs_subscribe(__sc_mux_strm(cs), event_type, es); } /* Called from the upper layer, to unsubscribe from events . @@ -1557,7 +1557,7 @@ static int qc_subscribe(struct stconn *cs, int event_type, */ static int qc_unsubscribe(struct stconn *cs, int event_type, struct wait_event *es) { - struct qcs *qcs = __cs_mux(cs); + struct qcs *qcs = __sc_mux_strm(cs); BUG_ON(event_type & ~(SUB_RETRY_SEND|SUB_RETRY_RECV)); BUG_ON(qcs->subs && qcs->subs != es);