From: Aurelien DARRAGON Date: Fri, 9 May 2025 08:42:49 +0000 (+0200) Subject: MINOR: counters: add common struct and flags to {fe,be}_counters_shared X-Git-Tag: v3.3-dev1~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c10ce1c85b3c77cf907e4e95c743208fd15f50ca;p=thirdparty%2Fhaproxy.git MINOR: counters: add common struct and flags to {fe,be}_counters_shared fe_counters_shared and be_counters_shared may share some common members since they are quite similar, so we add a common struct part shared between the two. struct counters_shared is added for convenience as a generic pointer to manipulate common members from fe or be shared counters pointer. Also, the first common member is added: shared fe and be counters now have a flags member. --- diff --git a/include/haproxy/counters-t.h b/include/haproxy/counters-t.h index a91d88e88..28f456ea4 100644 --- a/include/haproxy/counters-t.h +++ b/include/haproxy/counters-t.h @@ -25,8 +25,22 @@ #include +#define COUNTERS_SHARED_F_NONE 0x0000 + +// common to fe_counters_shared and be_counters_shared +#define COUNTERS_SHARED \ + struct { \ + uint16_t flags; /* COUNTERS_SHARED_F flags */\ + } + +// for convenience (generic pointer) +struct counters_shared { + COUNTERS_SHARED; +}; + /* counters used by listeners and frontends */ struct fe_counters_shared { + COUNTERS_SHARED; long long internal_errors; /* internal processing errors */ long long failed_rewrites; /* failed rewrites (warning) */ long long denied_sess; /* denied session requests (tcp-req-sess rules) */ @@ -86,6 +100,7 @@ struct fe_counters { }; struct be_counters_shared { + COUNTERS_SHARED; long long internal_errors; /* internal processing errors */ long long cum_lbconn; /* cumulated number of sessions processed by load balancing (BE only) */