pacemaker
2.1.8-3980678f03
Scalable High-Availability cluster resource manager
|
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <crm/crm.h>
#include <crm/common/output_internal.h>
#include <crm/common/xml_io_internal.h>
#include <crm/common/xml_names_internal.h>
#include <libxml/relaxng.h>
Go to the source code of this file.
Macros | |
#define | PCMK__XML_LOG_BASE(priority, dechunk, postemit, prefix, fmt, ap) |
Base for directing lib{xml2,xslt} log into standard libqb backend. More... | |
#define | PCMK__XP_MEMBER_NODE_CONFIG |
#define | PCMK__XP_GUEST_NODE_CONFIG |
#define | PCMK__XP_REMOTE_NODE_CONFIG |
#define | PCMK__XP_REMOTE_NODE_STATUS |
Functions | |
int | pcmk__xml_show (pcmk__output_t *out, const char *prefix, const xmlNode *data, int depth, uint32_t options) |
int | pcmk__xml_show_changes (pcmk__output_t *out, const xmlNode *xml) |
int | pcmk__xml2fd (int fd, xmlNode *cur) |
void | pcmk__strip_xml_text (xmlNode *xml) |
const char * | pcmk__xe_add_last_written (xmlNode *xe) |
xmlNode * | pcmk__xe_first_child (const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v) |
void | pcmk__xe_remove_attr (xmlNode *element, const char *name) |
bool | pcmk__xe_remove_attr_cb (xmlNode *xml, void *user_data) |
void | pcmk__xe_remove_matching_attrs (xmlNode *element, bool(*match)(xmlAttrPtr, void *), void *user_data) |
int | pcmk__xe_delete_match (xmlNode *xml, xmlNode *search) |
int | pcmk__xe_replace_match (xmlNode *xml, xmlNode *replace) |
int | pcmk__xe_update_match (xmlNode *xml, xmlNode *update, uint32_t flags) |
GString * | pcmk__element_xpath (const xmlNode *xml) |
bool | pcmk__xml_needs_escape (const char *text, enum pcmk__xml_escape_type type) |
char * | pcmk__xml_escape (const char *text, enum pcmk__xml_escape_type type) |
char * | pcmk__xml_artefact_root (enum pcmk__xml_artefact_ns ns) |
char * | pcmk__xml_artefact_path (enum pcmk__xml_artefact_ns ns, const char *filespec) |
xmlNode * | pcmk__xe_create (xmlNode *parent, const char *name) |
xmlNode * | pcmk__xml_copy (xmlNode *parent, xmlNode *src) |
xmlNode * | pcmk__xe_next_same (const xmlNode *node) |
void | pcmk__xe_set_content (xmlNode *node, const char *format,...) G_GNUC_PRINTF(2 |
int | pcmk__xe_copy_attrs (xmlNode *target, const xmlNode *src, uint32_t flags) |
void | pcmk__xe_set_propv (xmlNodePtr node, va_list pairs) |
void | pcmk__xe_set_props (xmlNodePtr node,...) G_GNUC_NULL_TERMINATED |
char * | pcmk__xpath_node_id (const char *xpath, const char *node) |
void | pcmk__warn_multiple_name_matches (pcmk__output_t *out, xmlNode *search, const char *name) |
void | pcmk__set_xml_doc_flag (xmlNode *xml, enum xml_private_flags flag) |
int | pcmk__xe_foreach_child (xmlNode *xml, const char *child_element_name, int(*handler)(xmlNode *xml, void *userdata), void *userdata) |
bool | pcmk__xml_tree_foreach (xmlNode *xml, bool(*fn)(xmlNode *, void *), void *user_data) |
xmlNode * | pcmk__diff_v1_xml_object (xmlNode *left, xmlNode *right, bool suppress) |
#define PCMK__XML_LOG_BASE | ( | priority, | |
dechunk, | |||
postemit, | |||
prefix, | |||
fmt, | |||
ap | |||
) |
Base for directing lib{xml2,xslt} log into standard libqb backend.
This macro implements the core of what can be needed for directing libxml2 or libxslt error messaging into standard, preconfigured libqb-backed log stream.
It's a bit unfortunate that libxml2 (and more sparsely, also libxslt) emits a single message by chunks (location is emitted separatedly from the message itself), so we have to take the effort to combine these chunks back to single message. Whether to do this or not is driven with dechunk
toggle.
The form of a macro was chosen for implicit deriving of FILE, etc. and also because static dechunking buffer should be differentiated per library (here we assume different functions referring to this macro will not ever be using both at once), preferably also per-library context of use to avoid clashes altogether.
Note that we cannot use qb_logt, because callsite data have to be known at the moment of compilation, which it is not always the case – xml_log (and unfortunately there's no clear explanation of the fail to compile).
Also note that there's no explicit guard against said libraries producing never-newline-terminated chunks (which would just keep consuming memory), as it's quite improbable. Termination of the program in between the same-message chunks will raise a flag with valgrind and the likes, though.
And lastly, regarding how dechunking combines with other non-message parameters – for priority
, most important running specification wins (possibly elevated to LOG_ERR in case of nonconformance with the newline-termination "protocol"), dechunk
is expected to always be on once it was at the start, and the rest (postemit
and prefix
) are picked directly from the last chunk entry finalizing the message (also reasonable to always have it the same with all related entries).
[in] | priority | Syslog priority for the message to be logged |
[in] | dechunk | Whether to dechunk new-line terminated message |
[in] | postemit | Code to be executed once message is sent out |
[in] | prefix | How to prefix the message or NULL for raw passing |
[in] | fmt | Format string as with printf-like functions |
[in] | ap | Variable argument list to supplement fmt format string |
Definition at line 72 of file xml_internal.h.
#define PCMK__XP_GUEST_NODE_CONFIG |
Definition at line 181 of file xml_internal.h.
#define PCMK__XP_MEMBER_NODE_CONFIG |
Definition at line 175 of file xml_internal.h.
#define PCMK__XP_REMOTE_NODE_CONFIG |
Definition at line 187 of file xml_internal.h.
#define PCMK__XP_REMOTE_NODE_STATUS |
Definition at line 193 of file xml_internal.h.
enum pcmk__xa_flags |
Enumerator | |
---|---|
pcmk__xaf_none | Flag has no effect. |
pcmk__xaf_no_overwrite | Don't overwrite existing values. |
pcmk__xaf_score_update | Treat values as score updates where possible (see |
Definition at line 436 of file xml_internal.h.
Enumerator | |
---|---|
pcmk__xml_artefact_ns_legacy_rng | |
pcmk__xml_artefact_ns_legacy_xslt | |
pcmk__xml_artefact_ns_base_rng | |
pcmk__xml_artefact_ns_base_xslt |
Definition at line 207 of file xml_internal.h.
Definition at line 276 of file xml_internal.h.
Definition at line 135 of file xml_internal.h.
enum xml_private_flags |
Definition at line 519 of file xml_internal.h.
xmlNode* pcmk__diff_v1_xml_object | ( | xmlNode * | left, |
xmlNode * | right, | ||
bool | suppress | ||
) |
Definition at line 1447 of file patchset.c.
void pcmk__set_xml_doc_flag | ( | xmlNode * | xml, |
enum xml_private_flags | flag | ||
) |
void pcmk__warn_multiple_name_matches | ( | pcmk__output_t * | out, |
xmlNode * | search, | ||
const char * | name | ||
) |
int pcmk__xe_copy_attrs | ( | xmlNode * | target, |
const xmlNode * | src, | ||
uint32_t | flags | ||
) |
xmlNode* pcmk__xe_create | ( | xmlNode * | parent, |
const char * | name | ||
) |
int pcmk__xe_delete_match | ( | xmlNode * | xml, |
xmlNode * | search | ||
) |
xmlNode* pcmk__xe_first_child | ( | const xmlNode * | parent, |
const char * | node_name, | ||
const char * | attr_n, | ||
const char * | attr_v | ||
) |
int pcmk__xe_foreach_child | ( | xmlNode * | xml, |
const char * | child_element_name, | ||
int(*)(xmlNode *xml, void *userdata) | handler, | ||
void * | userdata | ||
) |
void pcmk__xe_remove_attr | ( | xmlNode * | element, |
const char * | name | ||
) |
bool pcmk__xe_remove_attr_cb | ( | xmlNode * | xml, |
void * | user_data | ||
) |
void pcmk__xe_remove_matching_attrs | ( | xmlNode * | element, |
bool(*)(xmlAttrPtr, void *) | match, | ||
void * | user_data | ||
) |
int pcmk__xe_replace_match | ( | xmlNode * | xml, |
xmlNode * | replace | ||
) |
void pcmk__xe_set_content | ( | xmlNode * | node, |
const char * | format, | ||
... | |||
) |
int pcmk__xe_update_match | ( | xmlNode * | xml, |
xmlNode * | update, | ||
uint32_t | flags | ||
) |
char* pcmk__xml_artefact_path | ( | enum pcmk__xml_artefact_ns | ns, |
const char * | filespec | ||
) |
char* pcmk__xml_artefact_root | ( | enum pcmk__xml_artefact_ns | ns | ) |
char* pcmk__xml_escape | ( | const char * | text, |
enum pcmk__xml_escape_type | type | ||
) |
bool pcmk__xml_needs_escape | ( | const char * | text, |
enum pcmk__xml_escape_type | type | ||
) |
int pcmk__xml_show | ( | pcmk__output_t * | out, |
const char * | prefix, | ||
const xmlNode * | data, | ||
int | depth, | ||
uint32_t | options | ||
) |
Definition at line 229 of file xml_display.c.
int pcmk__xml_show_changes | ( | pcmk__output_t * | out, |
const xmlNode * | xml | ||
) |
Definition at line 370 of file xml_display.c.
bool pcmk__xml_tree_foreach | ( | xmlNode * | xml, |
bool(*)(xmlNode *, void *) | fn, | ||
void * | user_data | ||
) |