]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stconn: rename cs_appctx() to sc_appctx()
authorWilly Tarreau <w@1wt.eu>
Wed, 18 May 2022 15:58:02 +0000 (17:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:34 +0000 (19:33 +0200)
Nothing special, just s/cs/sc/, roughly 50-60 entries.

include/haproxy/conn_stream.h
src/backend.c
src/cache.c
src/conn_stream.c
src/hlua.c
src/http_ana.c
src/proxy.c
src/resolvers.c
src/stats.c
src/stream.c

index aa186b3b2638436ebfe9678e63cd7fbf5c0e38f6..a7c9e3609d291013a6464ee45843f54f944ff4bd 100644 (file)
@@ -171,17 +171,17 @@ static inline struct appctx *sc_mux_strm(const struct stconn *cs)
 }
 
 /* Returns the appctx from a cs if the endpoint is an appctx. Otherwise
- * NULL is returned. __cs_appctx() returns the appctx without any control
- * while cs_appctx() check the endpoint type.
+ * NULL is returned. __sc_appctx() returns the appctx without any control
+ * while sc_appctx() checks the endpoint type.
  */
-static inline struct appctx *__cs_appctx(const struct stconn *cs)
+static inline struct appctx *__sc_appctx(const struct stconn *cs)
 {
        return __cs_endp_target(cs);
 }
-static inline struct appctx *cs_appctx(const struct stconn *cs)
+static inline struct appctx *sc_appctx(const struct stconn *cs)
 {
        if (sc_ep_test(cs, SE_FL_T_APPLET))
-               return __cs_appctx(cs);
+               return __sc_appctx(cs);
        return NULL;
 }
 
index 131e5a4038c0b9484f2b32c0d2c15b2eebac0731..091c59890bf21c76bb820862f52d6475db672ec4 100644 (file)
@@ -2174,7 +2174,7 @@ void back_handle_st_req(struct stream *s)
                 * means no appctx are attached to the CS. Otherwise, it will be
                 * in SC_ST_RDY state. So, try to create the appctx now.
                 */
