diff --git a/include/haproxy/conn_stream.h b/include/haproxy/conn_stream.h index d5c8b192d..0e4728566 100644 --- a/include/haproxy/conn_stream.h +++ b/include/haproxy/conn_stream.h @@ -33,7 +33,7 @@ struct appctx; struct stream; struct check; -#define IS_HTX_CS(cs) (sc_conn(cs) && IS_HTX_CONN(__sc_conn(cs))) +#define IS_HTX_SC(cs) (sc_conn(cs) && IS_HTX_CONN(__sc_conn(cs))) struct sedesc *sedesc_new(); void sedesc_free(struct sedesc *sedesc); @@ -43,11 +43,11 @@ struct stconn *sc_new_from_strm(struct stream *strm, unsigned int flags); struct stconn *sc_new_from_check(struct check *check, unsigned int flags); void sc_free(struct stconn *cs); -int cs_attach_mux(struct stconn *cs, void *target, void *ctx); -int cs_attach_strm(struct stconn *cs, struct stream *strm); +int sc_attach_mux(struct stconn *cs, void *target, void *ctx); +int sc_attach_strm(struct stconn *cs, struct stream *strm); void sc_destroy(struct stconn *cs); -int cs_reset_endp(struct stconn *cs); +int sc_reset_endp(struct stconn *cs); struct appctx *sc_applet_create(struct stconn *cs, struct applet *app); diff --git a/include/haproxy/cs_utils.h b/include/haproxy/cs_utils.h index 7efe60ed2..2ea67d9ef 100644 --- a/include/haproxy/cs_utils.h +++ b/include/haproxy/cs_utils.h @@ -33,8 +33,8 @@ #include #include -void cs_update_rx(struct stconn *cs); -void cs_update_tx(struct stconn *cs); +void sc_update_rx(struct stconn *cs); +void sc_update_tx(struct stconn *cs); struct task *sc_conn_io_cb(struct task *t, void *ctx, unsigned int state); int sc_conn_sync_recv(struct stconn *cs); @@ -340,11 +340,11 @@ static inline void cs_chk_snd(struct stconn *cs) cs->app_ops->chk_snd(cs); } -/* Combines both cs_update_rx() and cs_update_tx() at once */ -static inline void cs_update(struct stconn *cs) +/* Combines both sc_update_rx() and sc_update_tx() at once */ +static inline void sc_update(struct stconn *cs) { - cs_update_rx(cs); - cs_update_tx(cs); + sc_update_rx(cs); + sc_update_tx(cs); } /* for debugging, reports the stream connector state name */ diff --git a/src/backend.c b/src/backend.c index 2447813e8..8b12afb3b 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1576,7 +1576,7 @@ static int connect_server(struct stream *s) if (avail >= 1) { if (srv_conn->mux->attach(srv_conn, s->scb->sedesc, s->sess) == -1) { srv_conn = NULL; - if (cs_reset_endp(s->scb) < 0) + if (sc_reset_endp(s->scb) < 0) return SF_ERR_INTERNAL; sc_ep_clr(s->scb, ~SE_FL_DETACHED); } @@ -1651,7 +1651,7 @@ skip_reuse: return SF_ERR_INTERNAL; /* how did we get there ? */ } - if (cs_attach_mux(s->scb, NULL, srv_conn) < 0) { + if (sc_attach_mux(s->scb, NULL, srv_conn) < 0) { conn_free(srv_conn); return SF_ERR_INTERNAL; /* how did we get there ? */ } @@ -2369,7 +2369,7 @@ void back_handle_st_cer(struct stream *s) * Note: the stream connector will be switched to ST_REQ, ST_ASS or * ST_TAR and SE_FL_ERROR and SF_CONN_EXP flags will be unset. */ - if (cs_reset_endp(cs) < 0) { + if (sc_reset_endp(cs) < 0) { if (!s->conn_err_type) s->conn_err_type = STRM_ET_CONN_OTHER; diff --git a/src/check.c b/src/check.c index 95203cb40..a7a7c517d 100644 --- a/src/check.c +++ b/src/check.c @@ -1148,7 +1148,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state) TRACE_DEVEL("closing current connection", CHK_EV_TASK_WAKE|CHK_EV_HCHK_RUN, check); check->state &= ~CHK_ST_CLOSE_CONN; conn = NULL; - if (!cs_reset_endp(check->cs)) { + if (!sc_reset_endp(check->cs)) { /* error will be handled by tcpcheck_main(). * On success, remove all flags except SE_FL_DETACHED */ diff --git a/src/cli.c b/src/cli.c index 1a1b41850..685168b63 100644 --- a/src/cli.c +++ b/src/cli.c @@ -2768,7 +2768,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit) */ if (!sc_conn_ready(s->scb)) { s->srv_conn = NULL; - if (cs_reset_endp(s->scb) < 0) { + if (sc_reset_endp(s->scb) < 0) { if (!s->conn_err_type) s->conn_err_type = STRM_ET_CONN_OTHER; if (s->srv_error) diff --git a/src/conn_stream.c b/src/conn_stream.c index a788b78bf..4aabf1f5a 100644 --- a/src/conn_stream.c +++ b/src/conn_stream.c @@ -44,7 +44,7 @@ static void sc_app_chk_snd_applet(struct stconn *cs); static int sc_conn_process(struct stconn *cs); static int sc_conn_recv(struct stconn *cs); static int sc_conn_send(struct stconn *cs); -static int cs_applet_process(struct stconn *cs); +static int sc_applet_process(struct stconn *cs); /* stream connector operations for connections */ struct sc_app_ops sc_app_conn_ops = { @@ -72,7 +72,7 @@ struct sc_app_ops sc_app_applet_ops = { .chk_snd = sc_app_chk_snd_applet, .shutr = sc_app_shutr_applet, .shutw = sc_app_shutw_applet, - .wake = cs_applet_process, + .wake = sc_applet_process, .name = "STRM", }; @@ -247,7 +247,7 @@ static void sc_free_cond(struct stconn **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 stconn *cs, void *endp, void *ctx) +int sc_attach_mux(struct stconn *cs, void *endp, void *ctx) { struct connection *conn = ctx; struct sedesc *sedesc = cs->sedesc; @@ -290,7 +290,7 @@ int cs_attach_mux(struct stconn *cs, void *endp, void *ctx) * removed. This function is called by a stream when a backend applet is * registered. */ -static void cs_attach_applet(struct stconn *cs, void *endp) +static void sc_attach_applet(struct stconn *cs, void *endp) { cs->sedesc->se = endp; sc_ep_set(cs, SE_FL_T_APPLET); @@ -304,7 +304,7 @@ static void cs_attach_applet(struct stconn *cs, void *endp) * removed. This function is called by a stream when it is created to attach it * on the stream connector on the client side. */ -int cs_attach_strm(struct stconn *cs, struct stream *strm) +int sc_attach_strm(struct stconn *cs, struct stream *strm) { cs->app = &strm->obj_type; sc_ep_clr(cs, SE_FL_ORPHAN); @@ -334,7 +334,7 @@ int cs_attach_strm(struct stconn *cs, struct stream *strm) * endpoint is reset and flag as detached. If the app layer is also detached, * the stream connector is released. */ -static void cs_detach_endp(struct stconn **csp) +static void sc_detach_endp(struct stconn **csp) { struct stconn *cs = *csp; @@ -400,7 +400,7 @@ static void cs_detach_endp(struct stconn **csp) /* Detaches the stconn from the app layer. If there is no endpoint attached * to the stconn */ -static void cs_detach_app(struct stconn **csp) +static void sc_detach_app(struct stconn **csp) { struct stconn *cs = *csp; @@ -424,8 +424,8 @@ static void cs_detach_app(struct stconn **csp) */ void sc_destroy(struct stconn *cs) { - cs_detach_endp(&cs); - cs_detach_app(&cs); + sc_detach_endp(&cs); + sc_detach_app(&cs); BUG_ON_HOT(cs); } @@ -436,7 +436,7 @@ void sc_destroy(struct stconn *cs) * Only SE_FL_ERROR flag is removed on the endpoint. Orther flags are preserved. * It is the caller responsibility to remove other flags if needed. */ -int cs_reset_endp(struct stconn *cs) +int sc_reset_endp(struct stconn *cs) { struct sedesc *new_endp; @@ -449,7 +449,7 @@ int cs_reset_endp(struct stconn *cs) * reset. The app is still attached, the cs will not be * released. */ - cs_detach_endp(&cs); + sc_detach_endp(&cs); return 0; } @@ -463,7 +463,7 @@ int cs_reset_endp(struct stconn *cs) se_fl_setall(new_endp, sc_ep_get(cs) & SE_FL_APP_MASK); /* The app is still attached, the cs will not be released */ - cs_detach_endp(&cs); + sc_detach_endp(&cs); BUG_ON(cs->sedesc); cs->sedesc = new_endp; cs->sedesc->sc = cs; @@ -474,7 +474,7 @@ int cs_reset_endp(struct stconn *cs) /* Create an applet to handle a stream connector as a new appctx. The CS will * wake it up every time it is solicited. The appctx must be deleted by the task - * handler using cs_detach_endp(), possibly from within the function itself. + * handler using sc_detach_endp(), possibly from within the function itself. * It also pre-initializes the applet's context and returns it (or NULL in case * it could not be allocated). */ @@ -487,7 +487,7 @@ struct appctx *sc_applet_create(struct stconn *cs, struct applet *app) appctx = appctx_new_here(app, cs->sedesc); if (!appctx) return NULL; - cs_attach_applet(cs, appctx); + sc_attach_applet(cs, appctx); appctx->t->nice = __sc_strm(cs)->task->nice; applet_need_more_data(appctx); appctx_wakeup(appctx); @@ -1006,7 +1006,7 @@ static void sc_app_chk_snd_applet(struct stconn *cs) * handler, as what it does will be used to compute the stream task's * expiration. */ -void cs_update_rx(struct stconn *cs) +void sc_update_rx(struct stconn *cs) { struct channel *ic = sc_ic(cs); @@ -1048,7 +1048,7 @@ void cs_update_rx(struct stconn *cs) * handler, as what it does will be used to compute the stream task's * expiration. */ -void cs_update_tx(struct stconn *cs) +void sc_update_tx(struct stconn *cs) { struct channel *oc = sc_oc(cs); struct channel *ic = sc_ic(cs); @@ -1087,17 +1087,17 @@ void cs_update_tx(struct stconn *cs) } } -/* This function is the equivalent to cs_update() except that it's +/* This function is the equivalent to sc_update() except that it's * designed to be called from outside the stream handlers, typically the lower * layers (applets, connections) after I/O completion. After updating the stream * interface and timeouts, it will try to forward what can be forwarded, then to * wake the associated task up if an important event requires special handling. * It may update SE_FL_WAIT_DATA and/or SC_FL_NEED_ROOM, that the callers are * encouraged to watch to take appropriate action. - * It should not be called from within the stream itself, cs_update() + * It should not be called from within the stream itself, sc_update() * is designed for this. */ -static void cs_notify(struct stconn *cs) +static void sc_notify(struct stconn *cs) { struct channel *ic = sc_ic(cs); struct channel *oc = sc_oc(cs); @@ -1879,7 +1879,7 @@ static int sc_conn_process(struct stconn *cs) * pending data, then possibly wake the stream up based on the new * stream connector status. */ - cs_notify(cs); + sc_notify(cs); stream_release_buffers(__sc_strm(cs)); return 0; } @@ -1913,7 +1913,7 @@ struct task *sc_conn_io_cb(struct task *t, void *ctx, unsigned int state) * may re-enable the applet's based on the channels and stream connector's final * states. */ -static int cs_applet_process(struct stconn *cs) +static int sc_applet_process(struct stconn *cs) { struct channel *ic = sc_ic(cs); @@ -1933,10 +1933,10 @@ static int cs_applet_process(struct stconn *cs) applet_have_more_data(__sc_appctx(cs)); /* update the stream connector, channels, and possibly wake the stream up */ - cs_notify(cs); + sc_notify(cs); stream_release_buffers(__sc_strm(cs)); - /* cs_notify may have passed through chk_snd and released some blocking + /* sc_notify may have passed through chk_snd and released some blocking * flags. Process_stream will consider those flags to wake up the * appctx but in the case the task is not in runqueue we may have to * wakeup the appctx immediately. diff --git a/src/hlua.c b/src/hlua.c index 292d8f28a..ddc5ff243 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -1977,7 +1977,7 @@ static void hlua_socket_handler(struct appctx *appctx) * interface. */ if (!channel_is_empty(sc_ic(cs))) - cs_update(cs); + sc_update(cs); /* If write notifications are registered, we considers we want * to write, so we clear the blocking flag. diff --git a/src/http_ana.c b/src/http_ana.c index 8a58287ba..d0ab21570 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -1263,7 +1263,7 @@ static __inline int do_l7_retry(struct stream *s, struct stconn *cs) res->analyse_exp = TICK_ETERNITY; res->total = 0; - if (cs_reset_endp(s->scb) < 0) { + if (sc_reset_endp(s->scb) < 0) { if (!(s->flags & SF_ERR_MASK)) s->flags |= SF_ERR_INTERNAL; return -1; diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index 058ab3bc2..a78751b37 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -1135,7 +1135,7 @@ static struct fcgi_strm *fcgi_stconn_new(struct fcgi_conn *fconn, struct stconn TRACE_ERROR("fstream allocation failure", FCGI_EV_FSTRM_NEW|FCGI_EV_FSTRM_END|FCGI_EV_FSTRM_ERR, fconn->conn); goto out; } - if (cs_attach_mux(cs, fstrm, fconn->conn) < 0) + if (sc_attach_mux(cs, fstrm, fconn->conn) < 0) goto out; fstrm->endp = cs->sedesc; fstrm->sess = sess; diff --git a/src/mux_h1.c b/src/mux_h1.c index 07b40de76..a30500e0f 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -819,7 +819,7 @@ static struct h1s *h1c_frt_stream_new(struct h1c *h1c, struct stconn *cs, struct goto fail; if (cs) { - if (cs_attach_mux(cs, h1s, h1c->conn) < 0) + if (sc_attach_mux(cs, h1s, h1c->conn) < 0) goto fail; h1s->endp = cs->sedesc; } @@ -858,7 +858,7 @@ static struct h1s *h1c_bck_stream_new(struct h1c *h1c, struct stconn *cs, struct if (!h1s) goto fail; - if (cs_attach_mux(cs, h1s, h1c->conn) < 0) + if (sc_attach_mux(cs, h1s, h1c->conn) < 0) goto fail; h1s->flags |= H1S_F_RX_BLK; diff --git a/src/mux_h2.c b/src/mux_h2.c index dde2392d0..cfffd6978 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -1693,7 +1693,7 @@ static struct h2s *h2c_bck_stream_new(struct h2c *h2c, struct stconn *cs, struct goto out; } - if (cs_attach_mux(cs, h2s, h2c->conn) < 0) { + if (sc_attach_mux(cs, h2s, h2c->conn) < 0) { TRACE_ERROR("Failed to allocate a new stream", H2_EV_H2S_NEW, h2c->conn); h2s_destroy(h2s); h2s = NULL; diff --git a/src/mux_pt.c b/src/mux_pt.c index 5f4c041ea..acebdee52 100644 --- a/src/mux_pt.c +++ b/src/mux_pt.c @@ -316,7 +316,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio TRACE_POINT(PT_EV_STRM_NEW, conn, cs); } else { - if (cs_attach_mux(cs, ctx, conn) < 0) + if (sc_attach_mux(cs, ctx, conn) < 0) goto fail_free_ctx; ctx->endp = cs->sedesc; } @@ -386,7 +386,7 @@ static int mux_pt_attach(struct connection *conn, struct sedesc *endp, struct se TRACE_ENTER(PT_EV_STRM_NEW, conn); if (ctx->wait_event.events) conn->xprt->unsubscribe(ctx->conn, conn->xprt_ctx, SUB_RETRY_RECV, &ctx->wait_event); - if (cs_attach_mux(endp->sc, ctx, conn) < 0) + if (sc_attach_mux(endp->sc, ctx, conn) < 0) return -1; ctx->endp = endp; se_fl_set(ctx->endp, SE_FL_RCV_MORE); diff --git a/src/payload.c b/src/payload.c index 7e66f0408..08d5826d4 100644 --- a/src/payload.c +++ b/src/payload.c @@ -65,7 +65,7 @@ smp_fetch_len(const struct arg *args, struct sample *smp, const char *kw, void * struct check *check = __objt_check(smp->sess->origin); /* Not accurate but kept for backward compatibility purpose */ - smp->data.u.sint = ((check->cs && IS_HTX_CS(check->cs)) ? (htxbuf(&check->bi))->data: b_data(&check->bi)); + smp->data.u.sint = ((check->cs && IS_HTX_SC(check->cs)) ? (htxbuf(&check->bi))->data: b_data(&check->bi)); } else return 0; @@ -1020,7 +1020,7 @@ smp_fetch_payload_lv(const struct arg *arg_p, struct sample *smp, const char *kw struct check *check = __objt_check(smp->sess->origin); /* meaningless for HTX buffers */ - if (check->cs && IS_HTX_CS(check->cs)) + if (check->cs && IS_HTX_SC(check->cs)) return 0; head = b_head(&check->bi); data = b_data(&check->bi); @@ -1089,7 +1089,7 @@ smp_fetch_payload(const struct arg *arg_p, struct sample *smp, const char *kw, v struct check *check = __objt_check(smp->sess->origin); /* meaningless for HTX buffers */ - if (check->cs && IS_HTX_CS(check->cs)) + if (check->cs && IS_HTX_SC(check->cs)) return 0; head = b_head(&check->bi); data = b_data(&check->bi); diff --git a/src/stream.c b/src/stream.c index 3c9184cdc..b141f17c3 100644 --- a/src/stream.c +++ b/src/stream.c @@ -446,7 +446,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer s->flags |= SF_HTX; s->scf = cs; - if (cs_attach_strm(s->scf, s) < 0) + if (sc_attach_strm(s->scf, s) < 0) goto out_fail_attach_scf; s->scb = sc_new_from_strm(s, SC_FL_ISBACK); @@ -1534,10 +1534,10 @@ static void stream_update_both_cs(struct stream *s) /* let's recompute both sides states */ if (cs_state_in(scf->state, SC_SB_RDY|SC_SB_EST)) - cs_update(scf); + sc_update(scf); if (cs_state_in(scb->state, SC_SB_RDY|SC_SB_EST)) - cs_update(scb); + sc_update(scb); /* stream connectors are processed outside of process_stream() and must be * handled at the latest moment. diff --git a/src/tcpcheck.c b/src/tcpcheck.c index d0d05256b..d0012a280 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -1100,7 +1100,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_connect(struct check *check, struct tcpchec TRACE_ERROR("stconn allocation error", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check); goto out; } - if (cs_attach_mux(check->cs, NULL, conn) < 0) { + if (sc_attach_mux(check->cs, NULL, conn) < 0) { TRACE_ERROR("mux attach error", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check); conn_free(conn); conn = NULL; @@ -1569,7 +1569,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_recv(struct check *check, struct tcpcheck_r while (sc_ep_test(cs, SE_FL_RCV_MORE) || (!(conn->flags & CO_FL_ERROR) && !sc_ep_test(cs, SE_FL_ERROR | SE_FL_EOS))) { - max = (IS_HTX_CS(cs) ? htx_free_space(htxbuf(&check->bi)) : b_room(&check->bi)); + max = (IS_HTX_SC(cs) ? htx_free_space(htxbuf(&check->bi)) : b_room(&check->bi)); read = conn->mux->rcv_buf(cs, &check->bi, max, 0); cur_read += read; if (!read || @@ -1580,7 +1580,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_recv(struct check *check, struct tcpcheck_r } end_recv: - is_empty = (IS_HTX_CS(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi)); + is_empty = (IS_HTX_SC(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi)); if (is_empty && ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR))) { /* Report network errors only if we got no other data. Otherwise * we'll let the upper layers decide whether the response is OK @@ -2208,7 +2208,7 @@ int tcpcheck_main(struct check *check) /* Refresh connection */ conn = sc_conn(cs); last_read = 0; - must_read = (IS_HTX_CS(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi)); + must_read = (IS_HTX_SC(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi)); break; case TCPCHK_ACT_SEND: check->current_step = rule;