]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: applet: mark the CLI's generic variables as deprecated
authorWilly Tarreau <w@1wt.eu>
Thu, 5 May 2022 17:43:49 +0000 (19:43 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 6 May 2022 16:13:36 +0000 (18:13 +0200)
The generic context variables p0/p1/p2, i0/i1, o0/o1 have been abused
and causing trouble for too long, it's time to remove them now that
they are not used anymore.

However the risk that external code still uses them is not nul and we
had not warned before about their removal. Let's mark them deprecated
in 2.6 and removed in 2.7. This will let external code continue to work
(as well as it could if it misuses them), with a strong encouragement
on updating it.

If you found this commit after a bisect session you initiated to figure
why you got some build warnings and don't know what to do, have a look
at the code that deals with the "show fd", "show env" or "show servers"
commands, as it's supposed to be self-explanatory about the tiny changes
to apply to your code to port it. If you find APPLET_MAX_SVCCTX to be
too small for your use case, either kindly ask for a tiny extension
(and try to get your code merged), or just use a pool.

include/haproxy/applet-t.h

index ccedad0d60257b55bba6abe2e02dbd7d1b6026ad..af9560ad67ec11219bd62b1d52832c99fafa34fc 100644 (file)
@@ -115,9 +115,14 @@ struct appctx {
                                const char *msg;        /* pointer to a persistent message to be returned in CLI_ST_PRINT state */
                                int severity;           /* severity of the message to be returned according to (syslog) rfc5424 */
                                char *err;              /* pointer to a 'must free' message to be returned in CLI_ST_PRINT_FREE state */
-                               void *p0, *p1, *p2;     /* ...registered commands, initialized to 0 by the CLI before first... */
-                               size_t o0, o1;          /* ...invocation of the keyword parser, except for the list element which... */
-                               int i0, i1;             /* ...is initialized with LIST_INIT(). */
+                               /* WARNING: the entries below are only kept for compatibility
+                                * with possible external code but will disappear in 2.7, you
+                                * must use the cleaner svcctx now (look at "show fd" for an
+                                * example).
+                                */
+                                __attribute__((deprecated)) void *p0, *p1, *p2;
+                                __attribute__((deprecated)) size_t o0, o1;
+                                __attribute__((deprecated)) int i0, i1;
                        } cli;                          /* context used by the CLI */
                        struct {
                                struct cache_entry *entry;  /* Entry to be sent from cache. */