]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: counters: rename counters_be_shared_init to counters_be_shared_prepare
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 29 Jul 2025 12:16:05 +0000 (14:16 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 29 Jul 2025 16:00:13 +0000 (18:00 +0200)
75e480d10 ("MEDIUM: stats: avoid 1 indirection by storing the shared
stats directly in counters struct") took care of renaming
counters_fe_shared_init() but we forgot counters_be_shared_init().

Let's fix that for consistency

include/haproxy/counters.h
src/counters.c
src/proxy.c
src/server.c

index 3e8f4cfb09cb56b8cf7b21ca37163878792382bc..803e8ec41dc633df4315bbfaf9877f71eb02f8f9 100644 (file)
@@ -28,7 +28,7 @@
 #include <haproxy/guid-t.h>
 
 int counters_fe_shared_prepare(struct fe_counters_shared *counters, const struct guid_node *guid);
-int counters_be_shared_init(struct be_counters_shared *counters, const struct guid_node *guid);
+int counters_be_shared_prepare(struct be_counters_shared *counters, const struct guid_node *guid);
 
 void counters_fe_shared_drop(struct fe_counters_shared *counters);
 void counters_be_shared_drop(struct be_counters_shared *counters);
index f9d583a72c652baaefd19470468b0f5c124167d3..a7a1a864d5cf0d8b115ee5fdc9d9a09fece0dfc8 100644 (file)
@@ -52,12 +52,12 @@ void counters_be_shared_drop(struct be_counters_shared *counters)
        _counters_shared_drop(counters);
 }
 
-/* retrieved shared counters pointer for a given <guid> object
+/* prepare shared counters pointer for a given <guid> object
  * <size> hint is expected to reflect the actual tg member size (fe/be)
  * if <guid> is not set, then sharing is disabled
  * Returns the pointer on success or NULL on failure
  */
-static int _counters_shared_init(struct counters_shared *shared, const struct guid_node *guid, size_t size)
+static int _counters_shared_prepare(struct counters_shared *shared, const struct guid_node *guid, size_t size)
 {
        int it = 0;
 
@@ -85,11 +85,11 @@ static int _counters_shared_init(struct counters_shared *shared, const struct gu
 /* prepare shared fe counters pointer for a given <guid> object */
 int counters_fe_shared_prepare(struct fe_counters_shared *shared, const struct guid_node *guid)
 {
-       return _counters_shared_init((struct counters_shared *)shared, guid, sizeof(struct fe_counters_shared_tg));
+       return _counters_shared_prepare((struct counters_shared *)shared, guid, sizeof(struct fe_counters_shared_tg));
 }
 
 /* prepare shared be counters pointer for a given <guid> object */
-int counters_be_shared_init(struct be_counters_shared *shared, const struct guid_node *guid)
+int counters_be_shared_prepare(struct be_counters_shared *shared, const struct guid_node *guid)
 {
-       return _counters_shared_init((struct counters_shared *)shared, guid, sizeof(struct be_counters_shared_tg));
+       return _counters_shared_prepare((struct counters_shared *)shared, guid, sizeof(struct be_counters_shared_tg));
 }
index b2d1f07b1da3a0afceb13d6943b0c0d91ce88d34..e4587137215feae61ef99591e179645ede7fc872 100644 (file)
@@ -1768,7 +1768,7 @@ static int proxy_postcheck(struct proxy *px)
                 * be_counters may be used even if the proxy lacks the backend
                 * capability
                 */
-               if (!counters_be_shared_init(&px->be_counters.shared, &px->guid)) {
+               if (!counters_be_shared_prepare(&px->be_counters.shared, &px->guid)) {
                        ha_alert("out of memory while setting up shared counters for %s %s\n",
                                 proxy_type_str(px), px->id);
                        err_code |= ERR_ALERT | ERR_FATAL;
index 5b2206d5b34f43ebfd3537c9caed9c6343cbbd78..e53d4847cba790b56854ecbf9ac87bd33d2d6f7c 100644 (file)
@@ -3450,7 +3450,7 @@ int srv_init(struct server *srv)
        if (err_code & ERR_CODE)
                goto out;
 
-       if (!counters_be_shared_init(&srv->counters.shared, &srv->guid)) {
+       if (!counters_be_shared_prepare(&srv->counters.shared, &srv->guid)) {
                ha_alert("memory error while setting up shared counters for %s/%s server\n", srv->proxy->id, srv->id);
                err_code |= ERR_ALERT | ERR_FATAL;
                goto out;