]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stconn: rename cs_mux() to sc_mux_strm()
authorWilly Tarreau <w@1wt.eu>
Wed, 18 May 2022 14:28:02 +0000 (16:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:34 +0000 (19:33 +0200)
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.

include/haproxy/conn_stream.h
src/h3.c
src/hq_interop.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/mux_quic.c

index 30ef61b36ef4110634db7160852940c4ccaeedca..3d12b58c82a9e2355570202ceb4f48263021494f 100644 (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;
 }
 
index 0055eade3b39ea0278f9222dc1f7854d781f9af5..35c3784a6d372ef8de96b054a3c6b16b30677350 100644 (file)
--- 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;
index ae5297082ed068b584b8486cce7408f2d5781caa..972ddaf089f567c2e1e81dcf4bf03f0e9e999668 100644 (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;
index 311a603c80769018bf545f8be823505ba3f29c98..5bde48be27a8414a58a26118c786410dc0af6ee2 100644 (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;
index 0c107fa4253dbe1dd8550c69e342365547d0ea6f..2c3f118dcbe7d790a3a5cd7032c98cff304478d8 100644 (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;
index dde18dc25e1c70c515ddadedc88bc799e2a549a9..4a3a701655a3ce5f801bb30150ef036a2e4c5881 100644 (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;
index 9b37d05f54fe36c2310de6e129a2a7f2f08b43ba..a993a5aa8367a723c8974034636a2f4963aa01ea 100644 (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);