Skip to content

Commit

Permalink
Merge pull request #1937 from clumens/output-pedantry
Browse files Browse the repository at this point in the history
Fix output-related types
  • Loading branch information
kgaillot authored Dec 3, 2019
2 parents d671faa + eaaa209 commit 92b0c1d
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 61 deletions.
18 changes: 10 additions & 8 deletions lib/fencing/st_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ last_fenced_xml(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 *);
int full_history = va_arg(args, int);
gboolean full_history = va_arg(args, gboolean);
gboolean later_succeeded = va_arg(args, gboolean);

switch(event->state) {
Expand Down Expand Up @@ -123,7 +123,7 @@ stonith_event_html(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 *);
int full_history = va_arg(args, int);
gboolean full_history = va_arg(args, gboolean);
gboolean later_succeeded = va_arg(args, gboolean);

char *buf = time_t_string(event->completed);
Expand Down Expand Up @@ -161,6 +161,8 @@ static int
stonith_event_xml(pcmk__output_t *out, va_list args) {
xmlNodePtr node = pcmk__output_create_xml_node(out, "fence_event");
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);

char *buf = NULL;

Expand Down Expand Up @@ -204,8 +206,8 @@ 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 *);
const char *output = va_arg(args, const char *);
const char *error_output = va_arg(args, const char *);
char *output = va_arg(args, char *);
char *error_output = va_arg(args, char *);
int rc = va_arg(args, int);

if (device) {
Expand All @@ -228,8 +230,8 @@ 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 *);
const char *output = va_arg(args, const char *);
const char *error_output = va_arg(args, const char *);
char *output = va_arg(args, char *);
char *error_output = va_arg(args, char *);
int rc = va_arg(args, int);

if (device) {
Expand Down Expand Up @@ -257,8 +259,8 @@ 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 *);
const char *output = va_arg(args, const char *);
const char *error_output = va_arg(args, const char *);
char *output = va_arg(args, char *);
char *error_output = va_arg(args, char *);
int rc = va_arg(args, int);

