pacemaker  2.0.4-2deceaa
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pcmk_output.c
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2020 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU General Public License version 2
7  * or later (GPLv2+) WITHOUT ANY WARRANTY.
8  */
9 
10 #include <crm_internal.h>
11 #include <crm/common/output.h>
12 #include <crm/common/results.h>
13 #include <crm/stonith-ng.h>
14 #include <crm/fencing/internal.h>
15 #include <libxml/tree.h>
16 #include <pcmki/pcmki_output.h>
17 
20  { NULL, NULL, NULL }
21 };
22 
23 int
24 pcmk__out_prologue(pcmk__output_t **out, xmlNodePtr *xml) {
25  int rc = pcmk_rc_ok;
26 
27  if (*xml != NULL) {
28  xmlFreeNode(*xml);
29  }
30 
31  pcmk__register_formats(NULL, pcmk__out_formats);
32  rc = pcmk__output_new(out, "xml", NULL, NULL);
33  if (rc != pcmk_rc_ok) {
34  return rc;
35  }
36 
38  return rc;
39 }
40 
41 void
42 pcmk__out_epilogue(pcmk__output_t *out, xmlNodePtr *xml, int retval) {
43  if (retval == pcmk_rc_ok) {
44  out->finish(out, 0, FALSE, (void **) xml);
45  }
46 
47  pcmk__output_free(out);
48 }
pcmk__supported_format_t pcmk__out_formats[]
Definition: pcmk_output.c:18
#define PCMK__SUPPORTED_FORMAT_XML
Definition: output.h:143
Formatted output for pacemaker tools.
void stonith__register_messages(pcmk__output_t *out)
Definition: st_output.c:525
void pcmk__output_free(pcmk__output_t *out)
Definition: output.c:19
int pcmk__out_prologue(pcmk__output_t **out, xmlNodePtr *xml)
Definition: pcmk_output.c:24
int rc
Definition: pcmk_fence.c:34
void pcmk__register_formats(GOptionGroup *group, pcmk__supported_format_t *table)
Definition: output.c:96
void pcmk__out_epilogue(pcmk__output_t *out, xmlNodePtr *xml, int retval)
Definition: pcmk_output.c:42
Function and executable result codes.
void(* finish)(pcmk__output_t *out, crm_exit_t exit_status, bool print, void **copy_dest)
Definition: output.h:262
Fencing aka. STONITH.
This structure contains everything that makes up a single output formatter.
Definition: output.h:153
int pcmk__output_new(pcmk__output_t **out, const char *fmt_name, const char *filename, char **argv)
Definition: output.c:31