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
This commit is contained in:
Aurelien DARRAGON 2025-07-29 14:16:05 +02:00
parent 2ffe515d97
commit 713ebd2750
4 changed files with 8 additions and 8 deletions

View 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);

View 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));
}

View 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;

View 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;