xmlSetProp(node, (pcmkXmlStr) "agent", (pcmkXmlStr) agent);
Expand Down
12 changes: 6 additions & 6 deletions lib/pengine/bundle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,8 +1497,8 @@ bundle_print_xml(pe_resource_t *rsc, const char *pre_text, long options,
int
pe__bundle_xml(pcmk__output_t *out, va_list args)
{
long options = va_arg(args, int);
resource_t *rsc = va_arg(args, resource_t *);
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
pe__bundle_variant_data_t *bundle_data = NULL;
int rc = 0;

Expand Down Expand Up @@ -1579,8 +1579,8 @@ pe__bundle_replica_output_html(pcmk__output_t *out, pe__bundle_replica_t *replic
int
pe__bundle_html(pcmk__output_t *out, va_list args)
{
long options = va_arg(args, int);
resource_t *rsc = va_arg(args, resource_t *);
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
pe__bundle_variant_data_t *bundle_data = NULL;
char buffer[LINE_MAX];

Expand Down Expand Up @@ -1669,8 +1669,8 @@ pe__bundle_replica_output_text(pcmk__output_t *out, pe__bundle_replica_t *replic
int
pe__bundle_text(pcmk__output_t *out, va_list args)
{
long options = va_arg(args, int);
resource_t *rsc = va_arg(args, resource_t *);
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);

pe__bundle_variant_data_t *bundle_data = NULL;

Expand Down
18 changes: 9 additions & 9 deletions lib/pengine/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,8 @@ clone_print(resource_t * rsc, const char *pre_text, long options, void *print_da
int
pe__clone_xml(pcmk__output_t *out, va_list args)
{
long options = va_arg(args, long);
resource_t *rsc = va_arg(args, resource_t *);
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);

GListPtr gIter = rsc->children;

Expand All @@ -586,7 +586,7 @@ pe__clone_xml(pcmk__output_t *out, va_list args)
CRM_ASSERT(rc == 0);

for (; gIter != NULL; gIter = gIter->next) {
resource_t *child_rsc = (resource_t *) gIter->data;
pe_resource_t *child_rsc = (pe_resource_t *) gIter->data;

out->message(out, crm_map_element_name(child_rsc->xml), options, child_rsc);
}
Expand All @@ -598,8 +598,8 @@ pe__clone_xml(pcmk__output_t *out, va_list args)
int
pe__clone_html(pcmk__output_t *out, va_list args)
{
long options = va_arg(args, long);
resource_t *rsc = va_arg(args, resource_t *);
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);

char *list_text = NULL;
char *stopped_list = NULL;
Expand All @@ -621,7 +621,7 @@ pe__clone_html(pcmk__output_t *out, va_list args)

for (; gIter != NULL; gIter = gIter->next) {
gboolean print_full = FALSE;
resource_t *child_rsc = (resource_t *) gIter->data;
pe_resource_t *child_rsc = (pe_resource_t *) gIter->data;
gboolean partially_active = child_rsc->fns->active(child_rsc, FALSE);

if (options & pe_print_clone_details) {
Expand Down Expand Up @@ -785,8 +785,8 @@ pe__clone_html(pcmk__output_t *out, va_list args)
int
pe__clone_text(pcmk__output_t *out, va_list args)
{
long options = va_arg(args, long);
resource_t *rsc = va_arg(args, resource_t *);
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);

char *list_text = NULL;
char *stopped_list = NULL;
Expand All @@ -808,7 +808,7 @@ pe__clone_text(pcmk__output_t *out, va_list args)

for (; gIter != NULL; gIter = gIter->next) {
gboolean print_full = FALSE;
resource_t *child_rsc = (resource_t *) gIter->data;
pe_resource_t *child_rsc = (pe_resource_t *) gIter->data;
gboolean partially_active = child_rsc->fns->active(child_rsc, FALSE);

if (options & pe_print_clone_details) {
Expand Down
18 changes: 9 additions & 9 deletions lib/pengine/group.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ group_print(resource_t * rsc, const char *pre_text, long options, void *print_da
int
pe__group_xml(pcmk__output_t *out, va_list args)
{
long options = va_arg(args, long);
resource_t *rsc = va_arg(args, resource_t *);
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);

GListPtr gIter = rsc->children;
char *count = crm_itoa(g_list_length(gIter));
Expand All @@ -199,7 +199,7 @@ pe__group_xml(pcmk__output_t *out, va_list args)
CRM_ASSERT(rc == 0);

for (; gIter != NULL; gIter = gIter->next) {
resource_t *child_rsc = (resource_t *) gIter->data;
pe_resource_t *child_rsc = (pe_resource_t *) gIter->data;

out->message(out, crm_map_element_name(child_rsc->xml), options, child_rsc);
}
Expand All @@ -211,8 +211,8 @@ pe__group_xml(pcmk__output_t *out, va_list args)
int
pe__group_html(pcmk__output_t *out, va_list args)
{
long options = va_arg(args, long);
resource_t *rsc = va_arg(args, resource_t *);
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);

out->begin_list(out, NULL, NULL, "Resource Group: %s", rsc->id);

Expand All @@ -221,7 +221,7 @@ pe__group_html(pcmk__output_t *out, va_list args)

} else {
for (GListPtr gIter = rsc->children; gIter; gIter = gIter->next) {
resource_t *child_rsc = (resource_t *) gIter->data;
pe_resource_t *child_rsc = (pe_resource_t *) gIter->data;
out->message(out, crm_map_element_name(child_rsc->xml), options, child_rsc);
}
}
Expand All @@ -234,8 +234,8 @@ pe__group_html(pcmk__output_t *out, va_list args)
int
pe__group_text(pcmk__output_t *out, va_list args)
{
long options = va_arg(args, long);
resource_t *rsc = va_arg(args, resource_t *);
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);

out->begin_list(out, NULL, NULL, "Resource Group: %s", rsc->id);

Expand All @@ -244,7 +244,7 @@ pe__group_text(pcmk__output_t *out, va_list args)

} else {
for (GListPtr gIter = rsc->children; gIter; gIter = gIter->next) {
resource_t *child_rsc = (resource_t *) gIter->data;
pe_resource_t *child_rsc = (pe_resource_t *) gIter->data;

out->message(out, crm_map_element_name(child_rsc->xml), options, child_rsc);
}
Expand Down
12 changes: 6 additions & 6 deletions lib/pengine/native.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,8 +1072,8 @@ native_print(resource_t * rsc, const char *pre_text, long options, void *print_d
int
pe__resource_xml(pcmk__output_t *out, va_list args)
{
long options = va_arg(args, int);
resource_t *rsc = va_arg(args, resource_t *);
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);

const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS);
const char *prov = crm_element_value(rsc->xml, XML_AGENT_ATTR_PROVIDER);
Expand Down Expand Up @@ -1139,8 +1139,8 @@ pe__resource_xml(pcmk__output_t *out, va_list args)
int
pe__resource_html(pcmk__output_t *out, va_list args)
{
long options = va_arg(args, int);
resource_t *rsc = va_arg(args, resource_t *);
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
node_t *node = pe__current_node(rsc);

CRM_ASSERT(rsc->variant == pe_native);
Expand All @@ -1156,8 +1156,8 @@ pe__resource_html(pcmk__output_t *out, va_list args)
int
pe__resource_text(pcmk__output_t *out, va_list args)
{
long options = va_arg(args, int);
resource_t *rsc = va_arg(args, resource_t *);
unsigned int options = va_arg(args, unsigned int);
pe_resource_t *rsc = va_arg(args, pe_resource_t *);

node_t *node = pe__current_node(rsc);

Expand Down
28 changes: 14 additions & 14 deletions lib/pengine/pe_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ pe__cluster_counts_html(pcmk__output_t *out, va_list args) {
xmlNodePtr resources_node = pcmk__output_create_xml_node(out, "li");

unsigned int nnodes = va_arg(args, unsigned int);
unsigned int nresources = va_arg(args, unsigned int);
unsigned int ndisabled = va_arg(args, unsigned int);
unsigned int nblocked = va_arg(args, unsigned int);
int nresources = va_arg(args, int);
int ndisabled = va_arg(args, int);
int nblocked = va_arg(args, int);

char *nnodes_str = crm_strdup_printf("%d node%s configured", nnodes, s_if_plural(nnodes));

Expand Down Expand Up @@ -383,9 +383,9 @@ pe__cluster_counts_html(pcmk__output_t *out, va_list args) {
int
pe__cluster_counts_text(pcmk__output_t *out, va_list args) {
unsigned int nnodes = va_arg(args, unsigned int);
unsigned int nresources = va_arg(args, unsigned int);
unsigned int ndisabled = va_arg(args, unsigned int);
unsigned int nblocked = va_arg(args, unsigned int);
int nresources = va_arg(args, int);
int ndisabled = va_arg(args, int);
int nblocked = va_arg(args, int);

out->list_item(out, NULL, "%d node%s configured", nnodes, s_if_plural(nnodes));

Expand Down Expand Up @@ -418,9 +418,9 @@ pe__cluster_counts_xml(pcmk__output_t *out, va_list args) {
xmlNodePtr resources_node = pcmk__output_create_xml_node(out, "resources_configured");

unsigned int nnodes = va_arg(args, unsigned int);
unsigned int nresources = va_arg(args, unsigned int);
unsigned int ndisabled = va_arg(args, unsigned int);
unsigned int nblocked = va_arg(args, unsigned int);
int nresources = va_arg(args, int);
int ndisabled = va_arg(args, int);
int nblocked = va_arg(args, int);

char *s = crm_itoa(nnodes);
xmlSetProp(nodes_node, (pcmkXmlStr) "number", (pcmkXmlStr) s);
Expand Down Expand Up @@ -448,7 +448,7 @@ pe__cluster_dc_html(pcmk__output_t *out, va_list args) {
node_t *dc = va_arg(args, node_t *);
const char *quorum = va_arg(args, const char *);
const char *dc_version_s = va_arg(args, const char *);
const char *dc_name = va_arg(args, const char *);
char *dc_name = va_arg(args, char *);

pcmk_create_html_node(node, "span", NULL, "bold", "Current DC: ");

Expand Down Expand Up @@ -479,7 +479,7 @@ pe__cluster_dc_text(pcmk__output_t *out, va_list args) {
node_t *dc = va_arg(args, node_t *);
const char *quorum = va_arg(args, const char *);
const char *dc_version_s = va_arg(args, const char *);
const char *dc_name = va_arg(args, const char *);
char *dc_name = va_arg(args, char *);

if (dc) {
out->list_item(out, "Current DC", "%s (version %s) - partition %s quorum",
Expand Down Expand Up @@ -798,7 +798,7 @@ pe__node_html(pcmk__output_t *out, va_list args) {

out->begin_list(out, NULL, NULL, NULL);
for (lpc2 = node->details->running_rsc; lpc2 != NULL; lpc2 = lpc2->next) {
resource_t *rsc = (resource_t *) lpc2->data;
pe_resource_t *rsc = (pe_resource_t *) lpc2->data;
out->message(out, crm_map_element_name(rsc->xml), print_opts | pe_print_rsconly, rsc);
}
out->end_list(out);
Expand Down Expand Up @@ -847,7 +847,7 @@ pe__node_text(pcmk__output_t *out, va_list args) {
GListPtr gIter2 = NULL;

for (gIter2 = node->details->running_rsc; gIter2 != NULL; gIter2 = gIter2->next) {
resource_t *rsc = (resource_t *) gIter2->data;
pe_resource_t *rsc = (pe_resource_t *) gIter2->data;
out->message(out, crm_map_element_name(rsc->xml), print_opts | pe_print_rsconly, rsc);
}
}
Expand Down Expand Up @@ -917,7 +917,7 @@ pe__node_xml(pcmk__output_t *out, va_list args) {
GListPtr lpc = NULL;

for (lpc = node->details->running_rsc; lpc != NULL; lpc = lpc->next) {
resource_t *rsc = (resource_t *) lpc->data;
pe_resource_t *rsc = (pe_resource_t *) lpc->data;
out->message(out, crm_map_element_name(rsc->xml), print_opts | pe_print_rsconly, rsc);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/crm_mon_curses.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ curses_indented_printf(pcmk__output_t *out, const char *format, ...) {
static int
stonith_event_console(pcmk__output_t *out, va_list args) {
stonith_history_t *event = va_arg(args, stonith_history_t *);
int full_history = va_arg(args, int);
gboolean full_history = va_arg(args, gboolean);
gboolean later_succeeded = va_arg(args, gboolean);

crm_time_t *crm_when = crm_time_new(NULL);
Expand Down
Loading

0 comments on commit 92b0c1d

Please sign in to comment.