From cd098b06db263cfb337d4b8eaf2724df66fff060 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Fri, 20 Nov 2020 14:00:36 -0500
Subject: [PATCH 1/9] Fix: libs, tools: Be consistent with GListPtr and
xmlNodePtr in formatted output.
GListPtr should be removed from all the formatted output messages. It
seems like a GLib type, but it's not. So that's weird and we should
stop spreading uses of it around.
On the other hand, xmlNodePtr is a libxml type that we are already using
sporadically. We should be more consistent in using it.
---
lib/fencing/st_output.c | 20 ++++++------
lib/pacemaker/pcmk_output.c | 36 ++++++++++-----------
lib/pengine/bundle.c | 18 +++++------
lib/pengine/clone.c | 44 +++++++++++++-------------
lib/pengine/group.c | 28 ++++++++---------
lib/pengine/native.c | 20 ++++++------
lib/pengine/pe_output.c | 76 ++++++++++++++++++++++-----------------------
tools/crm_resource_print.c | 64 +++++++++++++++++++-------------------
8 files changed, 153 insertions(+), 153 deletions(-)
diff --git a/lib/fencing/st_output.c b/lib/fencing/st_output.c
index 04f4b83..7c3ccef 100644
--- a/lib/fencing/st_output.c
+++ b/lib/fencing/st_output.c
@@ -30,11 +30,11 @@ time_t_string(time_t when) {
return buf;
}
-PCMK__OUTPUT_ARGS("failed-fencing-history", "stonith_history_t *", "GListPtr", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("failed-fencing-history", "stonith_history_t *", "GList *", "gboolean", "gboolean")
int
stonith__failed_history(pcmk__output_t *out, va_list args) {
stonith_history_t *history = va_arg(args, stonith_history_t *);
- GListPtr only_node = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
gboolean full_history = va_arg(args, gboolean);
gboolean print_spacer = va_arg(args, gboolean);
@@ -58,11 +58,11 @@ stonith__failed_history(pcmk__output_t *out, va_list args) {
return rc;
}
-PCMK__OUTPUT_ARGS("fencing-history", "stonith_history_t *", "GListPtr", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("fencing-history", "stonith_history_t *", "GList *", "gboolean", "gboolean")
int
stonith__history(pcmk__output_t *out, va_list args) {
stonith_history_t *history = va_arg(args, stonith_history_t *);
- GListPtr only_node = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
gboolean full_history = va_arg(args, gboolean);
gboolean print_spacer = va_arg(args, gboolean);
@@ -84,12 +84,12 @@ stonith__history(pcmk__output_t *out, va_list args) {
return rc;
}
-PCMK__OUTPUT_ARGS("full-fencing-history", "crm_exit_t", "stonith_history_t *", "GListPtr", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("full-fencing-history", "crm_exit_t", "stonith_history_t *", "GList *", "gboolean", "gboolean")
int
stonith__full_history(pcmk__output_t *out, va_list args) {
crm_exit_t history_rc G_GNUC_UNUSED = va_arg(args, crm_exit_t);
stonith_history_t *history = va_arg(args, stonith_history_t *);
- GListPtr only_node = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
gboolean full_history = va_arg(args, gboolean);
gboolean print_spacer = va_arg(args, gboolean);
@@ -109,12 +109,12 @@ stonith__full_history(pcmk__output_t *out, va_list args) {
return rc;
}
-PCMK__OUTPUT_ARGS("full-fencing-history", "crm_exit_t", "stonith_history_t *", "GListPtr", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("full-fencing-history", "crm_exit_t", "stonith_history_t *", "GList *", "gboolean", "gboolean")
int
stonith__full_history_xml(pcmk__output_t *out, va_list args) {
crm_exit_t history_rc = va_arg(args, crm_exit_t);
stonith_history_t *history = va_arg(args, stonith_history_t *);
- GListPtr only_node = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
gboolean full_history = va_arg(args, gboolean);
gboolean print_spacer G_GNUC_UNUSED = va_arg(args, gboolean);
@@ -198,11 +198,11 @@ stonith__last_fenced_xml(pcmk__output_t *out, va_list args) {
}
}
-PCMK__OUTPUT_ARGS("pending-fencing-actions", "stonith_history_t *", "GListPtr", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("pending-fencing-actions", "stonith_history_t *", "GList *", "gboolean", "gboolean")
int
stonith__pending_actions(pcmk__output_t *out, va_list args) {
stonith_history_t *history = va_arg(args, stonith_history_t *);
- GListPtr only_node = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
gboolean full_history = va_arg(args, gboolean);
gboolean print_spacer = va_arg(args, gboolean);
diff --git a/lib/pacemaker/pcmk_output.c b/lib/pacemaker/pcmk_output.c
index 74a7c59..a0b12b9 100644
--- a/lib/pacemaker/pcmk_output.c
+++ b/lib/pacemaker/pcmk_output.c
@@ -53,8 +53,8 @@ static int colocations_list(pcmk__output_t *out, va_list args) {
gboolean dependents = va_arg(args, gboolean);
gboolean recursive = va_arg(args, gboolean);
- GListPtr lpc = NULL;
- GListPtr list = rsc->rsc_cons;
+ GList *lpc = NULL;
+ GList *list = rsc->rsc_cons;
bool printed_header = false;
if (dependents) {
@@ -133,8 +133,8 @@ static int colocations_list_xml(pcmk__output_t *out, va_list args) {
gboolean dependents = va_arg(args, gboolean);
gboolean recursive = va_arg(args, gboolean);
- GListPtr lpc = NULL;
- GListPtr list = rsc->rsc_cons;
+ GList *lpc = NULL;
+ GList *list = rsc->rsc_cons;
bool printed_header = false;
if (dependents) {
@@ -220,15 +220,15 @@ PCMK__OUTPUT_ARGS("locations-list", "pe_resource_t *")
static int locations_list(pcmk__output_t *out, va_list args) {
pe_resource_t *rsc G_GNUC_UNUSED = va_arg(args, pe_resource_t *);
- GListPtr lpc = NULL;
- GListPtr list = rsc->rsc_location;
+ GList *lpc = NULL;
+ GList *list = rsc->rsc_location;
out->begin_list(out, NULL, NULL, "Locations");
for (lpc = list; lpc != NULL; lpc = lpc->next) {
pe__location_t *cons = lpc->data;
- GListPtr lpc2 = NULL;
+ GList *lpc2 = NULL;
for (lpc2 = cons->node_list_rh; lpc2 != NULL; lpc2 = lpc2->next) {
pe_node_t *node = (pe_node_t *) lpc2->data;
@@ -249,15 +249,15 @@ PCMK__OUTPUT_ARGS("locations-list", "pe_resource_t *")
static int locations_list_xml(pcmk__output_t *out, va_list args) {
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr lpc = NULL;
- GListPtr list = rsc->rsc_location;
+ GList *lpc = NULL;
+ GList *list = rsc->rsc_location;
pcmk__output_xml_create_parent(out, "locations", NULL);
for (lpc = list; lpc != NULL; lpc = lpc->next) {
pe__location_t *cons = lpc->data;
- GListPtr lpc2 = NULL;
+ GList *lpc2 = NULL;
for (lpc2 = cons->node_list_rh; lpc2 != NULL; lpc2 = lpc2->next) {
pe_node_t *node = (pe_node_t *) lpc2->data;
@@ -284,9 +284,9 @@ stacks_and_constraints(pcmk__output_t *out, va_list args) {
pe_working_set_t *data_set G_GNUC_UNUSED = va_arg(args, pe_working_set_t *);
gboolean recursive G_GNUC_UNUSED = va_arg(args, gboolean);
- GListPtr lpc = NULL;
- xmlNode *cib_constraints = get_object_root(XML_CIB_TAG_CONSTRAINTS,
- data_set->input);
+ GList *lpc = NULL;
+ xmlNodePtr cib_constraints = get_object_root(XML_CIB_TAG_CONSTRAINTS,
+ data_set->input);
unpack_constraints(cib_constraints, data_set);
@@ -322,9 +322,9 @@ stacks_and_constraints_xml(pcmk__output_t *out, va_list args) {
pe_working_set_t *data_set = va_arg(args, pe_working_set_t *);
gboolean recursive = va_arg(args, gboolean);
- GListPtr lpc = NULL;
- xmlNode *cib_constraints = get_object_root(XML_CIB_TAG_CONSTRAINTS,
- data_set->input);
+ GList *lpc = NULL;
+ xmlNodePtr cib_constraints = get_object_root(XML_CIB_TAG_CONSTRAINTS,
+ data_set->input);
unpack_constraints(cib_constraints, data_set);
@@ -455,11 +455,11 @@ dc_xml(pcmk__output_t *out, va_list args)
}
-PCMK__OUTPUT_ARGS("crmadmin-node-list", "pcmk__output_t *", "xmlNode *")
+PCMK__OUTPUT_ARGS("crmadmin-node-list", "pcmk__output_t *", "xmlNodePtr")
static int
crmadmin_node_list(pcmk__output_t *out, va_list args)
{
- xmlNode *xml_node = va_arg(args, xmlNode *);
+ xmlNodePtr xml_node = va_arg(args, xmlNodePtr);
int found = 0;
xmlNode *node = NULL;
xmlNode *nodes = get_object_root(XML_CIB_TAG_NODES, xml_node);
diff --git a/lib/pengine/bundle.c b/lib/pengine/bundle.c
index 543f5dc..7a175a5 100644
--- a/lib/pengine/bundle.c
+++ b/lib/pengine/bundle.c
@@ -1485,14 +1485,14 @@ bundle_print_xml(pe_resource_t *rsc, const char *pre_text, long options,
free(child_text);
}
-PCMK__OUTPUT_ARGS("bundle", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr")
+PCMK__OUTPUT_ARGS("bundle", "unsigned int", "pe_resource_t *", "GList *", "GList *")
int
pe__bundle_xml(pcmk__output_t *out, va_list args)
{
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
pe__bundle_variant_data_t *bundle_data = NULL;
int rc = pcmk_rc_no_output;
@@ -1608,14 +1608,14 @@ pe__bundle_replica_output_html(pcmk__output_t *out, pe__bundle_replica_t *replic
pe__common_output_html(out, rsc, buffer, node, options);
}
-PCMK__OUTPUT_ARGS("bundle", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr")
+PCMK__OUTPUT_ARGS("bundle", "unsigned int", "pe_resource_t *", "GList *", "GList *")
int
pe__bundle_html(pcmk__output_t *out, va_list args)
{
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
pe__bundle_variant_data_t *bundle_data = NULL;
char buffer[LINE_MAX];
@@ -1750,14 +1750,14 @@ pe__bundle_replica_output_text(pcmk__output_t *out, pe__bundle_replica_t *replic
pe__common_output_text(out, rsc, buffer, node, options);
}
-PCMK__OUTPUT_ARGS("bundle", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr")
+PCMK__OUTPUT_ARGS("bundle", "unsigned int", "pe_resource_t *", "GList *", "GList *")
int
pe__bundle_text(pcmk__output_t *out, va_list args)
{
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
pe__bundle_variant_data_t *bundle_data = NULL;
int rc = pcmk_rc_no_output;
diff --git a/lib/pengine/clone.c b/lib/pengine/clone.c
index 0708fdc..9b48d01 100644
--- a/lib/pengine/clone.c
+++ b/lib/pengine/clone.c
@@ -577,16 +577,16 @@ clone_print(pe_resource_t * rsc, const char *pre_text, long options, void *print
free(child_text);
}
-PCMK__OUTPUT_ARGS("clone", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr")
+PCMK__OUTPUT_ARGS("clone", "unsigned int", "pe_resource_t *", "GList *", "GList *")
int
pe__clone_xml(pcmk__output_t *out, va_list args)
{
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
- GListPtr gIter = rsc->children;
+ GList *gIter = rsc->children;
int rc = pcmk_rc_no_output;
gboolean printed_header = FALSE;
gboolean print_everything = TRUE;
@@ -635,23 +635,23 @@ pe__clone_xml(pcmk__output_t *out, va_list args)
return rc;
}
-PCMK__OUTPUT_ARGS("clone", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr")
+PCMK__OUTPUT_ARGS("clone", "unsigned int", "pe_resource_t *", "GList *", "GList *")
int
pe__clone_html(pcmk__output_t *out, va_list args)
{
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
char *list_text = NULL;
char *stopped_list = NULL;
size_t list_text_len = 0;
size_t stopped_list_len = 0;
- GListPtr master_list = NULL;
- GListPtr started_list = NULL;
- GListPtr gIter = rsc->children;
+ GList *master_list = NULL;
+ GList *started_list = NULL;
+ GList *gIter = rsc->children;
clone_variant_data_t *clone_data = NULL;
int active_instances = 0;
@@ -751,7 +751,7 @@ pe__clone_html(pcmk__output_t *out, va_list args)
}
if (print_full) {
- GListPtr all = NULL;
+ GList *all = NULL;
/* Print every resource that's a child of this clone. */
all = g_list_prepend(all, strdup("*"));
@@ -832,8 +832,8 @@ pe__clone_html(pcmk__output_t *out, va_list args)
if (!pcmk_is_set(rsc->flags, pe_rsc_unique)
&& (clone_data->clone_max > active_instances)) {
- GListPtr nIter;
- GListPtr list = g_hash_table_get_values(rsc->allowed_nodes);
+ GList *nIter;
+ GList *list = g_hash_table_get_values(rsc->allowed_nodes);
/* Custom stopped list for non-unique clones */
free(stopped_list);
@@ -872,23 +872,23 @@ pe__clone_html(pcmk__output_t *out, va_list args)
return rc;
}
-PCMK__OUTPUT_ARGS("clone", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr")
+PCMK__OUTPUT_ARGS("clone", "unsigned int", "pe_resource_t *", "GList *", "GList *")
int
pe__clone_text(pcmk__output_t *out, va_list args)
{
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
char *list_text = NULL;
char *stopped_list = NULL;
size_t list_text_len = 0;
size_t stopped_list_len = 0;
- GListPtr master_list = NULL;
- GListPtr started_list = NULL;
- GListPtr gIter = rsc->children;
+ GList *master_list = NULL;
+ GList *started_list = NULL;
+ GList *gIter = rsc->children;
clone_variant_data_t *clone_data = NULL;
int active_instances = 0;
@@ -988,7 +988,7 @@ pe__clone_text(pcmk__output_t *out, va_list args)
}
if (print_full) {
- GListPtr all = NULL;
+ GList *all = NULL;
/* Print every resource that's a child of this clone. */
all = g_list_prepend(all, strdup("*"));
@@ -1067,8 +1067,8 @@ pe__clone_text(pcmk__output_t *out, va_list args)
if (!pcmk_is_set(rsc->flags, pe_rsc_unique)
&& (clone_data->clone_max > active_instances)) {
- GListPtr nIter;
- GListPtr list = g_hash_table_get_values(rsc->allowed_nodes);
+ GList *nIter;
+ GList *list = g_hash_table_get_values(rsc->allowed_nodes);
/* Custom stopped list for non-unique clones */
free(stopped_list);
diff --git a/lib/pengine/group.c b/lib/pengine/group.c
index 33aa177..58c9f7c 100644
--- a/lib/pengine/group.c
+++ b/lib/pengine/group.c
@@ -180,16 +180,16 @@ group_print(pe_resource_t * rsc, const char *pre_text, long options, void *print
free(child_text);
}
-PCMK__OUTPUT_ARGS("group", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr")
+PCMK__OUTPUT_ARGS("group", "unsigned int", "pe_resource_t *", "GList *", "GList *")
int
pe__group_xml(pcmk__output_t *out, va_list args)
{
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
- GListPtr gIter = rsc->children;
+ GList *gIter = rsc->children;
char *count = crm_itoa(g_list_length(gIter));
int rc = pcmk_rc_no_output;
@@ -231,14 +231,14 @@ pe__group_xml(pcmk__output_t *out, va_list args)
return rc;
}
-PCMK__OUTPUT_ARGS("group", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr")
+PCMK__OUTPUT_ARGS("group", "unsigned int", "pe_resource_t *", "GList *", "GList *")
int
pe__group_html(pcmk__output_t *out, va_list args)
{
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
int rc = pcmk_rc_no_output;
gboolean print_everything = TRUE;
@@ -251,7 +251,7 @@ pe__group_html(pcmk__output_t *out, va_list args)
(strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id));
if (options & pe_print_brief) {
- GListPtr rscs = pe__filter_rsc_list(rsc->children, only_rsc);
+ GList *rscs = pe__filter_rsc_list(rsc->children, only_rsc);
if (rscs != NULL) {
out->begin_list(out, NULL, NULL, "Resource Group: %s%s%s", rsc->id,
@@ -265,7 +265,7 @@ pe__group_html(pcmk__output_t *out, va_list args)
}
} else {
- for (GListPtr gIter = rsc->children; gIter; gIter = gIter->next) {
+ for (GList *gIter = rsc->children; gIter; gIter = gIter->next) {
pe_resource_t *child_rsc = (pe_resource_t *) gIter->data;
if (child_rsc->fns->is_filtered(child_rsc, only_rsc, print_everything)) {
@@ -286,14 +286,14 @@ pe__group_html(pcmk__output_t *out, va_list args)
return rc;
}
-PCMK__OUTPUT_ARGS("group", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr")
+PCMK__OUTPUT_ARGS("group", "unsigned int", "pe_resource_t *", "GList *", "GList *")
int
pe__group_text(pcmk__output_t *out, va_list args)
{
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
int rc = pcmk_rc_no_output;
gboolean print_everything = TRUE;
@@ -306,7 +306,7 @@ pe__group_text(pcmk__output_t *out, va_list args)
(strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id));
if (options & pe_print_brief) {
- GListPtr rscs = pe__filter_rsc_list(rsc->children, only_rsc);
+ GList *rscs = pe__filter_rsc_list(rsc->children, only_rsc);
if (rscs != NULL) {
out->begin_list(out, NULL, NULL, "Resource Group: %s%s%s", rsc->id,
@@ -320,7 +320,7 @@ pe__group_text(pcmk__output_t *out, va_list args)
}
} else {
- for (GListPtr gIter = rsc->children; gIter; gIter = gIter->next) {
+ for (GList *gIter = rsc->children; gIter; gIter = gIter->next) {
pe_resource_t *child_rsc = (pe_resource_t *) gIter->data;
if (child_rsc->fns->is_filtered(child_rsc, only_rsc, print_everything)) {
diff --git a/lib/pengine/native.c b/lib/pengine/native.c
index 38e9350..6f27d7b 100644
--- a/lib/pengine/native.c
+++ b/lib/pengine/native.c
@@ -920,14 +920,14 @@ native_print(pe_resource_t * rsc, const char *pre_text, long options, void *prin
common_print(rsc, pre_text, rsc_printable_id(rsc), node, options, print_data);
}
-PCMK__OUTPUT_ARGS("primitive", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr")
+PCMK__OUTPUT_ARGS("primitive", "unsigned int", "pe_resource_t *", "GList *", "GList *")
int
pe__resource_xml(pcmk__output_t *out, va_list args)
{
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr only_node G_GNUC_UNUSED = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node G_GNUC_UNUSED = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS);
const char *prov = crm_element_value(rsc->xml, XML_AGENT_ATTR_PROVIDER);
@@ -977,7 +977,7 @@ pe__resource_xml(pcmk__output_t *out, va_list args)
CRM_ASSERT(rc == pcmk_rc_ok);
if (rsc->running_on != NULL) {
- GListPtr gIter = rsc->running_on;
+ GList *gIter = rsc->running_on;
for (; gIter != NULL; gIter = gIter->next) {
pe_node_t *node = (pe_node_t *) gIter->data;
@@ -994,14 +994,14 @@ pe__resource_xml(pcmk__output_t *out, va_list args)
return rc;
}
-PCMK__OUTPUT_ARGS("primitive", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr")
+PCMK__OUTPUT_ARGS("primitive", "unsigned int", "pe_resource_t *", "GList *", "GList *")
int
pe__resource_html(pcmk__output_t *out, va_list args)
{
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr only_node G_GNUC_UNUSED = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node G_GNUC_UNUSED = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
pe_node_t *node = pe__current_node(rsc);
@@ -1018,14 +1018,14 @@ pe__resource_html(pcmk__output_t *out, va_list args)
return pe__common_output_html(out, rsc, rsc_printable_id(rsc), node, options);
}
-PCMK__OUTPUT_ARGS("primitive", "unsigned int", "pe_resource_t *", "GListPtr", "GListPtr")
+PCMK__OUTPUT_ARGS("primitive", "unsigned int", "pe_resource_t *", "GList *", "GList *")
int
pe__resource_text(pcmk__output_t *out, va_list args)
{
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
- GListPtr only_node G_GNUC_UNUSED = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node G_GNUC_UNUSED = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
pe_node_t *node = pe__current_node(rsc);
diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c
index ecb5c2c..3d2fc24 100644
--- a/lib/pengine/pe_output.c
+++ b/lib/pengine/pe_output.c
@@ -1013,7 +1013,7 @@ pe__failed_action_xml(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("node", "pe_node_t *", "unsigned int", "gboolean", "const char *",
- "gboolean", "gboolean", "gboolean", "GListPtr", "GListPtr")
+ "gboolean", "gboolean", "gboolean", "GList *", "GList *")
int
pe__node_html(pcmk__output_t *out, va_list args) {
pe_node_t *node = va_arg(args, pe_node_t *);
@@ -1023,8 +1023,8 @@ pe__node_html(pcmk__output_t *out, va_list args) {
gboolean print_clone_detail = va_arg(args, gboolean);
gboolean print_brief = va_arg(args, gboolean);
gboolean group_by_node = va_arg(args, gboolean);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
char *node_name = pe__node_display_name(node, print_clone_detail);
char *buf = crm_strdup_printf("Node: %s", node_name);
@@ -1052,7 +1052,7 @@ pe__node_html(pcmk__output_t *out, va_list args) {
pcmk_create_html_node(item_node, "span", NULL, "offline", " OFFLINE");
}
if (print_brief && group_by_node) {
- GListPtr rscs = pe__filter_rsc_list(node->details->running_rsc, only_rsc);
+ GList *rscs = pe__filter_rsc_list(node->details->running_rsc, only_rsc);
if (rscs != NULL) {
out->begin_list(out, NULL, NULL, NULL);
@@ -1061,7 +1061,7 @@ pe__node_html(pcmk__output_t *out, va_list args) {
}
} else if (group_by_node) {
- GListPtr lpc2 = NULL;
+ GList *lpc2 = NULL;
out->begin_list(out, NULL, NULL, NULL);
for (lpc2 = node->details->running_rsc; lpc2 != NULL; lpc2 = lpc2->next) {
@@ -1081,7 +1081,7 @@ pe__node_html(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("node", "pe_node_t *", "unsigned int", "gboolean", "const char *",
- "gboolean", "gboolean", "gboolean", "GListPtr", "GListPtr")
+ "gboolean", "gboolean", "gboolean", "GList *", "GList *")
int
pe__node_text(pcmk__output_t *out, va_list args) {
pe_node_t *node = va_arg(args, pe_node_t *);
@@ -1091,8 +1091,8 @@ pe__node_text(pcmk__output_t *out, va_list args) {
gboolean print_clone_detail = va_arg(args, gboolean);
gboolean print_brief = va_arg(args, gboolean);
gboolean group_by_node = va_arg(args, gboolean);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
if (full) {
char *node_name = pe__node_display_name(node, print_clone_detail);
@@ -1110,7 +1110,7 @@ pe__node_text(pcmk__output_t *out, va_list args) {
/* If we're grouping by node, print its resources */
if (group_by_node) {
if (print_brief) {
- GListPtr rscs = pe__filter_rsc_list(node->details->running_rsc, only_rsc);
+ GList *rscs = pe__filter_rsc_list(node->details->running_rsc, only_rsc);
if (rscs != NULL) {
out->begin_list(out, NULL, NULL, "%s", buf);
@@ -1123,7 +1123,7 @@ pe__node_text(pcmk__output_t *out, va_list args) {
}
} else {
- GListPtr gIter2 = NULL;
+ GList *gIter2 = NULL;
out->begin_list(out, NULL, NULL, "%s", buf);
out->begin_list(out, NULL, NULL, "Resources");
@@ -1151,7 +1151,7 @@ pe__node_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("node", "pe_node_t *", "unsigned int", "gboolean", "const char *",
- "gboolean", "gboolean", "gboolean", "GListPtr", "GListPtr")
+ "gboolean", "gboolean", "gboolean", "GList *", "GList *")
int
pe__node_xml(pcmk__output_t *out, va_list args) {
pe_node_t *node = va_arg(args, pe_node_t *);
@@ -1161,8 +1161,8 @@ pe__node_xml(pcmk__output_t *out, va_list args) {
gboolean print_clone_detail G_GNUC_UNUSED = va_arg(args, gboolean);
gboolean print_brief G_GNUC_UNUSED = va_arg(args, gboolean);
gboolean group_by_node = va_arg(args, gboolean);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
if (full) {
const char *node_type = "unknown";
@@ -1200,7 +1200,7 @@ pe__node_xml(pcmk__output_t *out, va_list args) {
}
if (group_by_node) {
- GListPtr lpc = NULL;
+ GList *lpc = NULL;
for (lpc = node->details->running_rsc; lpc != NULL; lpc = lpc->next) {
pe_resource_t *rsc = (pe_resource_t *) lpc->data;
@@ -1401,12 +1401,12 @@ pe__node_attribute_xml(pcmk__output_t *out, va_list args) {
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("node-list", "GListPtr", "GListPtr", "GListPtr", "unsigned int", "gboolean", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("node-list", "GList *", "GList *", "GList *", "unsigned int", "gboolean", "gboolean", "gboolean")
int
pe__node_list_html(pcmk__output_t *out, va_list args) {
- GListPtr nodes = va_arg(args, GListPtr);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *nodes = va_arg(args, GList *);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
unsigned int print_opts = va_arg(args, unsigned int);
gboolean print_clone_detail = va_arg(args, gboolean);
gboolean print_brief = va_arg(args, gboolean);
@@ -1414,7 +1414,7 @@ pe__node_list_html(pcmk__output_t *out, va_list args) {
int rc = pcmk_rc_no_output;
- for (GListPtr gIter = nodes; gIter != NULL; gIter = gIter->next) {
+ for (GList *gIter = nodes; gIter != NULL; gIter = gIter->next) {
pe_node_t *node = (pe_node_t *) gIter->data;
if (!pcmk__str_in_list(only_node, node->details->uname)) {
@@ -1431,12 +1431,12 @@ pe__node_list_html(pcmk__output_t *out, va_list args) {
return rc;
}
-PCMK__OUTPUT_ARGS("node-list", "GListPtr", "GListPtr", "GListPtr", "unsigned int", "gboolean", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("node-list", "GList *", "GList *", "GList *", "unsigned int", "gboolean", "gboolean", "gboolean")
int
pe__node_list_text(pcmk__output_t *out, va_list args) {
- GListPtr nodes = va_arg(args, GListPtr);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *nodes = va_arg(args, GList *);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
unsigned int print_opts = va_arg(args, unsigned int);
gboolean print_clone_detail = va_arg(args, gboolean);
gboolean print_brief = va_arg(args, gboolean);
@@ -1457,7 +1457,7 @@ pe__node_list_text(pcmk__output_t *out, va_list args) {
int rc = pcmk_rc_no_output;
- for (GListPtr gIter = nodes; gIter != NULL; gIter = gIter->next) {
+ for (GList *gIter = nodes; gIter != NULL; gIter = gIter->next) {
pe_node_t *node = (pe_node_t *) gIter->data;
const char *node_mode = NULL;
char *node_name = pe__node_display_name(node, print_clone_detail);
@@ -1570,19 +1570,19 @@ pe__node_list_text(pcmk__output_t *out, va_list args) {
return rc;
}
-PCMK__OUTPUT_ARGS("node-list", "GListPtr", "GListPtr", "GListPtr", "unsigned int", "gboolean", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("node-list", "GList *", "GList *", "GList *", "unsigned int", "gboolean", "gboolean", "gboolean")
int
pe__node_list_xml(pcmk__output_t *out, va_list args) {
- GListPtr nodes = va_arg(args, GListPtr);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *nodes = va_arg(args, GList *);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
unsigned int print_opts = va_arg(args, unsigned int);
gboolean print_clone_detail = va_arg(args, gboolean);
gboolean print_brief = va_arg(args, gboolean);
gboolean group_by_node = va_arg(args, gboolean);
out->begin_list(out, NULL, NULL, "nodes");
- for (GListPtr gIter = nodes; gIter != NULL; gIter = gIter->next) {
+ for (GList *gIter = nodes; gIter != NULL; gIter = gIter->next) {
pe_node_t *node = (pe_node_t *) gIter->data;
if (!pcmk__str_in_list(only_node, node->details->uname)) {
@@ -1597,10 +1597,10 @@ pe__node_list_xml(pcmk__output_t *out, va_list args) {
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("op-history", "struct xmlNode *", "const char *", "const char *", "int", "gboolean")
+PCMK__OUTPUT_ARGS("op-history", "xmlNodePtr", "const char *", "const char *", "int", "gboolean")
int
pe__op_history_text(pcmk__output_t *out, va_list args) {
- xmlNode *xml_op = va_arg(args, xmlNode *);
+ xmlNodePtr xml_op = va_arg(args, xmlNodePtr);
const char *task = va_arg(args, const char *);
const char *interval_ms_s = va_arg(args, const char *);
int rc = va_arg(args, int);
@@ -1614,10 +1614,10 @@ pe__op_history_text(pcmk__output_t *out, va_list args) {
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("op-history", "struct xmlNode *", "const char *", "const char *", "int", "gboolean")
+PCMK__OUTPUT_ARGS("op-history", "xmlNodePtr", "const char *", "const char *", "int", "gboolean")
int
pe__op_history_xml(pcmk__output_t *out, va_list args) {
- xmlNode *xml_op = va_arg(args, xmlNode *);
+ xmlNodePtr xml_op = va_arg(args, xmlNodePtr);
const char *task = va_arg(args, const char *);
const char *interval_ms_s = va_arg(args, const char *);
int rc = va_arg(args, int);
@@ -1760,7 +1760,7 @@ pe__resource_history_xml(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("resource-list", "pe_working_set_t *", "unsigned int", "gboolean",
- "gboolean", "gboolean", "gboolean", "GListPtr", "GListPtr", "gboolean")
+ "gboolean", "gboolean", "gboolean", "GList *", "GList *", "gboolean")
int
pe__resource_list(pcmk__output_t *out, va_list args)
{
@@ -1770,11 +1770,11 @@ pe__resource_list(pcmk__output_t *out, va_list args)
gboolean inactive_resources = va_arg(args, gboolean);
gboolean brief_output = va_arg(args, gboolean);
gboolean print_summary = va_arg(args, gboolean);
- GListPtr only_node = va_arg(args, GListPtr);
- GListPtr only_rsc = va_arg(args, GListPtr);
+ GList *only_node = va_arg(args, GList *);
+ GList *only_rsc = va_arg(args, GList *);
gboolean print_spacer = va_arg(args, gboolean);
- GListPtr rsc_iter;
+ GList *rsc_iter;
int rc = pcmk_rc_no_output;
/* If we already showed active resources by node, and
@@ -1798,7 +1798,7 @@ pe__resource_list(pcmk__output_t *out, va_list args)
/* If we haven't already printed resources grouped by node,
* and brief output was requested, print resource summary */
if (brief_output && !group_by_node) {
- GListPtr rscs = pe__filter_rsc_list(data_set->resources, only_rsc);
+ GList *rscs = pe__filter_rsc_list(data_set->resources, only_rsc);
pe__rscs_brief_output(out, rscs, print_opts, inactive_resources);
g_list_free(rscs);
diff --git a/tools/crm_resource_print.c b/tools/crm_resource_print.c
index cb06879..4cb78b5 100644
--- a/tools/crm_resource_print.c
+++ b/tools/crm_resource_print.c
@@ -247,9 +247,9 @@ resource_check_xml(pcmk__output_t *out, va_list args) {
pe_resource_t *parent = uber_parent(checks->rsc);
int rc = pcmk_rc_no_output;
- xmlNode *node = pcmk__output_create_xml_node(out, "check",
- "id", parent->id,
- NULL);
+ xmlNodePtr node = pcmk__output_create_xml_node(out, "check",
+ "id", parent->id,
+ NULL);
if (pcmk_is_set(checks->flags, rsc_remain_stopped)) {
crm_xml_add(node, "remain_stopped", "true");
@@ -270,11 +270,11 @@ resource_check_xml(pcmk__output_t *out, va_list args) {
return rc;
}
-PCMK__OUTPUT_ARGS("resource-search", "GListPtr", "pe_resource_t *", "gchar *")
+PCMK__OUTPUT_ARGS("resource-search", "GList *", "pe_resource_t *", "gchar *")
static int
resource_search_default(pcmk__output_t *out, va_list args)
{
- GListPtr nodes = va_arg(args, GListPtr);
+ GList *nodes = va_arg(args, GList *);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
gchar *requested_name = va_arg(args, gchar *);
@@ -286,7 +286,7 @@ resource_search_default(pcmk__output_t *out, va_list args)
return rc;
}
- for (GListPtr lpc = nodes; lpc != NULL; lpc = lpc->next) {
+ for (GList *lpc = nodes; lpc != NULL; lpc = lpc->next) {
pe_node_t *node = (pe_node_t *) lpc->data;
if (!printed) {
@@ -316,11 +316,11 @@ resource_search_default(pcmk__output_t *out, va_list args)
}
-PCMK__OUTPUT_ARGS("resource-search", "GListPtr", "pe_resource_t *", "gchar *")
+PCMK__OUTPUT_ARGS("resource-search", "GList *", "pe_resource_t *", "gchar *")
static int
resource_search_xml(pcmk__output_t *out, va_list args)
{
- GListPtr nodes = va_arg(args, GListPtr);
+ GList *nodes = va_arg(args, GList *);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
gchar *requested_name = va_arg(args, gchar *);
@@ -328,9 +328,9 @@ resource_search_xml(pcmk__output_t *out, va_list args)
"resource", requested_name,
NULL);
- for (GListPtr lpc = nodes; lpc != NULL; lpc = lpc->next) {
+ for (GList *lpc = nodes; lpc != NULL; lpc = lpc->next) {
pe_node_t *node = (pe_node_t *) lpc->data;
- xmlNode *sub_node = pcmk__output_create_xml_text_node(out, "node", node->details->uname);
+ xmlNodePtr sub_node = pcmk__output_create_xml_text_node(out, "node", node->details->uname);
if (!pe_rsc_is_clone(rsc) && rsc->fns->state(rsc, TRUE) == RSC_ROLE_MASTER) {
crm_xml_add(sub_node, "state", "promoted");
@@ -340,13 +340,13 @@ resource_search_xml(pcmk__output_t *out, va_list args)
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("resource-why", "cib_t *", "GListPtr", "pe_resource_t *",
+PCMK__OUTPUT_ARGS("resource-why", "cib_t *", "GList *", "pe_resource_t *",
"pe_node_t *")
static int
resource_why_default(pcmk__output_t *out, va_list args)
{
cib_t *cib_conn = va_arg(args, cib_t *);
- GListPtr resources = va_arg(args, GListPtr);
+ GList *resources = va_arg(args, GList *);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
pe_node_t *node = va_arg(args, pe_node_t *);
@@ -355,8 +355,8 @@ resource_why_default(pcmk__output_t *out, va_list args)
out->begin_list(out, NULL, NULL, "Resource Reasons");
if ((rsc == NULL) && (host_uname == NULL)) {
- GListPtr lpc = NULL;
- GListPtr hosts = NULL;
+ GList *lpc = NULL;
+ GList *hosts = NULL;
for (lpc = resources; lpc != NULL; lpc = lpc->next) {
pe_resource_t *rsc = (pe_resource_t *) lpc->data;
@@ -386,10 +386,10 @@ resource_why_default(pcmk__output_t *out, va_list args)
} else if ((rsc == NULL) && (host_uname != NULL)) {
const char* host_uname = node->details->uname;
- GListPtr allResources = node->details->allocated_rsc;
- GListPtr activeResources = node->details->running_rsc;
- GListPtr unactiveResources = pcmk__subtract_lists(allResources, activeResources, (GCompareFunc) strcmp);
- GListPtr lpc = NULL;
+ GList *allResources = node->details->allocated_rsc;
+ GList *activeResources = node->details->running_rsc;
+ GList *unactiveResources = pcmk__subtract_lists(allResources, activeResources, (GCompareFunc) strcmp);
+ GList *lpc = NULL;
for (lpc = activeResources; lpc != NULL; lpc = lpc->next) {
pe_resource_t *rsc = (pe_resource_t *) lpc->data;
@@ -410,7 +410,7 @@ resource_why_default(pcmk__output_t *out, va_list args)
g_list_free(unactiveResources);
} else if ((rsc != NULL) && (host_uname == NULL)) {
- GListPtr hosts = NULL;
+ GList *hosts = NULL;
rsc->fns->location(rsc, &hosts, TRUE);
out->list_item(out, "reason", "Resource %s is %srunning",
@@ -423,23 +423,23 @@ resource_why_default(pcmk__output_t *out, va_list args)
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("resource-why", "cib_t *", "GListPtr", "pe_resource_t *",
+PCMK__OUTPUT_ARGS("resource-why", "cib_t *", "GList *", "pe_resource_t *",
"pe_node_t *")
static int
resource_why_xml(pcmk__output_t *out, va_list args)
{
cib_t *cib_conn = va_arg(args, cib_t *);
- GListPtr resources = va_arg(args, GListPtr);
+ GList *resources = va_arg(args, GList *);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
pe_node_t *node = va_arg(args, pe_node_t *);
const char *host_uname = (node == NULL)? NULL : node->details->uname;
- xmlNode *xml_node = pcmk__output_xml_create_parent(out, "reason", NULL);
+ xmlNodePtr xml_node = pcmk__output_xml_create_parent(out, "reason", NULL);
if ((rsc == NULL) && (host_uname == NULL)) {
- GListPtr lpc = NULL;
- GListPtr hosts = NULL;
+ GList *lpc = NULL;
+ GList *hosts = NULL;
pcmk__output_xml_create_parent(out, "resources", NULL);
@@ -470,10 +470,10 @@ resource_why_xml(pcmk__output_t *out, va_list args)
} else if ((rsc == NULL) && (host_uname != NULL)) {
const char* host_uname = node->details->uname;
- GListPtr allResources = node->details->allocated_rsc;
- GListPtr activeResources = node->details->running_rsc;
- GListPtr unactiveResources = pcmk__subtract_lists(allResources, activeResources, (GCompareFunc) strcmp);
- GListPtr lpc = NULL;
+ GList *allResources = node->details->allocated_rsc;
+ GList *activeResources = node->details->running_rsc;
+ GList *unactiveResources = pcmk__subtract_lists(allResources, activeResources, (GCompareFunc) strcmp);
+ GList *lpc = NULL;
pcmk__output_xml_create_parent(out, "resources", NULL);
@@ -509,7 +509,7 @@ resource_why_xml(pcmk__output_t *out, va_list args)
g_list_free(unactiveResources);
} else if ((rsc != NULL) && (host_uname == NULL)) {
- GListPtr hosts = NULL;
+ GList *hosts = NULL;
rsc->fns->location(rsc, &hosts, TRUE);
crm_xml_add(xml_node, "running", pcmk__btoa(hosts != NULL));
@@ -532,10 +532,10 @@ add_resource_name(pcmk__output_t *out, pe_resource_t *rsc) {
}
}
-PCMK__OUTPUT_ARGS("resource-names-list", "GListPtr")
+PCMK__OUTPUT_ARGS("resource-names-list", "GList *")
static int
resource_names(pcmk__output_t *out, va_list args) {
- GListPtr resources = va_arg(args, GListPtr);
+ GList *resources = va_arg(args, GList *);
if (resources == NULL) {
out->err(out, "NO resources configured\n");
@@ -544,7 +544,7 @@ resource_names(pcmk__output_t *out, va_list args) {
out->begin_list(out, NULL, NULL, "Resource Names");
- for (GListPtr lpc = resources; lpc != NULL; lpc = lpc->next) {
+ for (GList *lpc = resources; lpc != NULL; lpc = lpc->next) {
pe_resource_t *rsc = (pe_resource_t *) lpc->data;
add_resource_name(out, rsc);
}
--
1.8.3.1
From 2075e40607d4a73617a079163cb7c6a2301b7d86 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Mon, 9 Nov 2020 10:41:34 -0500
Subject: [PATCH 2/9] Fix: libpacemaker: Remove some G_GNUC_UNUSED references.
These variables are, in fact, being used.
---
lib/pacemaker/pcmk_output.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/pacemaker/pcmk_output.c b/lib/pacemaker/pcmk_output.c
index a0b12b9..a2bc931 100644
--- a/lib/pacemaker/pcmk_output.c
+++ b/lib/pacemaker/pcmk_output.c
@@ -218,7 +218,7 @@ static int colocations_list_xml(pcmk__output_t *out, va_list args) {
PCMK__OUTPUT_ARGS("locations-list", "pe_resource_t *")
static int locations_list(pcmk__output_t *out, va_list args) {
- pe_resource_t *rsc G_GNUC_UNUSED = va_arg(args, pe_resource_t *);
+ pe_resource_t *rsc = va_arg(args, pe_resource_t *);
GList *lpc = NULL;
GList *list = rsc->rsc_location;
@@ -280,9 +280,9 @@ static int locations_list_xml(pcmk__output_t *out, va_list args) {
PCMK__OUTPUT_ARGS("stacks-constraints", "pe_resource_t *", "pe_working_set_t *", "gboolean")
static int
stacks_and_constraints(pcmk__output_t *out, va_list args) {
- pe_resource_t *rsc G_GNUC_UNUSED = va_arg(args, pe_resource_t *);
- pe_working_set_t *data_set G_GNUC_UNUSED = va_arg(args, pe_working_set_t *);
- gboolean recursive G_GNUC_UNUSED = va_arg(args, gboolean);
+ pe_resource_t *rsc = va_arg(args, pe_resource_t *);
+ pe_working_set_t *data_set = va_arg(args, pe_working_set_t *);
+ gboolean recursive = va_arg(args, gboolean);
GList *lpc = NULL;
xmlNodePtr cib_constraints = get_object_root(XML_CIB_TAG_CONSTRAINTS,
--
1.8.3.1
From 578f7a22fd75b50fce21de474d6b373146a00666 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Fri, 20 Nov 2020 16:20:23 -0500
Subject: [PATCH 3/9] Fix: libs, tools: Rearrange formatted output args
popping.
For consistency, move all the va_args stuff to the beginning of each
function, and then declare other variables after that.
---
lib/pacemaker/pcmk_output.c | 1 +
lib/pengine/pe_output.c | 37 ++++++++++++++++++++-----------------
tools/crm_mon_curses.c | 1 +
3 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/lib/pacemaker/pcmk_output.c b/lib/pacemaker/pcmk_output.c
index a2bc931..deb1fe5 100644
--- a/lib/pacemaker/pcmk_output.c
+++ b/lib/pacemaker/pcmk_output.c
@@ -460,6 +460,7 @@ static int
crmadmin_node_list(pcmk__output_t *out, va_list args)
{
xmlNodePtr xml_node = va_arg(args, xmlNodePtr);
+
int found = 0;
xmlNode *node = NULL;
xmlNode *nodes = get_object_root(XML_CIB_TAG_NODES, xml_node);
diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c
index 3d2fc24..a7118a4 100644
--- a/lib/pengine/pe_output.c
+++ b/lib/pengine/pe_output.c
@@ -216,8 +216,8 @@ pe__cluster_summary(pcmk__output_t *out, va_list args) {
gboolean show_times = va_arg(args, gboolean);
gboolean show_counts = va_arg(args, gboolean);
gboolean show_options = va_arg(args, gboolean);
- int rc = pcmk_rc_no_output;
+ int rc = pcmk_rc_no_output;
const char *stack_s = get_cluster_stack(data_set);
if (show_stack) {
@@ -282,8 +282,8 @@ pe__cluster_summary_html(pcmk__output_t *out, va_list args) {
gboolean show_times = va_arg(args, gboolean);
gboolean show_counts = va_arg(args, gboolean);
gboolean show_options = va_arg(args, gboolean);
- int rc = pcmk_rc_no_output;
+ int rc = pcmk_rc_no_output;
const char *stack_s = get_cluster_stack(data_set);
if (show_stack) {
@@ -487,14 +487,14 @@ pe__ban_xml(pcmk__output_t *out, va_list args) {
PCMK__OUTPUT_ARGS("cluster-counts", "unsigned int", "int", "int", "int")
int
pe__cluster_counts_html(pcmk__output_t *out, va_list args) {
- xmlNodePtr nodes_node = pcmk__output_create_xml_node(out, "li", NULL);
- xmlNodePtr resources_node = pcmk__output_create_xml_node(out, "li", NULL);
-
unsigned int nnodes = va_arg(args, unsigned int);
int nresources = va_arg(args, int);
int ndisabled = va_arg(args, int);
int nblocked = va_arg(args, int);
+ xmlNodePtr nodes_node = pcmk__output_create_xml_node(out, "li", NULL);
+ xmlNodePtr resources_node = pcmk__output_create_xml_node(out, "li", NULL);
+
char *nnodes_str = crm_strdup_printf("%d node%s configured",
nnodes, pcmk__plural_s(nnodes));
@@ -583,14 +583,14 @@ pe__cluster_counts_text(pcmk__output_t *out, va_list args) {
PCMK__OUTPUT_ARGS("cluster-counts", "unsigned int", "int", "int", "int")
int
pe__cluster_counts_xml(pcmk__output_t *out, va_list args) {
- xmlNodePtr nodes_node = pcmk__output_create_xml_node(out, "nodes_configured", NULL);
- xmlNodePtr resources_node = pcmk__output_create_xml_node(out, "resources_configured", NULL);
-
unsigned int nnodes = va_arg(args, unsigned int);
int nresources = va_arg(args, int);
int ndisabled = va_arg(args, int);
int nblocked = va_arg(args, int);
+ xmlNodePtr nodes_node = pcmk__output_create_xml_node(out, "nodes_configured", NULL);
+ xmlNodePtr resources_node = pcmk__output_create_xml_node(out, "resources_configured", NULL);
+
char *s = crm_itoa(nnodes);
crm_xml_add(nodes_node, "number", s);
free(s);
@@ -613,13 +613,13 @@ pe__cluster_counts_xml(pcmk__output_t *out, va_list args) {
PCMK__OUTPUT_ARGS("cluster-dc", "pe_node_t *", "const char *", "const char *", "char *")
int
pe__cluster_dc_html(pcmk__output_t *out, va_list args) {
- xmlNodePtr node = pcmk__output_create_xml_node(out, "li", NULL);
-
pe_node_t *dc = va_arg(args, pe_node_t *);
const char *quorum = va_arg(args, const char *);
const char *dc_version_s = va_arg(args, const char *);
char *dc_name = va_arg(args, char *);
+ xmlNodePtr node = pcmk__output_create_xml_node(out, "li", NULL);
+
pcmk_create_html_node(node, "span", NULL, "bold", "Current DC: ");
if (dc) {
@@ -820,6 +820,7 @@ PCMK__OUTPUT_ARGS("cluster-options", "pe_working_set_t *")
int
pe__cluster_options_xml(pcmk__output_t *out, va_list args) {
pe_working_set_t *data_set = va_arg(args, pe_working_set_t *);
+
const char *no_quorum_policy = NULL;
switch (data_set->no_quorum_policy) {
@@ -857,9 +858,10 @@ pe__cluster_options_xml(pcmk__output_t *out, va_list args) {
PCMK__OUTPUT_ARGS("cluster-stack", "const char *")
int
pe__cluster_stack_html(pcmk__output_t *out, va_list args) {
- xmlNodePtr node = pcmk__output_create_xml_node(out, "li", NULL);
const char *stack_s = va_arg(args, const char *);
+ xmlNodePtr node = pcmk__output_create_xml_node(out, "li", NULL);
+
pcmk_create_html_node(node, "span", NULL, "bold", "Stack: ");
pcmk_create_html_node(node, "span", NULL, NULL, stack_s);
@@ -870,6 +872,7 @@ PCMK__OUTPUT_ARGS("cluster-stack", "const char *")
int
pe__cluster_stack_text(pcmk__output_t *out, va_list args) {
const char *stack_s = va_arg(args, const char *);
+
out->list_item(out, "Stack", "%s", stack_s);
return pcmk_rc_ok;
}
@@ -889,14 +892,14 @@ pe__cluster_stack_xml(pcmk__output_t *out, va_list args) {
PCMK__OUTPUT_ARGS("cluster-times", "const char *", "const char *", "const char *", "const char *")
int
pe__cluster_times_html(pcmk__output_t *out, va_list args) {
- xmlNodePtr updated_node = pcmk__output_create_xml_node(out, "li", NULL);
- xmlNodePtr changed_node = pcmk__output_create_xml_node(out, "li", NULL);
-
const char *last_written = va_arg(args, const char *);
const char *user = va_arg(args, const char *);
const char *client = va_arg(args, const char *);
const char *origin = va_arg(args, const char *);
+ xmlNodePtr updated_node = pcmk__output_create_xml_node(out, "li", NULL);
+ xmlNodePtr changed_node = pcmk__output_create_xml_node(out, "li", NULL);
+
char *buf = last_changed_string(last_written, user, client, origin);
pcmk_create_html_node(updated_node, "span", NULL, "bold", "Last updated: ");
@@ -952,6 +955,7 @@ PCMK__OUTPUT_ARGS("failed-action", "xmlNodePtr")
int
pe__failed_action_text(pcmk__output_t *out, va_list args) {
xmlNodePtr xml_op = va_arg(args, xmlNodePtr);
+
char *s = failed_action_string(xml_op);
out->list_item(out, NULL, "%s", s);
@@ -1229,7 +1233,6 @@ pe__node_attribute_text(pcmk__output_t *out, va_list args) {
gboolean add_extra = va_arg(args, gboolean);
int expected_score = va_arg(args, int);
-
if (add_extra) {
int v = crm_parse_int(value, "0");
@@ -1904,10 +1907,10 @@ pe__ticket_text(pcmk__output_t *out, va_list args) {
PCMK__OUTPUT_ARGS("ticket", "pe_ticket_t *")
int
pe__ticket_xml(pcmk__output_t *out, va_list args) {
- xmlNodePtr node = NULL;
-
pe_ticket_t *ticket = va_arg(args, pe_ticket_t *);
+ xmlNodePtr node = NULL;
+
node = pcmk__output_create_xml_node(out, "ticket",
"id", ticket->id,
"status", ticket->granted ? "granted" : "revoked",
diff --git a/tools/crm_mon_curses.c b/tools/crm_mon_curses.c
index 9cf28dc..869c7f3 100644
--- a/tools/crm_mon_curses.c
+++ b/tools/crm_mon_curses.c
@@ -369,6 +369,7 @@ PCMK__OUTPUT_ARGS("maint-mode", "unsigned long long int")
static int
cluster_maint_mode_console(pcmk__output_t *out, va_list args) {
unsigned long long flags = va_arg(args, unsigned long long);
+
int rc;
if (pcmk_is_set(flags, pe_flag_maintenance_mode)) {
--
1.8.3.1
From 7a26a80bc7983f79a69c3548a635bf88c031beb7 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Mon, 9 Nov 2020 12:30:19 -0500
Subject: [PATCH 4/9] Fix: libs: Remove extra whitespace in list_item calls.
---
cts/cli/regression.crm_mon.exp | 50 +++++++++++++++++++++---------------------
lib/pengine/clone.c | 10 ++++-----
lib/pengine/native.c | 6 ++---
lib/pengine/pe_output.c | 4 ++--
4 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/cts/cli/regression.crm_mon.exp b/cts/cli/regression.crm_mon.exp
index e9f36ad..cf7d28e 100644
--- a/cts/cli/regression.crm_mon.exp
+++ b/cts/cli/regression.crm_mon.exp
@@ -480,13 +480,13 @@ Node List:
* Online: [ cluster01 cluster02 ]
Active Resources:
- * 1 (ocf::pacemaker:Dummy): Active cluster02
- * 1 (stonith:fence_xvm): Active cluster01
+ * 1 (ocf::pacemaker:Dummy): Active cluster02
+ * 1 (stonith:fence_xvm): Active cluster01
* Clone Set: ping-clone [ping]:
* Started: [ cluster01 cluster02 ]
* Resource Group: exim-group:
- * 1/1 (lsb:exim): Active cluster02
- * 1/1 (ocf::heartbeat:IPaddr): Active cluster02
+ * 1/1 (lsb:exim): Active cluster02
+ * 1/1 (ocf::heartbeat:IPaddr): Active cluster02
* Clone Set: mysql-clone-group [mysql-group]:
* Started: [ cluster01 cluster02 ]
@@ -609,16 +609,16 @@ Cluster Summary:
Node List:
* Node cluster01: online:
* Resources:
- * 1 (lsb:mysql-proxy): Active
- * 1 (ocf::pacemaker:ping): Active
- * 1 (stonith:fence_xvm): Active
+ * 1 (lsb:mysql-proxy): Active
+ * 1 (ocf::pacemaker:ping): Active
+ * 1 (stonith:fence_xvm): Active
* Node cluster02: online:
* Resources:
- * 1 (lsb:exim): Active
- * 1 (lsb:mysql-proxy): Active
- * 1 (ocf::heartbeat:IPaddr): Active
- * 1 (ocf::pacemaker:Dummy): Active
- * 1 (ocf::pacemaker:ping): Active
+ * 1 (lsb:exim): Active
+ * 1 (lsb:mysql-proxy): Active
+ * 1 (ocf::heartbeat:IPaddr): Active
+ * 1 (ocf::pacemaker:Dummy): Active
+ * 1 (ocf::pacemaker:ping): Active
Node Attributes:
* Node: cluster01:
@@ -2857,7 +2857,7 @@ Node List:
* GuestOnline: [ httpd-bundle-0@cluster02 httpd-bundle-1@cluster01 ]
Full List of Resources:
- * 1/1 (stonith:fence_xvm): Active cluster01
+ * 1/1 (stonith:fence_xvm): Active cluster01
* Clone Set: ping-clone [ping]:
* Started: [ cluster01 ]
* Stopped: [ cluster02 ]
@@ -2865,7 +2865,7 @@ Full List of Resources:
* httpd-bundle-0 (192.168.122.131) (ocf::heartbeat:apache): Started cluster02
* httpd-bundle-1 (192.168.122.132) (ocf::heartbeat:apache): Stopped cluster01
* Resource Group: partially-active-group:
- * 1/2 (ocf::pacemaker:Dummy): Active cluster02
+ * 1/2 (ocf::pacemaker:Dummy): Active cluster02
Node Attributes:
* Node: cluster01:
@@ -2919,20 +2919,20 @@ Cluster Summary:
Node List:
* Node cluster01: online:
* Resources:
- * 1 (ocf::heartbeat:IPaddr2): Active
- * 1 (ocf::heartbeat:docker): Active
- * 1 (ocf::pacemaker:ping): Active
- * 1 (ocf::pacemaker:remote): Active
- * 1 (stonith:fence_xvm): Active
+ * 1 (ocf::heartbeat:IPaddr2): Active
+ * 1 (ocf::heartbeat:docker): Active
+ * 1 (ocf::pacemaker:ping): Active
+ * 1 (ocf::pacemaker:remote): Active
+ * 1 (stonith:fence_xvm): Active
* Node cluster02: online:
* Resources:
- * 1 (ocf::heartbeat:IPaddr2): Active
- * 1 (ocf::heartbeat:docker): Active
- * 1 (ocf::pacemaker:Dummy): Active
- * 1 (ocf::pacemaker:remote): Active
+ * 1 (ocf::heartbeat:IPaddr2): Active
+ * 1 (ocf::heartbeat:docker): Active
+ * 1 (ocf::pacemaker:Dummy): Active
+ * 1 (ocf::pacemaker:remote): Active
* GuestNode httpd-bundle-0@cluster02: online:
* Resources:
- * 1 (ocf::heartbeat:apache): Active
+ * 1 (ocf::heartbeat:apache): Active
Inactive Resources:
* Clone Set: ping-clone [ping]:
@@ -2942,7 +2942,7 @@ Inactive Resources:
* httpd-bundle-0 (192.168.122.131) (ocf::heartbeat:apache): Started cluster02
* httpd-bundle-1 (192.168.122.132) (ocf::heartbeat:apache): Stopped cluster01
* Resource Group: partially-active-group:
- * 1/2 (ocf::pacemaker:Dummy): Active cluster02
+ * 1/2 (ocf::pacemaker:Dummy): Active cluster02
Node Attributes:
* Node: cluster01:
diff --git a/lib/pengine/clone.c b/lib/pengine/clone.c
index 9b48d01..9e98178 100644
--- a/lib/pengine/clone.c
+++ b/lib/pengine/clone.c
@@ -781,7 +781,7 @@ pe__clone_html(pcmk__output_t *out, va_list args)
}
if (list_text != NULL) {
- out->list_item(out, NULL, " Masters: [ %s ]", list_text);
+ out->list_item(out, NULL, "Masters: [ %s ]", list_text);
g_list_free(master_list);
free(list_text);
list_text = NULL;
@@ -806,13 +806,13 @@ pe__clone_html(pcmk__output_t *out, va_list args)
enum rsc_role_e role = configured_role(rsc);
if(role == RSC_ROLE_SLAVE) {
- out->list_item(out, NULL, " Slaves (target-role): [ %s ]", list_text);
+ out->list_item(out, NULL, "Slaves (target-role): [ %s ]", list_text);
} else {
- out->list_item(out, NULL, " Slaves: [ %s ]", list_text);
+ out->list_item(out, NULL, "Slaves: [ %s ]", list_text);
}
} else {
- out->list_item(out, NULL, " Started: [ %s ]", list_text);
+ out->list_item(out, NULL, "Started: [ %s ]", list_text);
}
g_list_free(started_list);
@@ -861,7 +861,7 @@ pe__clone_html(pcmk__output_t *out, va_list args)
}
if (stopped_list != NULL) {
- out->list_item(out, NULL, " %s: [ %s ]", state, stopped_list);
+ out->list_item(out, NULL, "%s: [ %s ]", state, stopped_list);
free(stopped_list);
stopped_list_len = 0;
}
diff --git a/lib/pengine/native.c b/lib/pengine/native.c
index 6f27d7b..193be17 100644
--- a/lib/pengine/native.c
+++ b/lib/pengine/native.c
@@ -1320,12 +1320,12 @@ pe__rscs_brief_output(pcmk__output_t *out, GListPtr rsc_list, long options, gboo
}
if (print_all) {
- out->list_item(out, NULL, " %d/%d\t(%s):\tActive %s",
+ out->list_item(out, NULL, "%d/%d\t(%s):\tActive %s",
*active_counter,
rsc_counter ? *rsc_counter : 0, type,
(*active_counter > 0) && node_name ? node_name : "");
} else {
- out->list_item(out, NULL, " %d\t(%s):\tActive %s",
+ out->list_item(out, NULL, "%d\t(%s):\tActive %s",
*active_counter, type,
(*active_counter > 0) && node_name ? node_name : "");
}
@@ -1334,7 +1334,7 @@ pe__rscs_brief_output(pcmk__output_t *out, GListPtr rsc_list, long options, gboo
}
if (print_all && active_counter_all == 0) {
- out->list_item(out, NULL, " %d/%d\t(%s):\tActive",
+ out->list_item(out, NULL, "%d/%d\t(%s):\tActive",
active_counter_all,
rsc_counter ? *rsc_counter : 0, type);
rc = pcmk_rc_ok;
diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c
index a7118a4..e26604e 100644
--- a/lib/pengine/pe_output.c
+++ b/lib/pengine/pe_output.c
@@ -1890,13 +1890,13 @@ pe__ticket_text(pcmk__output_t *out, va_list args) {
if (ticket->last_granted > -1) {
char *time = pcmk_format_named_time("last-granted", ticket->last_granted);
- out->list_item(out, ticket->id, "\t%s%s %s",
+ out->list_item(out, ticket->id, "%s%s %s",
ticket->granted ? "granted" : "revoked",
ticket->standby ? " [standby]" : "",
time);
free(time);
} else {
- out->list_item(out, ticket->id, "\t%s%s",
+ out->list_item(out, ticket->id, "%s%s",
ticket->granted ? "granted" : "revoked",
ticket->standby ? " [standby]" : "");
}
--
1.8.3.1
From 3db514eed9764d6947f114dfe870a88d082db8a3 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Mon, 9 Nov 2020 13:53:23 -0500
Subject: [PATCH 5/9] Fix: libs, tools: Don't use fprintf in formatted output.
That's what out->info is for. And then having done this, the special
console-specific version of the maint-mode message can go away. It's
now exactly the same as the text version.
---
lib/pengine/pe_output.c | 10 ++++------
tools/crm_mon_curses.c | 28 +---------------------------
2 files changed, 5 insertions(+), 33 deletions(-)
diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c
index e26604e..1b57f64 100644
--- a/lib/pengine/pe_output.c
+++ b/lib/pengine/pe_output.c
@@ -694,14 +694,12 @@ pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args) {
unsigned long long flags = va_arg(args, unsigned long long);
if (pcmk_is_set(flags, pe_flag_maintenance_mode)) {
- fprintf(out->dest, "\n *** Resource management is DISABLED ***");
- fprintf(out->dest, "\n The cluster will not attempt to start, stop or recover services");
- fprintf(out->dest, "\n");
+ out->info(out, "\n *** Resource management is DISABLED ***");
+ out->info(out, " The cluster will not attempt to start, stop or recover services");
return pcmk_rc_ok;
} else if (pcmk_is_set(flags, pe_flag_stop_everything)) {
- fprintf(out->dest, "\n *** Resource management is DISABLED ***");
- fprintf(out->dest, "\n The cluster will keep all resources stopped");
- fprintf(out->dest, "\n");
+ out->info(out, "\n *** Resource management is DISABLED ***");
+ out->info(out, " The cluster will keep all resources stopped");
return pcmk_rc_ok;
} else {
return pcmk_rc_no_output;
diff --git a/tools/crm_mon_curses.c b/tools/crm_mon_curses.c
index 869c7f3..ae22198 100644
--- a/tools/crm_mon_curses.c
+++ b/tools/crm_mon_curses.c
@@ -365,32 +365,6 @@ stonith_event_console(pcmk__output_t *out, va_list args) {
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("maint-mode", "unsigned long long int")
-static int
-cluster_maint_mode_console(pcmk__output_t *out, va_list args) {
- unsigned long long flags = va_arg(args, unsigned long long);
-
- int rc;
-
- if (pcmk_is_set(flags, pe_flag_maintenance_mode)) {
- printw("\n *** Resource management is DISABLED ***");
- printw("\n The cluster will not attempt to start, stop or recover services");
- printw("\n");
- rc = pcmk_rc_ok;
- } else if (pcmk_is_set(flags, pe_flag_stop_everything)) {
- printw("\n *** Resource management is DISABLED ***");
- printw("\n The cluster will keep all resources stopped");
- printw("\n");
- rc = pcmk_rc_ok;
- } else {
- rc = pcmk_rc_no_output;
- }
-
- clrtoeol();
- refresh();
- return rc;
-}
-
static pcmk__message_entry_t fmt_functions[] = {
{ "ban", "console", pe__ban_text },
{ "bundle", "console", pe__bundle_text },
@@ -406,7 +380,7 @@ static pcmk__message_entry_t fmt_functions[] = {
{ "fencing-history", "console", stonith__history },
{ "full-fencing-history", "console", stonith__full_history },
{ "group", "console", pe__group_text },
- { "maint-mode", "console", cluster_maint_mode_console },
+ { "maint-mode", "console", pe__cluster_maint_mode_text },
{ "node", "console", pe__node_text },
{ "node-attribute", "console", pe__node_attribute_text },
{ "node-list", "console", pe__node_list_text },
--
1.8.3.1
From a7bbe968df5617c78e78495406f95f9d258834f1 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Thu, 19 Nov 2020 16:04:09 -0500
Subject: [PATCH 6/9] Fix: libstonithd: Use subprocess_output directly.
stonith__validate_agent_text was using puts, when it should really just
be using subprocess_output. The effect is the same but we should be
using the same functions everywhere.
---
lib/fencing/st_output.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/lib/fencing/st_output.c b/lib/fencing/st_output.c
index 7c3ccef..145dd14 100644
--- a/lib/fencing/st_output.c
+++ b/lib/fencing/st_output.c
@@ -403,14 +403,7 @@ stonith__validate_agent_text(pcmk__output_t *out, va_list args) {
rc ? "failed" : "succeeded");
}
- if (output) {
- puts(output);
- }
-
- if (error_output) {
- puts(error_output);
- }
-
+ out->subprocess_output(out, rc, output, error_output);
return rc;
}
--
1.8.3.1
From 39062beb1f243078bab71cc26af44019927da112 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Fri, 20 Nov 2020 16:22:12 -0500
Subject: [PATCH 7/9] Fix: libs, tools: Add -list to certain formatted output
message names.
Basically, if the message creates its own list, the name should end in
-list. This is a hint to the caller that they do not need to add an
extra layer of lists. I've further changed the names of these messages
to be a little shorter, too.
Note that some messages (the resource variants most obviously) create
their own list but don't have -list in the name. Here, the list is more
for organizational purposes rather than indicating that it contains
items.
---
lib/fencing/st_output.c | 20 +++++++--------
tools/crm_mon_curses.c | 8 +++---
tools/crm_mon_print.c | 14 +++++-----
tools/crm_resource.c | 8 +++---
tools/crm_resource_print.c | 61 ++++++++++++++++++++++----------------------
tools/crm_resource_runtime.c | 2 +-
6 files changed, 56 insertions(+), 57 deletions(-)
diff --git a/lib/fencing/st_output.c b/lib/fencing/st_output.c
index 145dd14..e1f4830 100644
--- a/lib/fencing/st_output.c
+++ b/lib/fencing/st_output.c
@@ -30,7 +30,7 @@ time_t_string(time_t when) {
return buf;
}
-PCMK__OUTPUT_ARGS("failed-fencing-history", "stonith_history_t *", "GList *", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("failed-fencing-list", "stonith_history_t *", "GList *", "gboolean", "gboolean")
int
stonith__failed_history(pcmk__output_t *out, va_list args) {
stonith_history_t *history = va_arg(args, stonith_history_t *);
@@ -58,7 +58,7 @@ stonith__failed_history(pcmk__output_t *out, va_list args) {
return rc;
}
-PCMK__OUTPUT_ARGS("fencing-history", "stonith_history_t *", "GList *", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("fencing-list", "stonith_history_t *", "GList *", "gboolean", "gboolean")
int
stonith__history(pcmk__output_t *out, va_list args) {
stonith_history_t *history = va_arg(args, stonith_history_t *);
@@ -84,7 +84,7 @@ stonith__history(pcmk__output_t *out, va_list args) {
return rc;
}
-PCMK__OUTPUT_ARGS("full-fencing-history", "crm_exit_t", "stonith_history_t *", "GList *", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("full-fencing-list", "crm_exit_t", "stonith_history_t *", "GList *", "gboolean", "gboolean")
int
stonith__full_history(pcmk__output_t *out, va_list args) {
crm_exit_t history_rc G_GNUC_UNUSED = va_arg(args, crm_exit_t);
@@ -109,7 +109,7 @@ stonith__full_history(pcmk__output_t *out, va_list args) {
return rc;
}
-PCMK__OUTPUT_ARGS("full-fencing-history", "crm_exit_t", "stonith_history_t *", "GList *", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("full-fencing-list", "crm_exit_t", "stonith_history_t *", "GList *", "gboolean", "gboolean")
int
stonith__full_history_xml(pcmk__output_t *out, va_list args) {
crm_exit_t history_rc = va_arg(args, crm_exit_t);
@@ -198,7 +198,7 @@ stonith__last_fenced_xml(pcmk__output_t *out, va_list args) {
}
}
-PCMK__OUTPUT_ARGS("pending-fencing-actions", "stonith_history_t *", "GList *", "gboolean", "gboolean")
+PCMK__OUTPUT_ARGS("pending-fencing-list", "stonith_history_t *", "GList *", "gboolean", "gboolean")
int
stonith__pending_actions(pcmk__output_t *out, va_list args) {
stonith_history_t *history = va_arg(args, stonith_history_t *);
@@ -433,15 +433,15 @@ stonith__validate_agent_xml(pcmk__output_t *out, va_list args) {
}
static pcmk__message_entry_t fmt_functions[] = {
- { "failed-fencing-history", "default", stonith__failed_history },
- { "fencing-history", "default", stonith__history },
- { "full-fencing-history", "default", stonith__full_history },
- { "full-fencing-history", "xml", stonith__full_history_xml },
+ { "failed-fencing-list", "default", stonith__failed_history },
+ { "fencing-list", "default", stonith__history },
+ { "full-fencing-list", "default", stonith__full_history },
+ { "full-fencing-list", "xml", stonith__full_history_xml },
{ "last-fenced", "html", stonith__last_fenced_html },
{ "last-fenced", "log", stonith__last_fenced_text },
{ "last-fenced", "text", stonith__last_fenced_text },
{ "last-fenced", "xml", stonith__last_fenced_xml },
- { "pending-fencing-actions", "default", stonith__pending_actions },
+ { "pending-fencing-list", "default", stonith__pending_actions },
{ "stonith-event", "html", stonith__event_html },
{ "stonith-event", "log", stonith__event_text },
{ "stonith-event", "text", stonith__event_text },
diff --git a/tools/crm_mon_curses.c b/tools/crm_mon_curses.c
index ae22198..5c79dd2 100644
--- a/tools/crm_mon_curses.c
+++ b/tools/crm_mon_curses.c
@@ -376,16 +376,16 @@ static pcmk__message_entry_t fmt_functions[] = {
{ "cluster-summary", "console", pe__cluster_summary },
{ "cluster-times", "console", pe__cluster_times_text },
{ "failed-action", "console", pe__failed_action_text },
- { "failed-fencing-history", "console", stonith__failed_history },
- { "fencing-history", "console", stonith__history },
- { "full-fencing-history", "console", stonith__full_history },
+ { "failed-fencing-list", "console", stonith__failed_history },
+ { "fencing-list", "console", stonith__history },
+ { "full-fencing-list", "console", stonith__full_history },
{ "group", "console", pe__group_text },
{ "maint-mode", "console", pe__cluster_maint_mode_text },
{ "node", "console", pe__node_text },
{ "node-attribute", "console", pe__node_attribute_text },
{ "node-list", "console", pe__node_list_text },
{ "op-history", "console", pe__op_history_text },
- { "pending-fencing-actions", "console", stonith__pending_actions },
+ { "pending-fencing-list", "console", stonith__pending_actions },
{ "primitive", "console", pe__resource_text },
{ "resource-history", "console", pe__resource_history_text },
{ "stonith-event", "console", stonith_event_console },
diff --git a/tools/crm_mon_print.c b/tools/crm_mon_print.c
index ce3e47c..06840b7 100644
--- a/tools/crm_mon_print.c
+++ b/tools/crm_mon_print.c
@@ -735,7 +735,7 @@ print_status(pcmk__output_t *out, pe_working_set_t *data_set,
GINT_TO_POINTER(st_failed));
if (hp) {
- CHECK_RC(rc, out->message(out, "failed-fencing-history", stonith_history, unames,
+ CHECK_RC(rc, out->message(out, "failed-fencing-list", stonith_history, unames,
pcmk_is_set(mon_ops, mon_op_fence_full_history),
rc == pcmk_rc_ok));
}
@@ -759,7 +759,7 @@ print_status(pcmk__output_t *out, pe_working_set_t *data_set,
GINT_TO_POINTER(st_failed));
if (hp) {
- CHECK_RC(rc, out->message(out, "fencing-history", hp, unames,
+ CHECK_RC(rc, out->message(out, "fencing-list", hp, unames,
pcmk_is_set(mon_ops, mon_op_fence_full_history),
rc == pcmk_rc_ok));
}
@@ -767,7 +767,7 @@ print_status(pcmk__output_t *out, pe_working_set_t *data_set,
stonith_history_t *hp = stonith__first_matching_event(stonith_history, stonith__event_state_pending, NULL);
if (hp) {
- CHECK_RC(rc, out->message(out, "pending-fencing-actions", hp, unames,
+ CHECK_RC(rc, out->message(out, "pending-fencing-list", hp, unames,
pcmk_is_set(mon_ops, mon_op_fence_full_history),
rc == pcmk_rc_ok));
}
@@ -853,7 +853,7 @@ print_xml_status(pcmk__output_t *out, pe_working_set_t *data_set,
if (pcmk_is_set(show, mon_show_fencing_all)
&& pcmk_is_set(mon_ops, mon_op_fence_history)) {
- out->message(out, "full-fencing-history", history_rc, stonith_history,
+ out->message(out, "full-fencing-list", history_rc, stonith_history,
unames, pcmk_is_set(mon_ops, mon_op_fence_full_history),
FALSE);
}
@@ -954,7 +954,7 @@ print_html_status(pcmk__output_t *out, pe_working_set_t *data_set,
GINT_TO_POINTER(st_failed));
if (hp) {
- out->message(out, "failed-fencing-history", stonith_history, unames,
+ out->message(out, "failed-fencing-list", stonith_history, unames,
pcmk_is_set(mon_ops, mon_op_fence_full_history), FALSE);
}
}
@@ -966,7 +966,7 @@ print_html_status(pcmk__output_t *out, pe_working_set_t *data_set,
GINT_TO_POINTER(st_failed));
if (hp) {
- out->message(out, "fencing-history", hp, unames,
+ out->message(out, "fencing-list", hp, unames,
pcmk_is_set(mon_ops, mon_op_fence_full_history),
FALSE);
}
@@ -974,7 +974,7 @@ print_html_status(pcmk__output_t *out, pe_working_set_t *data_set,
stonith_history_t *hp = stonith__first_matching_event(stonith_history, stonith__event_state_pending, NULL);
if (hp) {
- out->message(out, "pending-fencing-actions", hp, unames,
+ out->message(out, "pending-fencing-list", hp, unames,
pcmk_is_set(mon_ops, mon_op_fence_full_history),
FALSE);
}
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
index 2c62ff6..95c72fc 100644
--- a/tools/crm_resource.c
+++ b/tools/crm_resource.c
@@ -1816,7 +1816,7 @@ main(int argc, char **argv)
case cmd_locate: {
GListPtr resources = cli_resource_search(out, rsc, options.rsc_id, data_set);
- rc = out->message(out, "resource-search", resources, rsc, options.rsc_id);
+ rc = out->message(out, "resource-search-list", resources, rsc, options.rsc_id);
break;
}
@@ -1839,7 +1839,7 @@ main(int argc, char **argv)
goto done;
}
}
- out->message(out, "resource-why", cib_conn, data_set->resources, rsc, dest);
+ out->message(out, "resource-reasons-list", cib_conn, data_set->resources, rsc, dest);
rc = pcmk_rc_ok;
}
break;
@@ -1879,7 +1879,7 @@ main(int argc, char **argv)
break;
case cmd_get_property:
- rc = out->message(out, "property", rsc, options.prop_name);
+ rc = out->message(out, "property-list", rsc, options.prop_name);
if (rc == pcmk_rc_no_output) {
rc = ENXIO;
}
@@ -1916,7 +1916,7 @@ main(int argc, char **argv)
}
crm_debug("Looking up %s in %s", options.prop_name, rsc->id);
- rc = out->message(out, "attribute", rsc, options.prop_name, params);
+ rc = out->message(out, "attribute-list", rsc, options.prop_name, params);
g_hash_table_destroy(params);
break;
}
diff --git a/tools/crm_resource_print.c b/tools/crm_resource_print.c
index 4cb78b5..89d6172 100644
--- a/tools/crm_resource_print.c
+++ b/tools/crm_resource_print.c
@@ -127,9 +127,9 @@ cli_resource_print(pcmk__output_t *out, pe_resource_t *rsc,
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("attribute", "pe_resource_t *", "char *", "GHashTable *")
+PCMK__OUTPUT_ARGS("attribute-list", "pe_resource_t *", "char *", "GHashTable *")
static int
-attribute_default(pcmk__output_t *out, va_list args) {
+attribute_list_default(pcmk__output_t *out, va_list args) {
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
char *attr = va_arg(args, char *);
GHashTable *params = va_arg(args, GHashTable *);
@@ -147,9 +147,9 @@ attribute_default(pcmk__output_t *out, va_list args) {
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("attribute", "pe_resource_t *", "char *", "GHashTable *")
+PCMK__OUTPUT_ARGS("attribute-list", "pe_resource_t *", "char *", "GHashTable *")
static int
-attribute_text(pcmk__output_t *out, va_list args) {
+attribute_list_text(pcmk__output_t *out, va_list args) {
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
char *attr = va_arg(args, char *);
GHashTable *params = va_arg(args, GHashTable *);
@@ -165,9 +165,9 @@ attribute_text(pcmk__output_t *out, va_list args) {
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("property", "pe_resource_t *", "char *")
+PCMK__OUTPUT_ARGS("property-list", "pe_resource_t *", "char *")
static int
-property_default(pcmk__output_t *out, va_list args) {
+property_list_default(pcmk__output_t *out, va_list args) {
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
char *attr = va_arg(args, char *);
@@ -182,9 +182,9 @@ property_default(pcmk__output_t *out, va_list args) {
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("property", "pe_resource_t *", "char *")
+PCMK__OUTPUT_ARGS("property-list", "pe_resource_t *", "char *")
static int
-property_text(pcmk__output_t *out, va_list args) {
+property_list_text(pcmk__output_t *out, va_list args) {
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
char *attr = va_arg(args, char *);
@@ -197,9 +197,9 @@ property_text(pcmk__output_t *out, va_list args) {
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("resource-check", "resource_checks_t *")
+PCMK__OUTPUT_ARGS("resource-check-list", "resource_checks_t *")
static int
-resource_check_default(pcmk__output_t *out, va_list args) {
+resource_check_list_default(pcmk__output_t *out, va_list args) {
resource_checks_t *checks = va_arg(args, resource_checks_t *);
pe_resource_t *parent = uber_parent(checks->rsc);
@@ -239,9 +239,9 @@ resource_check_default(pcmk__output_t *out, va_list args) {
return rc;
}
-PCMK__OUTPUT_ARGS("resource-check", "resource_checks_t *")
+PCMK__OUTPUT_ARGS("resource-check-list", "resource_checks_t *")
static int
-resource_check_xml(pcmk__output_t *out, va_list args) {
+resource_check_list_xml(pcmk__output_t *out, va_list args) {
resource_checks_t *checks = va_arg(args, resource_checks_t *);
pe_resource_t *parent = uber_parent(checks->rsc);
@@ -270,9 +270,9 @@ resource_check_xml(pcmk__output_t *out, va_list args) {
return rc;
}
-PCMK__OUTPUT_ARGS("resource-search", "GList *", "pe_resource_t *", "gchar *")
+PCMK__OUTPUT_ARGS("resource-search-list", "GList *", "pe_resource_t *", "gchar *")
static int
-resource_search_default(pcmk__output_t *out, va_list args)
+resource_search_list_default(pcmk__output_t *out, va_list args)
{
GList *nodes = va_arg(args, GList *);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
@@ -315,10 +315,9 @@ resource_search_default(pcmk__output_t *out, va_list args)
return rc;
}
-
-PCMK__OUTPUT_ARGS("resource-search", "GList *", "pe_resource_t *", "gchar *")
+PCMK__OUTPUT_ARGS("resource-search-list", "GList *", "pe_resource_t *", "gchar *")
static int
-resource_search_xml(pcmk__output_t *out, va_list args)
+resource_search_list_xml(pcmk__output_t *out, va_list args)
{
GList *nodes = va_arg(args, GList *);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
@@ -340,10 +339,10 @@ resource_search_xml(pcmk__output_t *out, va_list args)
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("resource-why", "cib_t *", "GList *", "pe_resource_t *",
+PCMK__OUTPUT_ARGS("resource-reasons-list", "cib_t *", "GList *", "pe_resource_t *",
"pe_node_t *")
static int
-resource_why_default(pcmk__output_t *out, va_list args)
+resource_reasons_list_default(pcmk__output_t *out, va_list args)
{
cib_t *cib_conn = va_arg(args, cib_t *);
GList *resources = va_arg(args, GList *);
@@ -423,10 +422,10 @@ resource_why_default(pcmk__output_t *out, va_list args)
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("resource-why", "cib_t *", "GList *", "pe_resource_t *",
+PCMK__OUTPUT_ARGS("resource-reasons-list", "cib_t *", "GList *", "pe_resource_t *",
"pe_node_t *")
static int
-resource_why_xml(pcmk__output_t *out, va_list args)
+resource_reasons_list_xml(pcmk__output_t *out, va_list args)
{
cib_t *cib_conn = va_arg(args, cib_t *);
GList *resources = va_arg(args, GList *);
@@ -554,16 +553,16 @@ resource_names(pcmk__output_t *out, va_list args) {
}
static pcmk__message_entry_t fmt_functions[] = {
- { "attribute", "default", attribute_default },
- { "attribute", "text", attribute_text },
- { "property", "default", property_default },
- { "property", "text", property_text },
- { "resource-check", "default", resource_check_default },
- { "resource-check", "xml", resource_check_xml },
- { "resource-search", "default", resource_search_default },
- { "resource-search", "xml", resource_search_xml },
- { "resource-why", "default", resource_why_default },
- { "resource-why", "xml", resource_why_xml },
+ { "attribute-list", "default", attribute_list_default },
+ { "attribute-list", "text", attribute_list_text },
+ { "property-list", "default", property_list_default },
+ { "property-list", "text", property_list_text },
+ { "resource-check-list", "default", resource_check_list_default },
+ { "resource-check-list", "xml", resource_check_list_xml },
+ { "resource-search-list", "default", resource_search_list_default },
+ { "resource-search-list", "xml", resource_search_list_xml },
+ { "resource-reasons-list", "default", resource_reasons_list_default },
+ { "resource-reasons-list", "xml", resource_reasons_list_xml },
{ "resource-names-list", "default", resource_names },
{ NULL, NULL, NULL }
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
index bbd8bc1..3a9feac 100644
--- a/tools/crm_resource_runtime.c
+++ b/tools/crm_resource_runtime.c
@@ -900,7 +900,7 @@ cli_resource_check(pcmk__output_t *out, cib_t * cib_conn, pe_resource_t *rsc)
checks = cli_check_resource(rsc, role_s, managed);
if (checks->flags != 0 || checks->lock_node != NULL) {
- rc = out->message(out, "resource-check", checks);
+ rc = out->message(out, "resource-check-list", checks);
}
free(role_s);
--
1.8.3.1
From d7322d1c2802c2d65a82a19b2513b5769b25dc30 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Fri, 20 Nov 2020 16:23:14 -0500
Subject: [PATCH 8/9] Fix: libpacemaker: Fix typing on crmadmin formatted
output messages.
Mostly this is just changing char * into const char *, though the
crm_node_list one is pretty important.
---
lib/pacemaker/pcmk_output.c | 64 ++++++++++++++++++++++-----------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/lib/pacemaker/pcmk_output.c b/lib/pacemaker/pcmk_output.c
index deb1fe5..5c54204 100644
--- a/lib/pacemaker/pcmk_output.c
+++ b/lib/pacemaker/pcmk_output.c
@@ -357,14 +357,14 @@ stacks_and_constraints_xml(pcmk__output_t *out, va_list args) {
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("health", "char *", "char *", "char *", "char *")
+PCMK__OUTPUT_ARGS("health", "const char *", "const char *", "const char *", "const char *")
static int
health_text(pcmk__output_t *out, va_list args)
{
- char *sys_from = va_arg(args, char *);
- char *host_from = va_arg(args, char *);
- char *fsa_state = va_arg(args, char *);
- char *result = va_arg(args, char *);
+ const char *sys_from = va_arg(args, const char *);
+ const char *host_from = va_arg(args, const char *);
+ const char *fsa_state = va_arg(args, const char *);
+ const char *result = va_arg(args, const char *);
if (!out->is_quiet(out)) {
out->info(out, "Status of %s@%s: %s (%s)", crm_str(sys_from),
@@ -376,14 +376,14 @@ health_text(pcmk__output_t *out, va_list args)
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("health", "char *", "char *", "char *", "char *")
+PCMK__OUTPUT_ARGS("health", "const char *", "const char *", "const char *", "const char *")
static int
health_xml(pcmk__output_t *out, va_list args)
{
- char *sys_from = va_arg(args, char *);
- char *host_from = va_arg(args, char *);
- char *fsa_state = va_arg(args, char *);
- char *result = va_arg(args, char *);
+ const char *sys_from = va_arg(args, const char *);
+ const char *host_from = va_arg(args, const char *);
+ const char *fsa_state = va_arg(args, const char *);
+ const char *result = va_arg(args, const char *);
pcmk__output_create_xml_node(out, crm_str(sys_from),
"node_name", crm_str(host_from),
@@ -393,13 +393,13 @@ health_xml(pcmk__output_t *out, va_list args)
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("pacemakerd-health", "char *", "char *", "char *")
+PCMK__OUTPUT_ARGS("pacemakerd-health", "const char *", "const char *", "const char *")
static int
pacemakerd_health_text(pcmk__output_t *out, va_list args)
{
- char *sys_from = va_arg(args, char *);
- char *state = va_arg(args, char *);
- char *last_updated = va_arg(args, char *);
+ const char *sys_from = va_arg(args, const char *);
+ const char *state = va_arg(args, const char *);
+ const char *last_updated = va_arg(args, const char *);
if (!out->is_quiet(out)) {
out->info(out, "Status of %s: '%s' %s %s", crm_str(sys_from),
@@ -412,13 +412,13 @@ pacemakerd_health_text(pcmk__output_t *out, va_list args)
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("pacemakerd-health", "char *", "char *", "char *")
+PCMK__OUTPUT_ARGS("pacemakerd-health", "const char *", "const char *", "const char *")
static int
pacemakerd_health_xml(pcmk__output_t *out, va_list args)
{
- char *sys_from = va_arg(args, char *);
- char *state = va_arg(args, char *);
- char *last_updated = va_arg(args, char *);
+ const char *sys_from = va_arg(args, const char *);
+ const char *state = va_arg(args, const char *);
+ const char *last_updated = va_arg(args, const char *);
pcmk__output_create_xml_node(out, crm_str(sys_from),
"state", crm_str(state),
@@ -427,11 +427,11 @@ pacemakerd_health_xml(pcmk__output_t *out, va_list args)
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("dc", "char *")
+PCMK__OUTPUT_ARGS("dc", "const char *")
static int
dc_text(pcmk__output_t *out, va_list args)
{
- char *dc = va_arg(args, char *);
+ const char *dc = va_arg(args, const char *);
if (!out->is_quiet(out)) {
out->info(out, "Designated Controller is: %s", crm_str(dc));
@@ -442,11 +442,11 @@ dc_text(pcmk__output_t *out, va_list args)
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("dc", "char *")
+PCMK__OUTPUT_ARGS("dc", "const char *")
static int
dc_xml(pcmk__output_t *out, va_list args)
{
- char *dc = va_arg(args, char *);
+ const char *dc = va_arg(args, const char *);
pcmk__output_create_xml_node(out, "dc",
"node_name", crm_str(dc),
@@ -455,16 +455,16 @@ dc_xml(pcmk__output_t *out, va_list args)
}
-PCMK__OUTPUT_ARGS("crmadmin-node-list", "pcmk__output_t *", "xmlNodePtr")
+PCMK__OUTPUT_ARGS("crmadmin-node-list", "xmlNodePtr", "gboolean")
static int
crmadmin_node_list(pcmk__output_t *out, va_list args)
{
xmlNodePtr xml_node = va_arg(args, xmlNodePtr);
+ gboolean BASH_EXPORT = va_arg(args, gboolean);
int found = 0;
xmlNode *node = NULL;
xmlNode *nodes = get_object_root(XML_CIB_TAG_NODES, xml_node);
- gboolean BASH_EXPORT = va_arg(args, gboolean);
out->begin_list(out, NULL, NULL, "nodes");
@@ -490,13 +490,13 @@ crmadmin_node_list(pcmk__output_t *out, va_list args)
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("crmadmin-node", "char *", "char *", "char *", "gboolean")
+PCMK__OUTPUT_ARGS("crmadmin-node", "const char *", "const char *", "const char *", "gboolean")
static int
crmadmin_node_text(pcmk__output_t *out, va_list args)
{
- char *type = va_arg(args, char *);
- char *name = va_arg(args, char *);
- char *id = va_arg(args, char *);
+ const char *type = va_arg(args, const char *);
+ const char *name = va_arg(args, const char *);
+ const char *id = va_arg(args, const char *);
gboolean BASH_EXPORT = va_arg(args, gboolean);
if (BASH_EXPORT) {
@@ -509,13 +509,13 @@ crmadmin_node_text(pcmk__output_t *out, va_list args)
return pcmk_rc_ok;
}
-PCMK__OUTPUT_ARGS("crmadmin-node", "char *", "char *", "char *", "gboolean")
+PCMK__OUTPUT_ARGS("crmadmin-node", "const char *", "const char *", "const char *", "gboolean")
static int
crmadmin_node_xml(pcmk__output_t *out, va_list args)
{
- char *type = va_arg(args, char *);
- char *name = va_arg(args, char *);
- char *id = va_arg(args, char *);
+ const char *type = va_arg(args, const char *);
+ const char *name = va_arg(args, const char *);
+ const char *id = va_arg(args, const char *);
pcmk__output_create_xml_node(out, "node",
"type", type ? type : "member",
--
1.8.3.1
From 1a123a8d8a8ec22b6166b5cdebcfdfe6b05bcc4e Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Fri, 20 Nov 2020 16:23:39 -0500
Subject: [PATCH 9/9] Fix: libs: Decrease the number of visible formatted
output functions.
The only ones that need to be exported are the ones that crm_mon needs
to reference for its output. All the others can be static and only
accessed indirectly through calling out->message.
And then remove the prefixes from these newly static functions. This
could potentially be a little confusing if the text version is public
(and therefore has the, say, pe__ prefix) while the xml version is
hidden and is lacking that suffix. But I think it'll be okay.
---
include/crm/fencing/internal.h | 11 +--
include/crm/pengine/internal.h | 54 ++++----------
lib/fencing/st_output.c | 66 ++++++++---------
lib/pengine/pe_output.c | 161 +++++++++++++++++++++--------------------
4 files changed, 129 insertions(+), 163 deletions(-)
diff --git a/include/crm/fencing/internal.h b/include/crm/fencing/internal.h
index 391ab72..dfb1d64 100644
--- a/include/crm/fencing/internal.h
+++ b/include/crm/fencing/internal.h
@@ -185,20 +185,11 @@ int stonith__rhcs_validate(stonith_t *st, int call_options, const char *target,
const char *agent, GHashTable *params, const char *host_arg,
int timeout, char **output, char **error_output);
+/* Exported for crm_mon to reference */
int stonith__failed_history(pcmk__output_t *out, va_list args);
int stonith__history(pcmk__output_t *out, va_list args);
int stonith__full_history(pcmk__output_t *out, va_list args);
-int stonith__full_history_xml(pcmk__output_t *out, va_list args);
-int stonith__last_fenced_html(pcmk__output_t *out, va_list args);
-int stonith__last_fenced_text(pcmk__output_t *out, va_list args);
-int stonith__last_fenced_xml(pcmk__output_t *out, va_list args);
int stonith__pending_actions(pcmk__output_t *out, va_list args);
-int stonith__event_html(pcmk__output_t *out, va_list args);
-int stonith__event_text(pcmk__output_t *out, va_list args);
-int stonith__event_xml(pcmk__output_t *out, va_list args);
-int stonith__validate_agent_html(pcmk__output_t *out, va_list args);
-int stonith__validate_agent_text(pcmk__output_t *out, va_list args);
-int stonith__validate_agent_xml(pcmk__output_t *out, va_list args);
stonith_history_t *stonith__first_matching_event(stonith_history_t *history,
bool (*matching_fn)(stonith_history_t *, void *),
diff --git a/include/crm/pengine/internal.h b/include/crm/pengine/internal.h
index c4b28cc..89e17b8 100644
--- a/include/crm/pengine/internal.h
+++ b/include/crm/pengine/internal.h
@@ -256,34 +256,9 @@ pe__rsc_bool_str(pe_resource_t *rsc, uint64_t rsc_flag)
return pcmk__btoa(pcmk_is_set(rsc->flags, rsc_flag));
}
-int pe__ban_html(pcmk__output_t *out, va_list args);
-int pe__ban_text(pcmk__output_t *out, va_list args);
-int pe__ban_xml(pcmk__output_t *out, va_list args);
int pe__clone_xml(pcmk__output_t *out, va_list args);
int pe__clone_html(pcmk__output_t *out, va_list args);
int pe__clone_text(pcmk__output_t *out, va_list args);
-int pe__cluster_counts_html(pcmk__output_t *out, va_list args);
-int pe__cluster_counts_text(pcmk__output_t *out, va_list args);
-int pe__cluster_counts_xml(pcmk__output_t *out, va_list args);
-int pe__cluster_dc_html(pcmk__output_t *out, va_list args);
-int pe__cluster_dc_text(pcmk__output_t *out, va_list args);
-int pe__cluster_dc_xml(pcmk__output_t *out, va_list args);
-int pe__cluster_maint_mode_html(pcmk__output_t *out, va_list args);
-int pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args);
-int pe__cluster_options_html(pcmk__output_t *out, va_list args);
-int pe__cluster_options_log(pcmk__output_t *out, va_list args);
-int pe__cluster_options_text(pcmk__output_t *out, va_list args);
-int pe__cluster_options_xml(pcmk__output_t *out, va_list args);
-int pe__cluster_stack_html(pcmk__output_t *out, va_list args);
-int pe__cluster_stack_text(pcmk__output_t *out, va_list args);
-int pe__cluster_stack_xml(pcmk__output_t *out, va_list args);
-int pe__cluster_summary(pcmk__output_t *out, va_list args);
-int pe__cluster_summary_html(pcmk__output_t *out, va_list args);
-int pe__cluster_times_html(pcmk__output_t *out, va_list args);
-int pe__cluster_times_xml(pcmk__output_t *out, va_list args);
-int pe__cluster_times_text(pcmk__output_t *out, va_list args);
-int pe__failed_action_text(pcmk__output_t *out, va_list args);
-int pe__failed_action_xml(pcmk__output_t *out, va_list args);
int pe__group_xml(pcmk__output_t *out, va_list args);
int pe__group_html(pcmk__output_t *out, va_list args);
int pe__group_text(pcmk__output_t *out, va_list args);
@@ -293,26 +268,25 @@ int pe__bundle_text(pcmk__output_t *out, va_list args);
int pe__node_html(pcmk__output_t *out, va_list args);
int pe__node_text(pcmk__output_t *out, va_list args);
int pe__node_xml(pcmk__output_t *out, va_list args);
-int pe__node_and_op(pcmk__output_t *out, va_list args);
-int pe__node_and_op_xml(pcmk__output_t *out, va_list args);
-int pe__node_attribute_html(pcmk__output_t *out, va_list args);
+int pe__resource_xml(pcmk__output_t *out, va_list args);
+int pe__resource_html(pcmk__output_t *out, va_list args);
+int pe__resource_text(pcmk__output_t *out, va_list args);
+
+/* Exported for crm_mon to reference */
+int pe__ban_text(pcmk__output_t *out, va_list args);
+int pe__cluster_counts_text(pcmk__output_t *out, va_list args);
+int pe__cluster_dc_text(pcmk__output_t *out, va_list args);
+int pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args);
+int pe__cluster_options_text(pcmk__output_t *out, va_list args);
+int pe__cluster_stack_text(pcmk__output_t *out, va_list args);
+int pe__cluster_summary(pcmk__output_t *out, va_list args);
+int pe__cluster_times_text(pcmk__output_t *out, va_list args);
+int pe__failed_action_text(pcmk__output_t *out, va_list args);
int pe__node_attribute_text(pcmk__output_t *out, va_list args);
-int pe__node_attribute_xml(pcmk__output_t *out, va_list args);
-int pe__node_list_html(pcmk__output_t *out, va_list args);
int pe__node_list_text(pcmk__output_t *out, va_list args);
-int pe__node_list_xml(pcmk__output_t *out, va_list args);
int pe__op_history_text(pcmk__output_t *out, va_list args);
-int pe__op_history_xml(pcmk__output_t *out, va_list args);
-int pe__resource_config(pcmk__output_t *out, va_list args);
int pe__resource_history_text(pcmk__output_t *out, va_list args);
-int pe__resource_history_xml(pcmk__output_t *out, va_list args);
-int pe__resource_xml(pcmk__output_t *out, va_list args);
-int pe__resource_html(pcmk__output_t *out, va_list args);
-int pe__resource_text(pcmk__output_t *out, va_list args);
-int pe__resource_list(pcmk__output_t *out, va_list args);
-int pe__ticket_html(pcmk__output_t *out, va_list args);
int pe__ticket_text(pcmk__output_t *out, va_list args);
-int pe__ticket_xml(pcmk__output_t *out, va_list args);
void native_free(pe_resource_t * rsc);
void group_free(pe_resource_t * rsc);
diff --git a/lib/fencing/st_output.c b/lib/fencing/st_output.c
index e1f4830..f48fd55 100644
--- a/lib/fencing/st_output.c
+++ b/lib/fencing/st_output.c
@@ -110,8 +110,8 @@ stonith__full_history(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("full-fencing-list", "crm_exit_t", "stonith_history_t *", "GList *", "gboolean", "gboolean")
-int
-stonith__full_history_xml(pcmk__output_t *out, va_list args) {
+static int
+full_history_xml(pcmk__output_t *out, va_list args) {
crm_exit_t history_rc = va_arg(args, crm_exit_t);
stonith_history_t *history = va_arg(args, stonith_history_t *);
GList *only_node = va_arg(args, GList *);
@@ -147,8 +147,8 @@ stonith__full_history_xml(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("last-fenced", "const char *", "time_t")
-int
-stonith__last_fenced_html(pcmk__output_t *out, va_list args) {
+static int
+last_fenced_html(pcmk__output_t *out, va_list args) {
const char *target = va_arg(args, const char *);
time_t when = va_arg(args, time_t);
@@ -163,8 +163,8 @@ stonith__last_fenced_html(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("last-fenced", "const char *", "time_t")
-int
-stonith__last_fenced_text(pcmk__output_t *out, va_list args) {
+static int
+last_fenced_text(pcmk__output_t *out, va_list args) {
const char *target = va_arg(args, const char *);
time_t when = va_arg(args, time_t);
@@ -178,8 +178,8 @@ stonith__last_fenced_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("last-fenced", "const char *", "time_t")
-int
-stonith__last_fenced_xml(pcmk__output_t *out, va_list args) {
+static int
+last_fenced_xml(pcmk__output_t *out, va_list args) {
const char *target = va_arg(args, const char *);
time_t when = va_arg(args, time_t);
@@ -228,8 +228,8 @@ stonith__pending_actions(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("stonith-event", "stonith_history_t *", "gboolean", "gboolean")
-int
-stonith__event_html(pcmk__output_t *out, va_list args) {
+static int
+stonith_event_html(pcmk__output_t *out, va_list args) {
stonith_history_t *event = va_arg(args, stonith_history_t *);
gboolean full_history = va_arg(args, gboolean);
gboolean later_succeeded = va_arg(args, gboolean);
@@ -276,8 +276,8 @@ stonith__event_html(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("stonith-event", "stonith_history_t *", "gboolean", "gboolean")
-int
-stonith__event_text(pcmk__output_t *out, va_list args) {
+static int
+stonith_event_text(pcmk__output_t *out, va_list args) {
stonith_history_t *event = va_arg(args, stonith_history_t *);
gboolean full_history = va_arg(args, gboolean);
gboolean later_succeeded = va_arg(args, gboolean);
@@ -314,8 +314,8 @@ stonith__event_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("stonith-event", "stonith_history_t *", "gboolean", "gboolean")
-int
-stonith__event_xml(pcmk__output_t *out, va_list args) {
+static int
+stonith_event_xml(pcmk__output_t *out, va_list args) {
stonith_history_t *event = va_arg(args, stonith_history_t *);
gboolean full_history G_GNUC_UNUSED = va_arg(args, gboolean);
gboolean later_succeeded G_GNUC_UNUSED = va_arg(args, gboolean);
@@ -362,8 +362,8 @@ stonith__event_xml(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("validate", "const char *", "const char *", "char *", "char *", "int")
-int
-stonith__validate_agent_html(pcmk__output_t *out, va_list args) {
+static int
+validate_agent_html(pcmk__output_t *out, va_list args) {
const char *agent = va_arg(args, const char *);
const char *device = va_arg(args, const char *);
char *output = va_arg(args, char *);
@@ -387,8 +387,8 @@ stonith__validate_agent_html(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("validate", "const char *", "const char *", "char *", "char *", "int")
-int
-stonith__validate_agent_text(pcmk__output_t *out, va_list args) {
+static int
+validate_agent_text(pcmk__output_t *out, va_list args) {
const char *agent = va_arg(args, const char *);
const char *device = va_arg(args, const char *);
char *output = va_arg(args, char *);
@@ -408,8 +408,8 @@ stonith__validate_agent_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("validate", "const char *", "const char *", "char *", "char *", "int")
-int
-stonith__validate_agent_xml(pcmk__output_t *out, va_list args) {
+static int
+validate_agent_xml(pcmk__output_t *out, va_list args) {
const char *agent = va_arg(args, const char *);
const char *device = va_arg(args, const char *);
char *output = va_arg(args, char *);
@@ -436,20 +436,20 @@ static pcmk__message_entry_t fmt_functions[] = {
{ "failed-fencing-list", "default", stonith__failed_history },
{ "fencing-list", "default", stonith__history },
{ "full-fencing-list", "default", stonith__full_history },
- { "full-fencing-list", "xml", stonith__full_history_xml },
- { "last-fenced", "html", stonith__last_fenced_html },
- { "last-fenced", "log", stonith__last_fenced_text },
- { "last-fenced", "text", stonith__last_fenced_text },
- { "last-fenced", "xml", stonith__last_fenced_xml },
+ { "full-fencing-list", "xml", full_history_xml },
+ { "last-fenced", "html", last_fenced_html },
+ { "last-fenced", "log", last_fenced_text },
+ { "last-fenced", "text", last_fenced_text },
+ { "last-fenced", "xml", last_fenced_xml },
{ "pending-fencing-list", "default", stonith__pending_actions },
- { "stonith-event", "html", stonith__event_html },
- { "stonith-event", "log", stonith__event_text },
- { "stonith-event", "text", stonith__event_text },
- { "stonith-event", "xml", stonith__event_xml },
- { "validate", "html", stonith__validate_agent_html },
- { "validate", "log", stonith__validate_agent_text },
- { "validate", "text", stonith__validate_agent_text },
- { "validate", "xml", stonith__validate_agent_xml },
+ { "stonith-event", "html", stonith_event_html },
+ { "stonith-event", "log", stonith_event_text },
+ { "stonith-event", "text", stonith_event_text },
+ { "stonith-event", "xml", stonith_event_xml },
+ { "validate", "html", validate_agent_html },
+ { "validate", "log", validate_agent_text },
+ { "validate", "text", validate_agent_text },
+ { "validate", "xml", validate_agent_xml },
{ NULL, NULL, NULL }
};
diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c
index 1b57f64..5562eb6 100644
--- a/lib/pengine/pe_output.c
+++ b/lib/pengine/pe_output.c
@@ -273,8 +273,8 @@ pe__cluster_summary(pcmk__output_t *out, va_list args) {
PCMK__OUTPUT_ARGS("cluster-summary", "pe_working_set_t *", "gboolean", "gboolean", "gboolean",
"gboolean", "gboolean", "gboolean")
-int
-pe__cluster_summary_html(pcmk__output_t *out, va_list args) {
+static int
+cluster_summary_html(pcmk__output_t *out, va_list args) {
pe_working_set_t *data_set = va_arg(args, pe_working_set_t *);
gboolean print_clone_detail = va_arg(args, gboolean);
gboolean show_stack = va_arg(args, gboolean);
@@ -427,8 +427,8 @@ pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name
}
PCMK__OUTPUT_ARGS("ban", "pe_node_t *", "pe__location_t *", "gboolean")
-int
-pe__ban_html(pcmk__output_t *out, va_list args) {
+static int
+ban_html(pcmk__output_t *out, va_list args) {
pe_node_t *pe_node = va_arg(args, pe_node_t *);
pe__location_t *location = va_arg(args, pe__location_t *);
gboolean print_clone_detail = va_arg(args, gboolean);
@@ -464,8 +464,8 @@ pe__ban_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("ban", "pe_node_t *", "pe__location_t *", "gboolean")
-int
-pe__ban_xml(pcmk__output_t *out, va_list args) {
+static int
+ban_xml(pcmk__output_t *out, va_list args) {
pe_node_t *pe_node = va_arg(args, pe_node_t *);
pe__location_t *location = va_arg(args, pe__location_t *);
gboolean print_clone_detail G_GNUC_UNUSED = va_arg(args, gboolean);
@@ -485,8 +485,8 @@ pe__ban_xml(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("cluster-counts", "unsigned int", "int", "int", "int")
-int
-pe__cluster_counts_html(pcmk__output_t *out, va_list args) {
+static int
+cluster_counts_html(pcmk__output_t *out, va_list args) {
unsigned int nnodes = va_arg(args, unsigned int);
int nresources = va_arg(args, int);
int ndisabled = va_arg(args, int);
@@ -581,8 +581,8 @@ pe__cluster_counts_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("cluster-counts", "unsigned int", "int", "int", "int")
-int
-pe__cluster_counts_xml(pcmk__output_t *out, va_list args) {
+static int
+cluster_counts_xml(pcmk__output_t *out, va_list args) {
unsigned int nnodes = va_arg(args, unsigned int);
int nresources = va_arg(args, int);
int ndisabled = va_arg(args, int);
@@ -611,8 +611,8 @@ pe__cluster_counts_xml(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("cluster-dc", "pe_node_t *", "const char *", "const char *", "char *")
-int
-pe__cluster_dc_html(pcmk__output_t *out, va_list args) {
+static int
+cluster_dc_html(pcmk__output_t *out, va_list args) {
pe_node_t *dc = va_arg(args, pe_node_t *);
const char *quorum = va_arg(args, const char *);
const char *dc_version_s = va_arg(args, const char *);
@@ -664,8 +664,8 @@ pe__cluster_dc_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("cluster-dc", "pe_node_t *", "const char *", "const char *", "char *")
-int
-pe__cluster_dc_xml(pcmk__output_t *out, va_list args) {
+static int
+cluster_dc_xml(pcmk__output_t *out, va_list args) {
pe_node_t *dc = va_arg(args, pe_node_t *);
const char *quorum = va_arg(args, const char *);
const char *dc_version_s = va_arg(args, const char *);
@@ -707,8 +707,8 @@ pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("cluster-options", "pe_working_set_t *")
-int
-pe__cluster_options_html(pcmk__output_t *out, va_list args) {
+static int
+cluster_options_html(pcmk__output_t *out, va_list args) {
pe_working_set_t *data_set = va_arg(args, pe_working_set_t *);
out->list_item(out, NULL, "STONITH of failed nodes %s",
@@ -762,8 +762,8 @@ pe__cluster_options_html(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("cluster-options", "pe_working_set_t *")
-int
-pe__cluster_options_log(pcmk__output_t *out, va_list args) {
+static int
+cluster_options_log(pcmk__output_t *out, va_list args) {
pe_working_set_t *data_set = va_arg(args, pe_working_set_t *);
if (pcmk_is_set(data_set->flags, pe_flag_maintenance_mode)) {
@@ -815,8 +815,8 @@ pe__cluster_options_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("cluster-options", "pe_working_set_t *")
-int
-pe__cluster_options_xml(pcmk__output_t *out, va_list args) {
+static int
+cluster_options_xml(pcmk__output_t *out, va_list args) {
pe_working_set_t *data_set = va_arg(args, pe_working_set_t *);
const char *no_quorum_policy = NULL;
@@ -854,8 +854,8 @@ pe__cluster_options_xml(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("cluster-stack", "const char *")
-int
-pe__cluster_stack_html(pcmk__output_t *out, va_list args) {
+static int
+cluster_stack_html(pcmk__output_t *out, va_list args) {
const char *stack_s = va_arg(args, const char *);
xmlNodePtr node = pcmk__output_create_xml_node(out, "li", NULL);
@@ -876,8 +876,8 @@ pe__cluster_stack_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("cluster-stack", "const char *")
-int
-pe__cluster_stack_xml(pcmk__output_t *out, va_list args) {
+static int
+cluster_stack_xml(pcmk__output_t *out, va_list args) {
const char *stack_s = va_arg(args, const char *);
pcmk__output_create_xml_node(out, "stack",
@@ -888,8 +888,8 @@ pe__cluster_stack_xml(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("cluster-times", "const char *", "const char *", "const char *", "const char *")
-int
-pe__cluster_times_html(pcmk__output_t *out, va_list args) {
+static int
+cluster_times_html(pcmk__output_t *out, va_list args) {
const char *last_written = va_arg(args, const char *);
const char *user = va_arg(args, const char *);
const char *client = va_arg(args, const char *);
@@ -912,8 +912,8 @@ pe__cluster_times_html(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("cluster-times", "const char *", "const char *", "const char *", "const char *")
-int
-pe__cluster_times_xml(pcmk__output_t *out, va_list args) {
+static int
+cluster_times_xml(pcmk__output_t *out, va_list args) {
const char *last_written = va_arg(args, const char *);
const char *user = va_arg(args, const char *);
const char *client = va_arg(args, const char *);
@@ -962,8 +962,8 @@ pe__failed_action_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("failed-action", "xmlNodePtr")
-int
-pe__failed_action_xml(pcmk__output_t *out, va_list args) {
+static int
+failed_action_xml(pcmk__output_t *out, va_list args) {
xmlNodePtr xml_op = va_arg(args, xmlNodePtr);
const char *op_key = crm_element_value(xml_op, XML_LRM_ATTR_TASK_KEY);
@@ -1249,8 +1249,8 @@ pe__node_attribute_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("node-attribute", "const char *", "const char *", "gboolean", "int")
-int
-pe__node_attribute_html(pcmk__output_t *out, va_list args) {
+static int
+node_attribute_html(pcmk__output_t *out, va_list args) {
const char *name = va_arg(args, const char *);
const char *value = va_arg(args, const char *);
gboolean add_extra = va_arg(args, gboolean);
@@ -1279,8 +1279,8 @@ pe__node_attribute_html(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("node-and-op", "pe_working_set_t *", "xmlNodePtr")
-int
-pe__node_and_op(pcmk__output_t *out, va_list args) {
+static int
+node_and_op(pcmk__output_t *out, va_list args) {
pe_working_set_t *data_set = va_arg(args, pe_working_set_t *);
xmlNodePtr xml_op = va_arg(args, xmlNodePtr);
@@ -1333,8 +1333,8 @@ pe__node_and_op(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("node-and-op", "pe_working_set_t *", "xmlNodePtr")
-int
-pe__node_and_op_xml(pcmk__output_t *out, va_list args) {
+static int
+node_and_op_xml(pcmk__output_t *out, va_list args) {
pe_working_set_t *data_set = va_arg(args, pe_working_set_t *);
xmlNodePtr xml_op = va_arg(args, xmlNodePtr);
@@ -1381,8 +1381,8 @@ pe__node_and_op_xml(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("node-attribute", "const char *", "const char *", "gboolean", "int")
-int
-pe__node_attribute_xml(pcmk__output_t *out, va_list args) {
+static int
+node_attribute_xml(pcmk__output_t *out, va_list args) {
const char *name = va_arg(args, const char *);
const char *value = va_arg(args, const char *);
gboolean add_extra = va_arg(args, gboolean);
@@ -1403,8 +1403,8 @@ pe__node_attribute_xml(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("node-list", "GList *", "GList *", "GList *", "unsigned int", "gboolean", "gboolean", "gboolean")
-int
-pe__node_list_html(pcmk__output_t *out, va_list args) {
+static int
+node_list_html(pcmk__output_t *out, va_list args) {
GList *nodes = va_arg(args, GList *);
GList *only_node = va_arg(args, GList *);
GList *only_rsc = va_arg(args, GList *);
@@ -1572,8 +1572,8 @@ pe__node_list_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("node-list", "GList *", "GList *", "GList *", "unsigned int", "gboolean", "gboolean", "gboolean")
-int
-pe__node_list_xml(pcmk__output_t *out, va_list args) {
+static int
+node_list_xml(pcmk__output_t *out, va_list args) {
GList *nodes = va_arg(args, GList *);
GList *only_node = va_arg(args, GList *);
GList *only_rsc = va_arg(args, GList *);
@@ -1616,8 +1616,8 @@ pe__op_history_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("op-history", "xmlNodePtr", "const char *", "const char *", "int", "gboolean")
-int
-pe__op_history_xml(pcmk__output_t *out, va_list args) {
+static int
+op_history_xml(pcmk__output_t *out, va_list args) {
xmlNodePtr xml_op = va_arg(args, xmlNodePtr);
const char *task = va_arg(args, const char *);
const char *interval_ms_s = va_arg(args, const char *);
@@ -1676,7 +1676,8 @@ pe__op_history_xml(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("resource-config", "pe_resource_t *", "gboolean")
-int pe__resource_config(pcmk__output_t *out, va_list args) {
+static int
+resource_config(pcmk__output_t *out, va_list args) {
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
gboolean raw = va_arg(args, gboolean);
@@ -1718,8 +1719,8 @@ pe__resource_history_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("resource-history", "pe_resource_t *", "const char *", "gboolean", "int", "time_t", "gboolean")
-int
-pe__resource_history_xml(pcmk__output_t *out, va_list args) {
+static int
+resource_history_xml(pcmk__output_t *out, va_list args) {
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
const char *rsc_id = va_arg(args, const char *);
gboolean all = va_arg(args, gboolean);
@@ -1762,8 +1763,8 @@ pe__resource_history_xml(pcmk__output_t *out, va_list args) {
PCMK__OUTPUT_ARGS("resource-list", "pe_working_set_t *", "unsigned int", "gboolean",
"gboolean", "gboolean", "gboolean", "GList *", "GList *", "gboolean")
-int
-pe__resource_list(pcmk__output_t *out, va_list args)
+static int
+resource_list(pcmk__output_t *out, va_list args)
{
pe_working_set_t *data_set = va_arg(args, pe_working_set_t *);
unsigned int print_opts = va_arg(args, unsigned int);
@@ -1861,8 +1862,8 @@ pe__resource_list(pcmk__output_t *out, va_list args)
}
PCMK__OUTPUT_ARGS("ticket", "pe_ticket_t *")
-int
-pe__ticket_html(pcmk__output_t *out, va_list args) {
+static int
+ticket_html(pcmk__output_t *out, va_list args) {
pe_ticket_t *ticket = va_arg(args, pe_ticket_t *);
if (ticket->last_granted > -1) {
@@ -1903,8 +1904,8 @@ pe__ticket_text(pcmk__output_t *out, va_list args) {
}
PCMK__OUTPUT_ARGS("ticket", "pe_ticket_t *")
-int
-pe__ticket_xml(pcmk__output_t *out, va_list args) {
+static int
+ticket_xml(pcmk__output_t *out, va_list args) {
pe_ticket_t *ticket = va_arg(args, pe_ticket_t *);
xmlNodePtr node = NULL;
@@ -1923,10 +1924,10 @@ pe__ticket_xml(pcmk__output_t *out, va_list args) {
}
static pcmk__message_entry_t fmt_functions[] = {
- { "ban", "html", pe__ban_html },
+ { "ban", "html", ban_html },
{ "ban", "log", pe__ban_text },
{ "ban", "text", pe__ban_text },
- { "ban", "xml", pe__ban_xml },
+ { "ban", "xml", ban_xml },
{ "bundle", "xml", pe__bundle_xml },
{ "bundle", "html", pe__bundle_html },
{ "bundle", "text", pe__bundle_text },
@@ -1935,30 +1936,30 @@ static pcmk__message_entry_t fmt_functions[] = {
{ "clone", "html", pe__clone_html },
{ "clone", "text", pe__clone_text },
{ "clone", "log", pe__clone_text },
- { "cluster-counts", "html", pe__cluster_counts_html },
+ { "cluster-counts", "html", cluster_counts_html },
{ "cluster-counts", "log", pe__cluster_counts_text },
{ "cluster-counts", "text", pe__cluster_counts_text },
- { "cluster-counts", "xml", pe__cluster_counts_xml },
- { "cluster-dc", "html", pe__cluster_dc_html },
+ { "cluster-counts", "xml", cluster_counts_xml },
+ { "cluster-dc", "html", cluster_dc_html },
{ "cluster-dc", "log", pe__cluster_dc_text },
{ "cluster-dc", "text", pe__cluster_dc_text },
- { "cluster-dc", "xml", pe__cluster_dc_xml },
- { "cluster-options", "html", pe__cluster_options_html },
- { "cluster-options", "log", pe__cluster_options_log },
+ { "cluster-dc", "xml", cluster_dc_xml },
+ { "cluster-options", "html", cluster_options_html },
+ { "cluster-options", "log", cluster_options_log },
{ "cluster-options", "text", pe__cluster_options_text },
- { "cluster-options", "xml", pe__cluster_options_xml },
+ { "cluster-options", "xml", cluster_options_xml },
{ "cluster-summary", "default", pe__cluster_summary },
- { "cluster-summary", "html", pe__cluster_summary_html },
- { "cluster-stack", "html", pe__cluster_stack_html },
+ { "cluster-summary", "html", cluster_summary_html },
+ { "cluster-stack", "html", cluster_stack_html },
{ "cluster-stack", "log", pe__cluster_stack_text },
{ "cluster-stack", "text", pe__cluster_stack_text },
- { "cluster-stack", "xml", pe__cluster_stack_xml },
- { "cluster-times", "html", pe__cluster_times_html },
+ { "cluster-stack", "xml", cluster_stack_xml },
+ { "cluster-times", "html", cluster_times_html },
{ "cluster-times", "log", pe__cluster_times_text },
{ "cluster-times", "text", pe__cluster_times_text },
- { "cluster-times", "xml", pe__cluster_times_xml },
+ { "cluster-times", "xml", cluster_times_xml },
{ "failed-action", "default", pe__failed_action_text },
- { "failed-action", "xml", pe__failed_action_xml },
+ { "failed-action", "xml", failed_action_xml },
{ "group", "xml", pe__group_xml },
{ "group", "html", pe__group_html },
{ "group", "text", pe__group_text },
@@ -1968,30 +1969,30 @@ static pcmk__message_entry_t fmt_functions[] = {
{ "node", "log", pe__node_text },
{ "node", "text", pe__node_text },
{ "node", "xml", pe__node_xml },
- { "node-and-op", "default", pe__node_and_op },
- { "node-and-op", "xml", pe__node_and_op_xml },
- { "node-list", "html", pe__node_list_html },
+ { "node-and-op", "default", node_and_op },
+ { "node-and-op", "xml", node_and_op_xml },
+ { "node-list", "html", node_list_html },
{ "node-list", "log", pe__node_list_text },
{ "node-list", "text", pe__node_list_text },
- { "node-list", "xml", pe__node_list_xml },
- { "node-attribute", "html", pe__node_attribute_html },
+ { "node-list", "xml", node_list_xml },
+ { "node-attribute", "html", node_attribute_html },
{ "node-attribute", "log", pe__node_attribute_text },
{ "node-attribute", "text", pe__node_attribute_text },
- { "node-attribute", "xml", pe__node_attribute_xml },
+ { "node-attribute", "xml", node_attribute_xml },
{ "op-history", "default", pe__op_history_text },
- { "op-history", "xml", pe__op_history_xml },
+ { "op-history", "xml", op_history_xml },
{ "primitive", "xml", pe__resource_xml },
{ "primitive", "html", pe__resource_html },
{ "primitive", "text", pe__resource_text },
{ "primitive", "log", pe__resource_text },
- { "resource-config", "default", pe__resource_config },
+ { "resource-config", "default", resource_config },
{ "resource-history", "default", pe__resource_history_text },
- { "resource-history", "xml", pe__resource_history_xml },
- { "resource-list", "default", pe__resource_list },
- { "ticket", "html", pe__ticket_html },
+ { "resource-history", "xml", resource_history_xml },
+ { "resource-list", "default", resource_list },
+ { "ticket", "html", ticket_html },
{ "ticket", "log", pe__ticket_text },
{ "ticket", "text", pe__ticket_text },
- { "ticket", "xml", pe__ticket_xml },
+ { "ticket", "xml", ticket_xml },
{ NULL, NULL, NULL }
};
--
1.8.3.1