From: Aurelien DARRAGON Date: Tue, 29 Jul 2025 12:16:05 +0000 (+0200) Subject: CLEANUP: counters: rename counters_be_shared_init to counters_be_shared_prepare X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=713ebd2750928c0692e0834049800737716831a1;p=thirdparty%2Fhaproxy.git CLEANUP: counters: rename counters_be_shared_init to counters_be_shared_prepare 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 --- diff --git a/include/haproxy/counters.h b/include/haproxy/counters.h index 3e8f4cfb0..803e8ec41 100644 --- a/include/haproxy/counters.h +++ b/include/haproxy/counters.h @@ -28,7 +28,7 @@ #include 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); diff --git a/src/counters.c b/src/counters.c index f9d583a72..a7a1a864d 100644 --- a/src/counters.c +++ b/src/counters.c @@ -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 object +/* prepare shared counters pointer for a given object * hint is expected to reflect the actual tg member size (fe/be) * if 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 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 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)); } diff --git a/src/proxy.c b/src/proxy.c index b2d1f07b1..e45871372 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -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; diff --git a/src/server.c b/src/server.c index 5b2206d5b..e53d4847c 100644 --- a/src/server.c +++ b/src/server.c @@ -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;