]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stconn: Totally app_ops from the stconns
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 5 Mar 2026 20:06:37 +0000 (21:06 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 10 Mar 2026 14:10:34 +0000 (15:10 +0100)
The stconn app_ops structure is now empty and can be safely removed. So let's do
so.

include/haproxy/stconn-t.h
include/haproxy/stconn.h
src/stconn.c
src/stream.c

index dea02cdc52036a554509ec1d7cf45657311a1aa1..02cf9840f04f306fe917d6d81cd3c59ee0f92870 100644 (file)
@@ -349,14 +349,6 @@ struct sedesc {
        unsigned long long kop;    /* Known outgoing payload length (see above) */
 };
 
-/* sc_app_ops describes the application layer's operations and notification
- * callbacks when I/O activity is reported and to use to perform shutr/shutw.
- * There are very few combinations in practice (strm/chk <-> none/mux/applet).
- */
-struct sc_app_ops {
-       char name[8];                        /* data layer name, zero-terminated */
-};
-
 /*
  * This structure describes the elements of a connection relevant to a stream
  */
@@ -378,7 +370,6 @@ struct stconn {
        struct wait_event wait_event;        /* We're in a wait list */
        struct sedesc *sedesc;               /* points to the stream endpoint descriptor */
        enum obj_type *app;                  /* points to the applicative point (stream or check) */
-       const struct sc_app_ops *app_ops;    /* general operations used at the app layer */
        struct sockaddr_storage *src;        /* source address (pool), when known, otherwise NULL */
        struct sockaddr_storage *dst;        /* destination address (pool), when known, otherwise NULL */
 };
index 9a223a8d573712afa70c00b432c3c166e4f28851..23cb2e5e355bd22bfc7c73a6342bb16fdde87f55 100644 (file)
@@ -351,16 +351,6 @@ static inline struct hstream *sc_hstream(const struct stconn *sc)
        return NULL;
 }
 
-/* Returns the name of the application layer's name for the stconn,
- * or "NONE" when none is attached.
- */
-static inline const char *sc_get_data_name(const struct stconn *sc)
-{
-       if (!sc->app_ops)
-               return "NONE";
-       return sc->app_ops->name;
-}
-
 /* Returns non-zero if the stream connector's Rx path is blocked because of
  * lack of room in the input buffer. This usually happens after applets failed
  * to deliver data into the channel's buffer and reported it via sc_need_room().
index eea124d330bc89d769653b2440732c6a64445020..edbd7f06413d1f4bbe51bc19936b4372e27f2738 100644 (file)
@@ -32,30 +32,6 @@ DECLARE_TYPED_POOL(pool_head_sedesc, "sedesc", struct sedesc);
 static int sc_conn_recv(struct stconn *sc);
 static int sc_conn_send(struct stconn *sc);
 
-/* stream connector operations for connections */
-struct sc_app_ops sc_app_conn_ops = {
-       .name    = "STRM",
-};
-
-/* stream connector operations for embedded tasks */
-struct sc_app_ops sc_app_embedded_ops = {
-       .name    = "NONE", /* may never be used */
-};
-
-/* stream connector operations for applets */
-struct sc_app_ops sc_app_applet_ops = {
-       .name    = "STRM",
-};
-
-/* stream connector for health checks on connections */
-struct sc_app_ops sc_app_check_ops = {
-       .name    = "CHCK",
-};
-
-struct sc_app_ops sc_app_hstream_ops = {
-       .name    = "HTERM",
-};
-
 /* Initializes an endpoint */
 void sedesc_init(struct sedesc *sedesc)
 {
@@ -107,7 +83,7 @@ void sedesc_free(struct sedesc *sedesc)
 /* Performs a shutdown on the endpoint. This function deals with connection and
  * applet endpoints. It is responsible to set SE flags corresponding to the
  * given shut modes and to call right shutdown functions of the endpoint. It is
- * called from the .abort and .shut app_ops callback functions at the SC level.
+ * called from the sc_abort and sc_shutdown functions at the SC level.
  */
 void se_shutdown(struct sedesc *sedesc, enum se_shut_mode mode)
 {
@@ -173,7 +149,6 @@ static struct stconn *sc_new(struct sedesc *sedesc)
        sc->ioto = TICK_ETERNITY;
        sc->room_needed = 0;
        sc->app = NULL;
-       sc->app_ops = NULL;
        sc->src = NULL;
        sc->dst = NULL;
        sc->bytes_in = sc->bytes_out = 0;
@@ -237,7 +212,6 @@ struct stconn *sc_new_from_strm(struct stream *strm, unsigned int flags)
        sc->flags |= flags;
        sc_ep_set(sc, SE_FL_DETACHED);
        sc->app = &strm->obj_type;
-       sc->app_ops = &sc_app_embedded_ops;
        return sc;
 }
 
@@ -255,7 +229,6 @@ struct stconn *sc_new_from_check(struct check *check, unsigned int flags)
        sc->flags |= flags;
        sc_ep_set(sc, SE_FL_DETACHED);
        sc->app = &check->obj_type;
-       sc->app_ops = &sc_app_check_ops;
        return sc;
 }
 
