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.
This commit is contained in:
Willy Tarreau 2022-05-18 16:28:02 +02:00
parent fd9417ba3f
commit 6fe2b42e45
7 changed files with 32 additions and 32 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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 <es> from events <event_type>.
@ -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);