CLEANUP: promex: rename all occurrences of stconn "cs" to "sc"

Function arguments and local variables called "cs" were renamed to "sc"
to avoid future confusion.
This commit is contained in:
Willy Tarreau 2022-05-27 10:16:15 +02:00
parent b49672d21f
commit 4c218fb25a

View File

@ -1189,7 +1189,7 @@ static int promex_dump_sticktable_metrics(struct appctx *appctx, struct htx *htx
* Uses <appctx.ctx.stats.px> as a pointer to the current proxy and <sv>/<li> * Uses <appctx.ctx.stats.px> as a pointer to the current proxy and <sv>/<li>
* as pointers to the current server/listener respectively. * as pointers to the current server/listener respectively.
*/ */
static int promex_dump_metrics(struct appctx *appctx, struct stconn *cs, struct htx *htx) static int promex_dump_metrics(struct appctx *appctx, struct stconn *sc, struct htx *htx)
{ {
struct promex_ctx *ctx = appctx->svcctx; struct promex_ctx *ctx = appctx->svcctx;
int ret; int ret;
@ -1337,7 +1337,7 @@ static int promex_dump_metrics(struct appctx *appctx, struct stconn *cs, struct
return 1; return 1;
full: full:
sc_need_room(cs); sc_need_room(sc);
return 0; return 0;
error: error:
/* unrecoverable error */ /* unrecoverable error */
@ -1353,11 +1353,11 @@ static int promex_dump_metrics(struct appctx *appctx, struct stconn *cs, struct
/* Parse the query string of request URI to filter the metrics. It returns 1 on /* Parse the query string of request URI to filter the metrics. It returns 1 on
* success and -1 on error. */ * success and -1 on error. */
static int promex_parse_uri(struct appctx *appctx, struct stconn *cs) static int promex_parse_uri(struct appctx *appctx, struct stconn *sc)
{ {
struct promex_ctx *ctx = appctx->svcctx; struct promex_ctx *ctx = appctx->svcctx;
struct channel *req = sc_oc(cs); struct channel *req = sc_oc(sc);
struct channel *res = sc_ic(cs); struct channel *res = sc_ic(sc);
struct htx *req_htx, *res_htx; struct htx *req_htx, *res_htx;
struct htx_sl *sl; struct htx_sl *sl;
char *p, *key, *value; char *p, *key, *value;
@ -1464,9 +1464,9 @@ static int promex_parse_uri(struct appctx *appctx, struct stconn *cs)
/* Send HTTP headers of the response. It returns 1 on success and 0 if <htx> is /* Send HTTP headers of the response. It returns 1 on success and 0 if <htx> is
* full. */ * full. */
static int promex_send_headers(struct appctx *appctx, struct stconn *cs, struct htx *htx) static int promex_send_headers(struct appctx *appctx, struct stconn *sc, struct htx *htx)
{ {
struct channel *chn = sc_ic(cs); struct channel *chn = sc_ic(sc);
struct htx_sl *sl; struct htx_sl *sl;
unsigned int flags; unsigned int flags;
@ -1485,7 +1485,7 @@ static int promex_send_headers(struct appctx *appctx, struct stconn *cs, struct
return 1; return 1;
full: full:
htx_reset(htx); htx_reset(htx);
sc_need_room(cs); sc_need_room(sc);
return 0; return 0;
} }
@ -1503,26 +1503,26 @@ static int promex_appctx_init(struct appctx *appctx)
/* The main I/O handler for the promex applet. */ /* The main I/O handler for the promex applet. */
static void promex_appctx_handle_io(struct appctx *appctx) static void promex_appctx_handle_io(struct appctx *appctx)
{ {
struct stconn *cs = appctx_cs(appctx); struct stconn *sc = appctx_cs(appctx);
struct stream *s = __sc_strm(cs); struct stream *s = __sc_strm(sc);
struct channel *req = sc_oc(cs); struct channel *req = sc_oc(sc);
struct channel *res = sc_ic(cs); struct channel *res = sc_ic(sc);
struct htx *req_htx, *res_htx; struct htx *req_htx, *res_htx;
int ret; int ret;
res_htx = htx_from_buf(&res->buf); res_htx = htx_from_buf(&res->buf);
if (unlikely(cs->state == SC_ST_DIS || cs->state == SC_ST_CLO)) if (unlikely(sc->state == SC_ST_DIS || sc->state == SC_ST_CLO))
goto out; goto out;
/* Check if the input buffer is available. */ /* Check if the input buffer is available. */
if (!b_size(&res->buf)) { if (!b_size(&res->buf)) {
sc_need_room(cs); sc_need_room(sc);
goto out; goto out;
} }
switch (appctx->st0) { switch (appctx->st0) {
case PROMEX_ST_INIT: case PROMEX_ST_INIT:
ret = promex_parse_uri(appctx, cs); ret = promex_parse_uri(appctx, sc);
if (ret <= 0) { if (ret <= 0) {
if (ret == -1) if (ret == -1)
goto error; goto error;
@ -1533,13 +1533,13 @@ static void promex_appctx_handle_io(struct appctx *appctx)
/* fall through */ /* fall through */
case PROMEX_ST_HEAD: case PROMEX_ST_HEAD:
if (!promex_send_headers(appctx, cs, res_htx)) if (!promex_send_headers(appctx, sc, res_htx))
goto out; goto out;
appctx->st0 = ((s->txn->meth == HTTP_METH_HEAD) ? PROMEX_ST_DONE : PROMEX_ST_DUMP); appctx->st0 = ((s->txn->meth == HTTP_METH_HEAD) ? PROMEX_ST_DONE : PROMEX_ST_DUMP);
/* fall through */ /* fall through */
case PROMEX_ST_DUMP: case PROMEX_ST_DUMP:
ret = promex_dump_metrics(appctx, cs, res_htx); ret = promex_dump_metrics(appctx, sc, res_htx);
if (ret <= 0) { if (ret <= 0) {
if (ret == -1) if (ret == -1)
goto error; goto error;
@ -1557,7 +1557,7 @@ static void promex_appctx_handle_io(struct appctx *appctx)
*/ */
if (htx_is_empty(res_htx)) { if (htx_is_empty(res_htx)) {
if (!htx_add_endof(res_htx, HTX_BLK_EOT)) { if (!htx_add_endof(res_htx, HTX_BLK_EOT)) {
sc_need_room(cs); sc_need_room(sc);
goto out; goto out;
} }
channel_add_input(res, 1); channel_add_input(res, 1);
@ -1571,7 +1571,7 @@ static void promex_appctx_handle_io(struct appctx *appctx)
case PROMEX_ST_END: case PROMEX_ST_END:
if (!(res->flags & CF_SHUTR)) { if (!(res->flags & CF_SHUTR)) {
res->flags |= CF_READ_NULL; res->flags |= CF_READ_NULL;
sc_shutr(cs); sc_shutr(sc);
} }
} }
@ -1587,8 +1587,8 @@ static void promex_appctx_handle_io(struct appctx *appctx)
error: error:
res->flags |= CF_READ_NULL; res->flags |= CF_READ_NULL;
sc_shutr(cs); sc_shutr(sc);
sc_shutw(cs); sc_shutw(sc);
} }
struct applet promex_applet = { struct applet promex_applet = {