-               BUG_ON(cs_appctx(cs));
+               BUG_ON(sc_appctx(cs));
                appctx = cs_applet_create(cs, objt_applet(s->target));
                if (!appctx) {
                        /* No more memory, let's immediately abort. Force the
@@ -2447,7 +2447,7 @@ void back_handle_st_rdy(struct stream *s)
                /* Here the appctx must exists because the CS was set to
                 * SC_ST_RDY state when the appctx was created.
                 */
-               BUG_ON(!cs_appctx(s->scb));
+               BUG_ON(!sc_appctx(s->scb));
 
                if (tv_iszero(&s->logs.tv_request))
                        s->logs.tv_request = now;
index 636c26d4f81585fa172df47aef74060530335cac..22902a355fce06b325600d136f86c715c372bd87 100644 (file)
@@ -2686,7 +2686,7 @@ smp_fetch_res_cache_name(const struct arg *args, struct sample *smp,
                return 0;
 
        /* Get appctx from the stream connector. */
-       appctx = cs_appctx(smp->strm->scb);
+       appctx = sc_appctx(smp->strm->scb);
        if (appctx && appctx->rule) {
                cconf = appctx->rule->arg.act.p[0];
                if (cconf) {
index b2c45f8e1459c92c3aad4dd5284fa79cadf5167b..7a16afd4eec3bf3862b4f936ed1894f9d7931752 100644 (file)
@@ -368,7 +368,7 @@ static void cs_detach_endp(struct stconn **csp)
                }
        }
        else if (sc_ep_test(cs, SE_FL_T_APPLET)) {
-               struct appctx *appctx = __cs_appctx(cs);
+               struct appctx *appctx = __sc_appctx(cs);
 
                sc_ep_set(cs, SE_FL_ORPHAN);
                cs->sedesc->sc = NULL;
@@ -876,7 +876,7 @@ static void sc_app_shutr_applet(struct stconn *cs)
 {
        struct channel *ic = sc_ic(cs);
 
-       BUG_ON(!cs_appctx(cs));
+       BUG_ON(!sc_appctx(cs));
 
        cs_rx_shut_blk(cs);
        if (ic->flags & CF_SHUTR)
@@ -890,7 +890,7 @@ static void sc_app_shutr_applet(struct stconn *cs)
                return;
 
        if (sc_oc(cs)->flags & CF_SHUTW) {
-               appctx_shut(__cs_appctx(cs));
+               appctx_shut(__sc_appctx(cs));
                cs->state = SC_ST_DIS;
                __sc_strm(cs)->conn_exp = TICK_ETERNITY;
        }
@@ -912,7 +912,7 @@ static void sc_app_shutw_applet(struct stconn *cs)
        struct channel *ic = sc_ic(cs);
        struct channel *oc = sc_oc(cs);
 
-       BUG_ON(!cs_appctx(cs));
+       BUG_ON(!sc_appctx(cs));
 
        oc->flags &= ~CF_SHUTW_NOW;
        if (oc->flags & CF_SHUTW)
@@ -927,7 +927,7 @@ static void sc_app_shutw_applet(struct stconn *cs)
        }
 
        /* on shutw we always wake the applet up */
-       appctx_wakeup(__cs_appctx(cs));
+       appctx_wakeup(__sc_appctx(cs));
 
        switch (cs->state) {
        case SC_ST_RDY:
@@ -948,7 +948,7 @@ static void sc_app_shutw_applet(struct stconn *cs)
        case SC_ST_QUE:
        case SC_ST_TAR:
                /* Note that none of these states may happen with applets */
-               appctx_shut(__cs_appctx(cs));
+               appctx_shut(__sc_appctx(cs));
                cs->state = SC_ST_DIS;
                /* fall through */
        default:
@@ -965,7 +965,7 @@ static void sc_app_chk_rcv_applet(struct stconn *cs)
 {
        struct channel *ic = sc_ic(cs);
 
-       BUG_ON(!cs_appctx(cs));
+       BUG_ON(!sc_appctx(cs));
 
        DPRINTF(stderr, "%s: cs=%p, cs->state=%d ic->flags=%08x oc->flags=%08x\n",
                __FUNCTION__,
@@ -973,7 +973,7 @@ static void sc_app_chk_rcv_applet(struct stconn *cs)
 
        if (!ic->pipe) {
                /* (re)start reading */
-               appctx_wakeup(__cs_appctx(cs));
+               appctx_wakeup(__sc_appctx(cs));
        }
 }
 
@@ -982,7 +982,7 @@ static void sc_app_chk_snd_applet(struct stconn *cs)
 {
        struct channel *oc = sc_oc(cs);
 
-       BUG_ON(!cs_appctx(cs));
+       BUG_ON(!sc_appctx(cs));
 
        DPRINTF(stderr, "%s: cs=%p, cs->state=%d ic->flags=%08x oc->flags=%08x\n",
                __FUNCTION__,
@@ -1001,7 +1001,7 @@ static void sc_app_chk_snd_applet(struct stconn *cs)
 
        if (!channel_is_empty(oc)) {
                /* (re)start sending */
-               appctx_wakeup(__cs_appctx(cs));
+               appctx_wakeup(__sc_appctx(cs));
        }
 }
 
@@ -1928,7 +1928,7 @@ static int cs_applet_process(struct stconn *cs)
 {
        struct channel *ic = sc_ic(cs);
 
-       BUG_ON(!cs_appctx(cs));
+       BUG_ON(!sc_appctx(cs));
 
        /* If the applet wants to write and the channel is closed, it's a
         * broken pipe and it must be reported.
@@ -1953,6 +1953,6 @@ static int cs_applet_process(struct stconn *cs)
         */
        if ((cs_rx_endp_ready(cs) && !cs_rx_blocked(cs)) ||
            (cs_tx_endp_ready(cs) && !cs_tx_blocked(cs)))
-               appctx_wakeup(__cs_appctx(cs));
+               appctx_wakeup(__sc_appctx(cs));
        return 0;
 }
index 1fdfcf3d1b69ea06d65ddf7de32c578c06e2f23b..4fc952c39c5b5d0287abe40b46bfc300301e3926 100644 (file)
@@ -2747,7 +2747,7 @@ __LJMP static int hlua_socket_connect_yield(struct lua_State *L, int status, lua
                return 2;
        }
 
-       appctx = __cs_appctx(s->scf);
+       appctx = __sc_appctx(s->scf);
 
        /* Check for connection established. */
        if (csk_ctx->connected) {
index 55c0a34174fdd0765649448239a66ed76d4f43c5..08a76b2b04fdcb81982c61d2cc783a47f346b0de 100644 (file)
@@ -3973,7 +3973,7 @@ static int http_handle_stats(struct stream *s, struct channel *req)
        struct http_msg *msg = &txn->req;
        struct uri_auth *uri_auth = s->be->uri_auth;
        const char *h, *lookup, *end;
-       struct appctx *appctx = __cs_appctx(s->scb);
+       struct appctx *appctx = __sc_appctx(s->scb);
        struct show_stat_ctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
        struct htx *htx;
        struct htx_sl *sl;
index b3e23369e4df50672c51569ee9d6e5cc8960e3a1..26a4ad80cc98b4b80027901ad27727f194967356 100644 (file)
@@ -2708,7 +2708,7 @@ static void dump_server_addr(const struct sockaddr_storage *addr, char *addr_str
  */
 static int dump_servers_state(struct stconn *cs)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_srv_ctx *ctx = appctx->svcctx;
        struct proxy *px = ctx->px;
        struct server *srv;
index 82dbd410daa300d6bbea6365bf2d9da3d73cfdca..f46aaeffd4b6d5344a5a75176ff69e9e84fe45ea 100644 (file)
@@ -2592,7 +2592,7 @@ static int stats_dump_resolv_to_buffer(struct stconn *cs,
                                     struct field *stats, size_t stats_count,
                                     struct list *stat_modules)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct channel *rep = sc_ic(cs);
        struct stats_module *mod;
        size_t idx = 0;
@@ -2626,7 +2626,7 @@ int stats_dump_resolvers(struct stconn *cs,
                          struct field *stats, size_t stats_count,
                          struct list *stat_modules)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
        struct channel *rep = sc_ic(cs);
        struct resolvers *resolver = ctx->obj1;
index 6cc19dba42cb232cd879575ad38fef04acc32b8f..5aee44967fa7a7c1fe4df20e105a8fcdb671aa5b 100644 (file)
@@ -1814,7 +1814,7 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len,
  */
 static int stats_dump_fe_stats(struct stconn *cs, struct proxy *px)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
        struct field *stats = stat_l[STATS_DOMAIN_PROXY];
        struct stats_module *mod;
@@ -1982,7 +1982,7 @@ int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
  */
 static int stats_dump_li_stats(struct stconn *cs, struct proxy *px, struct listener *l)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
        struct field *stats = stat_l[STATS_DOMAIN_PROXY];
        struct stats_module *mod;
@@ -2494,7 +2494,7 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
  */
 static int stats_dump_sv_stats(struct stconn *cs, struct proxy *px, struct server *sv)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
        struct stats_module *mod;
        struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@@ -2820,7 +2820,7 @@ int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int le
  */
 static int stats_dump_be_stats(struct stconn *cs, struct proxy *px)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
        struct field *stats = stat_l[STATS_DOMAIN_PROXY];
        struct stats_module *mod;
@@ -2862,7 +2862,7 @@ static int stats_dump_be_stats(struct stconn *cs, struct proxy *px)
  */
 static void stats_dump_html_px_hdr(struct stconn *cs, struct proxy *px)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
        char scope_txt[STAT_SCOPE_TXT_MAXLEN + sizeof STAT_SCOPE_PATTERN];
        struct stats_module *mod;
@@ -2972,7 +2972,7 @@ static void stats_dump_html_px_hdr(struct stconn *cs, struct proxy *px)
  */
 static void stats_dump_html_px_end(struct stconn *cs, struct proxy *px)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
 
        chunk_appendf(&trash, "</table>");
@@ -3016,7 +3016,7 @@ static void stats_dump_html_px_end(struct stconn *cs, struct proxy *px)
 int stats_dump_proxy_to_buffer(struct stconn *cs, struct htx *htx,
                               struct proxy *px, struct uri_auth *uri)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
        struct stream *s = __sc_strm(cs);
        struct channel *rep = sc_ic(cs);
@@ -3394,7 +3394,7 @@ static void stats_dump_html_head(struct appctx *appctx, struct uri_auth *uri)
  */
 static void stats_dump_html_info(struct stconn *cs, struct uri_auth *uri)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
        unsigned int up = (now.tv_sec - start_date.tv_sec);
        char scope_txt[STAT_SCOPE_TXT_MAXLEN + sizeof STAT_SCOPE_PATTERN];
@@ -3677,7 +3677,7 @@ static int stats_dump_proxies(struct stconn *cs,
                               struct htx *htx,
                               struct uri_auth *uri)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
        struct channel *rep = sc_ic(cs);
        struct proxy *px;
@@ -3725,7 +3725,7 @@ static int stats_dump_proxies(struct stconn *cs,
 static int stats_dump_stat_to_buffer(struct stconn *cs, struct htx *htx,
                                     struct uri_auth *uri)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
        struct channel *rep = sc_ic(cs);
        enum stats_domain domain = ctx->domain;
@@ -3828,7 +3828,7 @@ static int stats_dump_stat_to_buffer(struct stconn *cs, struct htx *htx,
 static int stats_process_http_post(struct stconn *cs)
 {
        struct stream *s = __sc_strm(cs);
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
 
        struct proxy *px = NULL;
@@ -4165,7 +4165,7 @@ static int stats_send_http_headers(struct stconn *cs, struct htx *htx)
 {
        struct stream *s = __sc_strm(cs);
        struct uri_auth *uri = s->be->uri_auth;
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
        struct htx_sl *sl;
        unsigned int flags;
@@ -4220,7 +4220,7 @@ static int stats_send_http_redirect(struct stconn *cs, struct htx *htx)
        char scope_txt[STAT_SCOPE_TXT_MAXLEN + sizeof STAT_SCOPE_PATTERN];
        struct stream *s = __sc_strm(cs);
        struct uri_auth *uri = s->be->uri_auth;
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
        struct htx_sl *sl;
        unsigned int flags;
@@ -4550,7 +4550,7 @@ int stats_fill_info(struct field *info, int len, uint flags)
  */
 static int stats_dump_info_to_buffer(struct stconn *cs)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_stat_ctx *ctx = appctx->svcctx;
 
        if (!stats_fill_info(info, INF_TOTAL_FIELDS, ctx->flags))
index e8f9c9180799d2b66056c431c7f9abab4212f451..9c10db9698cbdded97d7e5ec6a51d200db4d34b5 100644 (file)
@@ -536,7 +536,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer
                goto out_fail_accept;
 
        /* finish initialization of the accepted file descriptor */
-       if (cs_appctx(cs))
+       if (sc_appctx(cs))
                cs_want_get(s->scf);
 
        if (sess->fe->accept && sess->fe->accept(s) < 0)
@@ -1002,7 +1002,7 @@ enum act_return process_use_service(struct act_rule *rule, struct proxy *px,
                        return ACT_RET_ERR;
        }
        else
-               appctx = __cs_appctx(s->scb);
+               appctx = __sc_appctx(s->scb);
 
        if (rule->from != ACT_F_HTTP_REQ) {
                if (sess->fe == s->be) /* report it if the request was intercepted by the frontend */
@@ -1542,15 +1542,15 @@ static void stream_update_both_cs(struct stream *s)
        /* stream connectors are processed outside of process_stream() and must be
         * handled at the latest moment.
         */
-       if (cs_appctx(scf)) {
+       if (sc_appctx(scf)) {
                if ((cs_rx_endp_ready(scf) && !cs_rx_blocked(scf)) ||
                    (cs_tx_endp_ready(scf) && !cs_tx_blocked(scf)))
-                       appctx_wakeup(__cs_appctx(scf));
+                       appctx_wakeup(__sc_appctx(scf));
        }
-       if (cs_appctx(scb)) {
+       if (sc_appctx(scb)) {
                if ((cs_rx_endp_ready(scb) && !cs_rx_blocked(scb)) ||
                    (cs_tx_endp_ready(scb) && !cs_tx_blocked(scb)))
-                       appctx_wakeup(__cs_appctx(scb));
+                       appctx_wakeup(__sc_appctx(scb));
        }
 }
 
@@ -2755,7 +2755,7 @@ void stream_dump(struct buffer *buf, const struct stream *s, const char *pfx, ch
 
        scf = s->scf;
        cof = sc_conn(scf);
-       acf = cs_appctx(scf);
+       acf = sc_appctx(scf);
        if (cof && cof->src && addr_to_str(cof->src, pn, sizeof(pn)) >= 0)
                src = pn;
        else if (acf)
@@ -2763,7 +2763,7 @@ void stream_dump(struct buffer *buf, const struct stream *s, const char *pfx, ch
 
        scb = s->scb;
        cob = sc_conn(scb);
-       acb = cs_appctx(scb);
+       acb = sc_appctx(scb);
        srv = objt_server(s->target);
        if (srv)
                dst = srv->id;
@@ -3152,7 +3152,7 @@ struct show_sess_ctx {
  */
 static int stats_dump_full_strm_to_buffer(struct stconn *cs, struct stream *strm)
 {
-       struct appctx *appctx = __cs_appctx(cs);
+       struct appctx *appctx = __sc_appctx(cs);
        struct show_sess_ctx *ctx = appctx->svcctx;
        struct stconn *scf, *scb;
        struct tm tm;
@@ -3330,7 +3330,7 @@ static int stats_dump_full_strm_to_buffer(struct stconn *cs, struct stream *strm
                                      conn_fd(conn) >= 0 ? fdtab[conn->handle.fd].thread_mask: 0);
 
                }
-               else if ((tmpctx = cs_appctx(scf)) != NULL) {
+               else if ((tmpctx = sc_appctx(scf)) != NULL) {
                        chunk_appendf(&trash,
                                      "      app0=%p st0=%d st1=%d st2=%d applet=%s tmask=0x%lx nice=%d calls=%u rate=%u cpu=%llu lat=%llu\n",
                                      tmpctx,
@@ -3369,7 +3369,7 @@ static int stats_dump_full_strm_to_buffer(struct stconn *cs, struct stream *strm
                                      conn_fd(conn) >= 0 ? fdtab[conn->handle.fd].thread_mask: 0);
 
                }
-               else if ((tmpctx = cs_appctx(scb)) != NULL) {
+               else if ((tmpctx = sc_appctx(scb)) != NULL) {
                        chunk_appendf(&trash,
                                      "      app1=%p st0=%d st1=%d st2=%d applet=%s tmask=0x%lx nice=%d calls=%u rate=%u cpu=%llu lat=%llu\n",
                                      tmpctx,