diff --git a/include/haproxy/conn_stream.h b/include/haproxy/conn_stream.h index b48b4f17c..d5c8b192d 100644 --- a/include/haproxy/conn_stream.h +++ b/include/haproxy/conn_stream.h @@ -38,18 +38,18 @@ struct check; struct sedesc *sedesc_new(); void sedesc_free(struct sedesc *sedesc); -struct stconn *cs_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input); -struct stconn *cs_new_from_strm(struct stream *strm, unsigned int flags); -struct stconn *cs_new_from_check(struct check *check, unsigned int flags); -void cs_free(struct stconn *cs); +struct stconn *sc_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input); +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); -void cs_destroy(struct stconn *cs); +void sc_destroy(struct stconn *cs); int cs_reset_endp(struct stconn *cs); -struct appctx *cs_applet_create(struct stconn *cs, struct applet *app); +struct appctx *sc_applet_create(struct stconn *cs, struct applet *app); /* The se_fl_*() set of functions manipulate the stream endpoint flags from * the stream endpoint itself. The sc_ep_*() set of functions manipulate the diff --git a/include/haproxy/mux_quic.h b/include/haproxy/mux_quic.h index 11da81946..bfae33783 100644 --- a/include/haproxy/mux_quic.h +++ b/include/haproxy/mux_quic.h @@ -107,7 +107,7 @@ static inline struct stconn *qc_attach_cs(struct qcs *qcs, struct buffer *buf) /* TODO duplicated from mux_h2 */ sess->t_idle = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake; - if (!cs_new_from_endp(qcs->endp, sess, buf)) + if (!sc_new_from_endp(qcs->endp, sess, buf)) return NULL; ++qcc->nb_cs; diff --git a/src/applet.c b/src/applet.c index 834c47943..0586411b6 100644 --- a/src/applet.c +++ b/src/applet.c @@ -98,7 +98,7 @@ int appctx_finalize_startup(struct appctx *appctx, struct proxy *px, struct buff sess = session_new(px, NULL, &appctx->obj_type); if (!sess) return -1; - if (!cs_new_from_endp(appctx->sedesc, sess, input)) { + if (!sc_new_from_endp(appctx->sedesc, sess, input)) { session_free(sess); return -1; } diff --git a/src/backend.c b/src/backend.c index 091c59890..2447813e8 100644 --- a/src/backend.c +++ b/src/backend.c @@ -2175,7 +2175,7 @@ void back_handle_st_req(struct stream *s) * in SC_ST_RDY state. So, try to create the appctx now. */ BUG_ON(sc_appctx(cs)); - appctx = cs_applet_create(cs, objt_applet(s->target)); + appctx = sc_applet_create(cs, objt_applet(s->target)); if (!appctx) { /* No more memory, let's immediately abort. Force the * error code to ignore the ERR_LOCAL which is not a diff --git a/src/cache.c b/src/cache.c index db751699d..7b4e12533 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1840,7 +1840,7 @@ enum act_return http_action_req_cache_use(struct act_rule *rule, struct proxy *p } s->target = &http_cache_applet.obj_type; - if ((appctx = cs_applet_create(s->scb, objt_applet(s->target)))) { + if ((appctx = sc_applet_create(s->scb, objt_applet(s->target)))) { struct cache_appctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx)); appctx->st0 = HTX_CACHE_INIT; diff --git a/src/check.c b/src/check.c index 438e4b39c..95203cb40 100644 --- a/src/check.c +++ b/src/check.c @@ -1119,7 +1119,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state) check->current_step = NULL; - check->cs = cs_new_from_check(check, SC_FL_NONE); + check->cs = sc_new_from_check(check, SC_FL_NONE); if (!check->cs) { set_server_check_status(check, HCHK_STATUS_SOCKERR, NULL); goto end; @@ -1180,7 +1180,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state) } if (cs) { - cs_destroy(cs); + sc_destroy(cs); cs = check->cs = NULL; conn = NULL; } @@ -1341,7 +1341,7 @@ void free_check(struct check *check) check_release_buf(check, &check->bi); check_release_buf(check, &check->bo); if (check->cs) { - cs_destroy(check->cs); + sc_destroy(check->cs); check->cs = NULL; } } diff --git a/src/conn_stream.c b/src/conn_stream.c index 1695541bb..a788b78bf 100644 --- a/src/conn_stream.c +++ b/src/conn_stream.c @@ -121,7 +121,7 @@ void sedesc_free(struct sedesc *sedesc) * function. The caller must, at least, set the SE_FL_ORPHAN or SE_FL_DETACHED * flag. */ -static struct stconn *cs_new(struct sedesc *sedesc) +static struct stconn *sc_new(struct sedesc *sedesc) { struct stconn *cs; @@ -161,11 +161,11 @@ static struct stconn *cs_new(struct sedesc *sedesc) * defined. It returns NULL on error. On success, the new stream connector is * returned. In this case, SE_FL_ORPHAN flag is removed. */ -struct stconn *cs_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input) +struct stconn *sc_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input) { struct stconn *cs; - cs = cs_new(sedesc); + cs = sc_new(sedesc); if (unlikely(!cs)) return NULL; if (unlikely(!stream_new(sess, cs, input))) { @@ -177,14 +177,14 @@ struct stconn *cs_new_from_endp(struct sedesc *sedesc, struct session *sess, str } /* Creates a new stream connector from an stream. There is no endpoint here, thus it - * will be created by cs_new(). So the SE_FL_DETACHED flag is set. It returns + * will be created by sc_new(). So the SE_FL_DETACHED flag is set. It returns * NULL on error. On success, the new stream connector is returned. */ -struct stconn *cs_new_from_strm(struct stream *strm, unsigned int flags) +struct stconn *sc_new_from_strm(struct stream *strm, unsigned int flags) { struct stconn *cs; - cs = cs_new(NULL); + cs = sc_new(NULL); if (unlikely(!cs)) return NULL; cs->flags |= flags; @@ -195,14 +195,14 @@ struct stconn *cs_new_from_strm(struct stream *strm, unsigned int flags) } /* Creates a new stream connector from an health-check. There is no endpoint here, - * thus it will be created by cs_new(). So the SE_FL_DETACHED flag is set. It + * thus it will be created by sc_new(). So the SE_FL_DETACHED flag is set. It * returns NULL on error. On success, the new stream connector is returned. */ -struct stconn *cs_new_from_check(struct check *check, unsigned int flags) +struct stconn *sc_new_from_check(struct check *check, unsigned int flags) { struct stconn *cs; - cs = cs_new(NULL); + cs = sc_new(NULL); if (unlikely(!cs)) return NULL; cs->flags |= flags; @@ -212,10 +212,10 @@ struct stconn *cs_new_from_check(struct check *check, unsigned int flags) return cs; } -/* Releases a stconn previously allocated by cs_new(), as well as its +/* Releases a stconn previously allocated by sc_new(), as well as its * endpoint, if it exists. This function is called internally or on error path. */ -void cs_free(struct stconn *cs) +void sc_free(struct stconn *cs) { sockaddr_free(&cs->src); sockaddr_free(&cs->dst); @@ -232,12 +232,12 @@ void cs_free(struct stconn *cs) * layer defined. Except on error path, this one must be used. if release, the * pointer on the CS is set to NULL. */ -static void cs_free_cond(struct stconn **csp) +static void sc_free_cond(struct stconn **csp) { struct stconn *cs = *csp; if (!cs->app && (!cs->sedesc || sc_ep_test(cs, SE_FL_DETACHED))) { - cs_free(cs); + sc_free(cs); *csp = NULL; } } @@ -394,7 +394,7 @@ static void cs_detach_endp(struct stconn **csp) cs->app_ops = &sc_app_embedded_ops; else cs->app_ops = NULL; - cs_free_cond(csp); + sc_free_cond(csp); } /* Detaches the stconn from the app layer. If there is no endpoint attached @@ -416,13 +416,13 @@ static void cs_detach_app(struct stconn **csp) tasklet_free(cs->wait_event.tasklet); cs->wait_event.tasklet = NULL; cs->wait_event.events = 0; - cs_free_cond(csp); + sc_free_cond(csp); } /* Destroy the stconn. It is detached from its endpoint and its * application. After this call, the stconn must be considered as released. */ -void cs_destroy(struct stconn *cs) +void sc_destroy(struct stconn *cs) { cs_detach_endp(&cs); cs_detach_app(&cs); @@ -478,7 +478,7 @@ int cs_reset_endp(struct stconn *cs) * It also pre-initializes the applet's context and returns it (or NULL in case * it could not be allocated). */ -struct appctx *cs_applet_create(struct stconn *cs, struct applet *app) +struct appctx *sc_applet_create(struct stconn *cs, struct applet *app) { struct appctx *appctx; diff --git a/src/http_ana.c b/src/http_ana.c index 9bcca5d91..8a58287ba 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -430,7 +430,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s */ if (!s->target && http_stats_check_uri(s, txn, px)) { s->target = &http_stats_applet.obj_type; - if (unlikely(!cs_applet_create(s->scb, objt_applet(s->target)))) { + if (unlikely(!sc_applet_create(s->scb, objt_applet(s->target)))) { s->logs.tv_request = now; if (!(s->flags & SF_ERR_MASK)) s->flags |= SF_ERR_RESOURCE; diff --git a/src/mux_h1.c b/src/mux_h1.c index 2c3f118dc..07b40de76 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -732,7 +732,7 @@ static struct stconn *h1s_new_cs(struct h1s *h1s, struct buffer *input) if (h1s->req.flags & H1_MF_UPG_WEBSOCKET) se_fl_set(h1s->endp, SE_FL_WEBSOCKET); - if (!cs_new_from_endp(h1s->endp, h1c->conn->owner, input)) { + if (!sc_new_from_endp(h1s->endp, h1c->conn->owner, input)) { TRACE_ERROR("CS allocation failure", H1_EV_STRM_NEW|H1_EV_STRM_END|H1_EV_STRM_ERR, h1c->conn, h1s); goto err; } diff --git a/src/mux_h2.c b/src/mux_h2.c index 1e50bed1b..dde2392d0 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -1635,7 +1635,7 @@ static struct h2s *h2c_frt_stream_new(struct h2c *h2c, int id, struct buffer *in */ sess->t_idle = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake; - if (!cs_new_from_endp(h2s->endp, sess, input)) + if (!sc_new_from_endp(h2s->endp, sess, input)) goto out_close; h2c->nb_cs++; diff --git a/src/mux_pt.c b/src/mux_pt.c index b8a375e13..5f4c041ea 100644 --- a/src/mux_pt.c +++ b/src/mux_pt.c @@ -308,7 +308,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio ctx->endp->conn = conn; se_fl_set(ctx->endp, SE_FL_T_MUX | SE_FL_ORPHAN); - cs = cs_new_from_endp(ctx->endp, sess, input); + cs = sc_new_from_endp(ctx->endp, sess, input); if (!cs) { TRACE_ERROR("CS allocation failure", PT_EV_STRM_NEW|PT_EV_STRM_END|PT_EV_STRM_ERR, conn); goto fail_free_endp; diff --git a/src/stream.c b/src/stream.c index 16456e0ce..3c9184cdc 100644 --- a/src/stream.c +++ b/src/stream.c @@ -449,7 +449,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer if (cs_attach_strm(s->scf, s) < 0) goto out_fail_attach_scf; - s->scb = cs_new_from_strm(s, SC_FL_ISBACK); + s->scb = sc_new_from_strm(s, SC_FL_ISBACK); if (!s->scb) goto out_fail_alloc_scb; @@ -568,7 +568,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer flt_stream_release(s, 0); LIST_DELETE(&s->list); out_fail_attach_scf: - cs_free(s->scb); + sc_free(s->scb); out_fail_alloc_scb: task_destroy(t); out_fail_alloc: @@ -708,8 +708,8 @@ void stream_free(struct stream *s) } LIST_DELETE(&s->list); - cs_destroy(s->scb); - cs_destroy(s->scf); + sc_destroy(s->scb); + sc_destroy(s->scf); pool_free(pool_head_stream, s); @@ -992,7 +992,7 @@ enum act_return process_use_service(struct act_rule *rule, struct proxy *px, if (flags & ACT_OPT_FIRST) { /* Register applet. this function schedules the applet. */ s->target = &rule->applet.obj_type; - appctx = cs_applet_create(s->scb, objt_applet(s->target)); + appctx = sc_applet_create(s->scb, objt_applet(s->target)); if (unlikely(!appctx)) return ACT_RET_ERR;