]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: xprt/mux: export all *_io_cb functions so that "show fd" resolves them
authorWilly Tarreau <w@1wt.eu>
Wed, 20 Jan 2021 13:55:01 +0000 (14:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 20 Jan 2021 16:17:39 +0000 (17:17 +0100)
In FD dumps it's often very important to figure what upper layer function
is going to be called. Let's export the few I/O callbacks that appear as
tasklet functions so that "show fd" can resolve them instead of printing
a pointer relative to main. For example:

   1028 : st=0x21(R:rA W:Ra) ev=0x01(heopI) [lc] tmask=0x2 umask=0x2 owner=0x7f00b889b200 iocb=0x65b638(sock_conn_iocb) back=0 cflg=0x00001300 fe=recv mux=H2 ctx=0x7f00c8824de0 h2c.st0=FRH .err=0 .maxid=795 .lastid=-1 .flg=0x0000 .nbst=0 .nbcs=0 .fctl_cnt=0 .send_cnt=0 .tree_cnt=0 .orph_cnt=0 .sub=1 .dsi=795 .dbuf=0@(nil)+0/0 .msi=-1 .mbuf=[1..1|32],h=[0@(nil)+0/0],t=[0@(nil)+0/0] xprt=SSL xprt_ctx=0x7f00c86d0750 xctx.st=0 .xprt=RAW .wait.ev=1 .subs=0x7f00c88252e0(ev=1 tl=0x7f00a07d1aa0 tl.calls=1047 tl.ctx=0x7f00c8824de0 tl.fct=h2_io_cb) .sent_early=0 .early_in=0

src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/mux_pt.c
src/ssl_sock.c
src/xprt_handshake.c
src/xprt_quic.c

index 9998710f0fde750ccf4c9b808d33a3a1d0c26d18..4ce916f048b7a14abde7a92eb94042d39c24d285 100644 (file)
@@ -353,7 +353,8 @@ DECLARE_STATIC_POOL(pool_head_fcgi_strm, "fcgi_strm", sizeof(struct fcgi_strm));
 
 static struct task *fcgi_timeout_task(struct task *t, void *context, unsigned short state);
 static int fcgi_process(struct fcgi_conn *fconn);
-static struct task *fcgi_io_cb(struct task *t, void *ctx, unsigned short state);
+/* fcgi_io_cb is exported to see it resolved in "show fd" */
+struct task *fcgi_io_cb(struct task *t, void *ctx, unsigned short state);
 static inline struct fcgi_strm *fcgi_conn_st_by_id(struct fcgi_conn *fconn, int id);
 static struct task *fcgi_deferred_shut(struct task *t, void *ctx, unsigned short state);
 static struct fcgi_strm *fcgi_conn_stream_new(struct fcgi_conn *fconn, struct conn_stream *cs, struct session *sess);
@@ -2926,7 +2927,7 @@ schedule:
 }
 
 /* this is the tasklet referenced in fconn->wait_event.tasklet */
-static struct task *fcgi_io_cb(struct task *t, void *ctx, unsigned short status)
+struct task *fcgi_io_cb(struct task *t, void *ctx, unsigned short status)
 {
        struct connection *conn;
        struct fcgi_conn *fconn;
index 75eb5f7fa192736c2b0ddac303483776f56e3622..857b1c380b62a38bc3a3b38436452676f38aa331 100644 (file)
@@ -258,7 +258,8 @@ DECLARE_STATIC_POOL(pool_head_h1s, "h1s", sizeof(struct h1s));
 static int h1_recv(struct h1c *h1c);
 static int h1_send(struct h1c *h1c);
 static int h1_process(struct h1c *h1c);
-static struct task *h1_io_cb(struct task *t, void *ctx, unsigned short state);
+/* h1_io_cb is exported to see it resolved in "show fd" */
+struct task *h1_io_cb(struct task *t, void *ctx, unsigned short state);
 static struct task *h1_timeout_task(struct task *t, void *context, unsigned short state);
 static void h1_shutw_conn(struct connection *conn, enum cs_shw_mode mode);
 static void h1_wake_stream_for_recv(struct h1s *h1s);
@@ -2475,7 +2476,7 @@ static int h1_process(struct h1c * h1c)
        return -1;
 }
 
