]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stconn: rename cs_{new,create,free,destroy}_* to sc_*
authorWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 06:33:53 +0000 (08:33 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:35 +0000 (19:33 +0200)
This renames the following functions:

cs_new_from_endp()  -> sc_new_from_endp()
cs_new_from_strm()  -> sc_new_from_strm()
cs_new_from_check() -> sc_new_from_check()
cs_applet_create()  -> sc_applet_create()
cs_destroy()        -> sc_destroy()
cs_free()           -> sc_free()

12 files changed:
include/haproxy/conn_stream.h
include/haproxy/mux_quic.h
src/applet.c
src/backend.c
src/cache.c
src/check.c
src/conn_stream.c
src/http_ana.c
src/mux_h1.c
src/mux_h2.c
src/mux_pt.c
src/stream.c

index b48b4f17c21a1f10660e8868bdaa468ca142eae4..d5c8b192da0c0040444cfa729cfabb1cd3ddf0ce 100644 (file)
@@ -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
index 11da8194666f7f8f68ac06699653aa4f1c36af28..bfae337833fdd7c24a66cd7b4a4d928d904bb1ef 100644 (file)
@@ -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;
index 834c47943ef53362547b3343f01ee1986c09342a..0586411b6bae812e116d7f9d414717cc530e51c1 100644 (file)
@@ -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;
        }
index 091c59890bf21c76bb820862f52d6475db672ec4..2447813e8623d5eb08f33a78f7f498d26b0799f4 100644 (file)
@@ -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
index db751699d990fd0135c0952e41257f78785109d2..7b4e1253316133b5fa2cd431a0488ba689703eab 100644 (file)
@@ -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;
index 438e4b39cbacf45a740ba634a61ecb63457398fb..95203cb405a6d7cdb1c3a14c10db7df3c9caeac0 100644 (file)
@@ -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;
        }
 }
index 1695541bb93a9a9e6b53fd421da7d8b2e15fa763..a788b78bf5ed241b66e3b84fc6b5d82698d05ab2 100644 (file)
@@ -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;
 
index 9bcca5d919d943ae01b8f6f152d559594748a21a..8a58287ba9b97141bbea9090cbc0bd3aa696b23e 100644 (file)
@@ -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;
index 2c3f118dcbe7d790a3a5cd7032c98cff304478d8..07b40de766aa8a5f4020841d7bb899cc79ac930e 100644 (file)
@@ -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;
        }
index 1e50bed1b5a2450057d98d75adce7c4d956acce2..dde2392d07541175b355e84660951342177d0cbc 100644 (file)
@@ -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++;
index b8a375e13dda1819ce6ddcbabb03bc839c140b93..5f4c041ea2206c73e257887358169eb72580a208 100644 (file)
@@ -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;
index 16456e0cead4f55595ae6a5655d56559bfc8a616..3c9184cdc68d641bfbda7c41a30eca18d1b33295 100644 (file)
@@ -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;