@@ -308,7 +281,6 @@ int sc_attach_mux(struct stconn *sc, void *sd, void *ctx)
                        sc->wait_event.events = 0;
                }
 
-               sc->app_ops = &sc_app_conn_ops;
                xref_create(&sc->sedesc->xref, &sc_opposite(sc)->sedesc->xref);
        }
        else if (sc_check(sc)) {
@@ -320,8 +292,6 @@ int sc_attach_mux(struct stconn *sc, void *sd, void *ctx)
                        sc->wait_event.tasklet->context = sc;
                        sc->wait_event.events = 0;
                }
-
-               sc->app_ops = &sc_app_check_ops;
        }
 
        sedesc->se = sd;
@@ -343,10 +313,8 @@ static int sc_attach_applet(struct stconn *sc, struct appctx *appctx)
        sc->sedesc->se = appctx;
        sc_ep_set(sc, SE_FL_T_APPLET);
        sc_ep_clr(sc, SE_FL_DETACHED);
-       if (sc_strm(sc)) {
-               sc->app_ops = &sc_app_applet_ops;
+       if (sc_strm(sc))
                xref_create(&sc->sedesc->xref, &sc_opposite(sc)->sedesc->xref);
-       }
 
        return 0;
 }
@@ -368,14 +336,6 @@ int sc_attach_strm(struct stconn *sc, struct stream *strm)
                sc->wait_event.tasklet->process = sc_conn_io_cb;
                sc->wait_event.tasklet->context = sc;
                sc->wait_event.events = 0;
-
-               sc->app_ops = &sc_app_conn_ops;
-       }
-       else if (sc_ep_test(sc, SE_FL_T_APPLET)) {
-               sc->app_ops = &sc_app_applet_ops;
-       }
-       else {
-               sc->app_ops = &sc_app_embedded_ops;
        }
        return 0;
 }
@@ -399,8 +359,6 @@ int sc_attach_hstream(struct stconn *sc, struct hstream *hs)
        sc->wait_event.tasklet->process = sc_hstream_io_cb;
        sc->wait_event.tasklet->context = sc;
        sc->wait_event.events = 0;
-
-       sc->app_ops = &sc_app_hstream_ops;
        return 0;
 }
 
@@ -470,10 +428,6 @@ static void sc_detach_endp(struct stconn **scp)
         *        connection related for now but this will evolved
         */
        sc->flags &= SC_FL_ISBACK;
-       if (sc_strm(sc))
-               sc->app_ops = &sc_app_embedded_ops;
-       else
-               sc->app_ops = NULL;
        sc_free_cond(scp);
 }
 
@@ -488,7 +442,6 @@ static void sc_detach_app(struct stconn **scp)
                return;
 
        sc->app = NULL;
-       sc->app_ops = NULL;
        sockaddr_free(&sc->src);
        sockaddr_free(&sc->dst);
 
index daf2fc3b1aa8b321cee57361ca4c38828a172a68..68aff8c26d93575f1003667840fc5d4adc48a367 100644 (file)
@@ -3670,12 +3670,11 @@ static void __strm_dump_to_buffer(struct buffer *buf, const struct show_sess_ctx
                }
 
                chunk_appendf(buf,
-                             "%s      co0=%p ctrl=%s xprt=%s mux=%s data=%s target=%s:%p\n", pfx,
+                             "%s      co0=%p ctrl=%s xprt=%s mux=%s target=%s:%p\n", pfx,
                              conn,
                              conn_get_ctrl_name(conn),
                              conn_get_xprt_name(conn),
                              conn_get_mux_name(conn),
-                             sc_get_data_name(scf),
                              obj_type_name(conn->target),
                              obj_base_ptr(conn->target));
 
@@ -3732,12 +3731,11 @@ static void __strm_dump_to_buffer(struct buffer *buf, const struct show_sess_ctx
                }
 
                chunk_appendf(buf,
-                             "%s      co1=%p ctrl=%s xprt=%s mux=%s data=%s target=%s:%p\n", pfx,
+                             "%s      co1=%p ctrl=%s xprt=%s mux=%s target=%s:%p\n", pfx,
                              conn,
                              conn_get_ctrl_name(conn),
                              conn_get_xprt_name(conn),
                              conn_get_mux_name(conn),
-                             sc_get_data_name(scb),
                              obj_type_name(conn->target),
                              obj_base_ptr(conn->target));