-static struct task *h1_io_cb(struct task *t, void *ctx, unsigned short status)
+struct task *h1_io_cb(struct task *t, void *ctx, unsigned short status)
 {
        struct connection *conn;
        struct tasklet *tl = (struct tasklet *)t;
index 55ed8da48b67d09cd99f7fd2501d702607edd6d7..de8e0974ae7bbf29771cce37818489c00eb558b2 100644 (file)
@@ -545,7 +545,8 @@ static struct task *h2_timeout_task(struct task *t, void *context, unsigned shor
 static int h2_send(struct h2c *h2c);
 static int h2_recv(struct h2c *h2c);
 static int h2_process(struct h2c *h2c);
-static struct task *h2_io_cb(struct task *t, void *ctx, unsigned short state);
+/* h2_io_cb is exported to see it resolved in "show fd" */
+struct task *h2_io_cb(struct task *t, void *ctx, unsigned short state);
 static inline struct h2s *h2c_st_by_id(struct h2c *h2c, int id);
 static int h2c_decode_headers(struct h2c *h2c, struct buffer *rxbuf, uint32_t *flags, unsigned long long *body_len);
 static int h2_frt_transfer_data(struct h2s *h2s);
@@ -3696,7 +3697,7 @@ schedule:
 }
 
 /* this is the tasklet referenced in h2c->wait_event.tasklet */
-static struct task *h2_io_cb(struct task *t, void *ctx, unsigned short status)
+struct task *h2_io_cb(struct task *t, void *ctx, unsigned short status)
 {
        struct connection *conn;
        struct tasklet *tl = (struct tasklet *)t;
index 15309965ce355b6f64ff272a1293d46465338c5d..4191ee6a8c06298e4268933d51971953814ad81e 100644 (file)
@@ -53,8 +53,10 @@ static void mux_pt_destroy(struct mux_pt_ctx *ctx)
        }
 }
 
-/* Callback, used when we get I/Os while in idle mode */
-static struct task *mux_pt_io_cb(struct task *t, void *tctx, unsigned short status)
+/* Callback, used when we get I/Os while in idle mode. This one is exported so
+ * that "show fd" can resolve it.
+ */
+struct task *mux_pt_io_cb(struct task *t, void *tctx, unsigned short status)
 {
        struct mux_pt_ctx *ctx = tctx;
 
index f866bfd08fcbe7dcab3cfd184d227c5f3a1114d8..483662ec23e13244ff6881bd6c50a55c22f18e3f 100644 (file)
@@ -182,7 +182,8 @@ static struct stats_module ssl_stats_module = {
 
 INITCALL1(STG_REGISTER, stats_register_module, &ssl_stats_module);
 
-static struct task *ssl_sock_io_cb(struct task *, void *, unsigned short);
+/* ssl_sock_io_cb is exported to see it resolved in "show fd" */
+struct task *ssl_sock_io_cb(struct task *, void *, unsigned short);
 static int ssl_sock_handshake(struct connection *conn, unsigned int flag);
 
 /* Methods to implement OpenSSL BIO */
@@ -5578,7 +5579,7 @@ static int ssl_remove_xprt(struct connection *conn, void *xprt_ctx, void *toremo
        return (ctx->xprt->remove_xprt(conn, ctx->xprt_ctx, toremove_ctx, newops, newctx));
 }
 
-static struct task *ssl_sock_io_cb(struct task *t, void *context, unsigned short state)
+struct task *ssl_sock_io_cb(struct task *t, void *context, unsigned short state)
 {
        struct tasklet *tl = (struct tasklet *)t;
        struct ssl_sock_ctx *ctx = context;
index 752a4f3aec2e70c216cb14baaede3c6470f4dc94..15e2a8f8df557a88726f57cb450b92b9c2f45b31 100644 (file)
@@ -36,7 +36,8 @@ static size_t xprt_handshake_to_buf(struct connection *conn, void *xprt_ctx, str
        return 0;
 }
 
-static struct task *xprt_handshake_io_cb(struct task *t, void *bctx, unsigned short state)
+/* xprt_handshake_io_cb is exported to see it resolved in "show fd" */
+struct task *xprt_handshake_io_cb(struct task *t, void *bctx, unsigned short state)
 {
        struct xprt_handshake_ctx *ctx = bctx;
        struct connection *conn = ctx->conn;
index a690b2fa8fc6b652117641bd20eb7ca95bd84534..f8e807c1ec3d474beec33c671fd9d771059d5d8b 100644 (file)
@@ -3852,7 +3852,7 @@ int qc_prep_phdshk_pkts(struct quic_conn *qc)
 }
 
 /* QUIC connection packet handler task. */
-static struct task *quic_conn_io_cb(struct task *t, void *context, unsigned short state)
+struct task *quic_conn_io_cb(struct task *t, void *context, unsigned short state)
 {
        struct quic_conn_ctx *ctx = context;