root/lib/pacemaker/pcmk_output.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. pcmk__out_prologue
  2. pcmk__out_epilogue

   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/results.h>
  12 #include <crm/common/output_internal.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 
  18 pcmk__supported_format_t pcmk__out_formats[] = {
  19     PCMK__SUPPORTED_FORMAT_XML,
  20     { NULL, NULL, NULL }
  21 };
  22 
  23 int
  24 pcmk__out_prologue(pcmk__output_t **out, xmlNodePtr *xml) {
     /* [previous][next][first][last][top][bottom][index][help] */
  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 
  37     stonith__register_messages(*out);
  38     return rc;
  39 }
  40 
  41 void
  42 pcmk__out_epilogue(pcmk__output_t *out, xmlNodePtr *xml, int retval) {
     /* [previous][next][first][last][top][bottom][index][help] */
  43     if (retval == pcmk_rc_ok) {
  44         out->finish(out, 0, FALSE, (void **) xml);
  45     }
  46 
  47     pcmk__output_free(out);
  48 }

/* [previous][next][first][last][top][bottom][index][help] */