41 xml_show_patchset_header(
pcmk__output_t *out,
const xmlNode *patchset)
44 int add[] = { 0, 0, 0 };
45 int del[] = { 0, 0, 0 };
49 if ((add[0] != del[0]) || (add[1] != del[1]) || (add[2] != del[2])) {
53 out->
info(out,
"Diff: --- %d.%d.%d %s", del[0], del[1], del[2], fmt);
54 rc = out->
info(out,
"Diff: +++ %d.%d.%d %s",
55 add[0], add[1], add[2], digest);
57 }
else if ((add[0] != 0) || (add[1] != 0) || (add[2] != 0)) {
58 rc = out->
info(out,
"Local-only Change: %d.%d.%d",
59 add[0], add[1], add[2]);
82 int rc = xml_show_patchset_header(out, patchset);
102 rc = pcmk__output_select_rc(rc, temp_rc);
105 for (
char *ch = prefix + 2; *ch !=
'\0'; ch++) {
113 rc = pcmk__output_select_rc(rc, temp_rc);
119 temp_rc = out->
info(out,
122 rc = pcmk__output_select_rc(rc, temp_rc);
127 GString *buffer_set = NULL;
128 GString *buffer_unset = NULL;
141 if (strcmp(op,
"set") == 0) {
147 }
else if (strcmp(op,
"unset") == 0) {
149 g_string_append(buffer_unset,
name);
153 if (buffer_set != NULL) {
154 temp_rc = out->
info(out,
"+ %s: %s", xpath, buffer_set->str);
155 rc = pcmk__output_select_rc(rc, temp_rc);
156 g_string_free(buffer_set, TRUE);
159 if (buffer_unset != NULL) {
160 temp_rc = out->
info(out,
"-- %s: %s",
161 xpath, buffer_unset->str);
162 rc = pcmk__output_select_rc(rc, temp_rc);
163 g_string_free(buffer_unset, TRUE);
171 temp_rc = out->
info(out,
"-- %s (%d)", xpath, position);
173 temp_rc = out->
info(out,
"-- %s", xpath);
175 rc = pcmk__output_select_rc(rc, temp_rc);
197 PCMK__OUTPUT_ARGS(
"xml-patchset",
"const xmlNode *")
201 const xmlNode *patchset = va_arg(args,
const xmlNode *);
205 if (patchset == NULL) {
212 crm_err(
"Unknown patch format: %d", format);
216 return xml_show_patchset(out, patchset);
234 PCMK__OUTPUT_ARGS(
"xml-patchset",
"const xmlNode *")
238 static struct qb_log_callsite *patchset_cs = NULL;
240 const xmlNode *patchset = va_arg(args,
const xmlNode *);
249 if (patchset == NULL) {
254 if (patchset_cs == NULL) {
255 patchset_cs = qb_log_callsite_get(__func__, __FILE__,
"xml-patchset",
267 crm_err(
"Unknown patch format: %d", format);
271 return xml_show_patchset(out, patchset);
289 PCMK__OUTPUT_ARGS(
"xml-patchset",
"const xmlNode *")
293 const xmlNode *patchset = va_arg(args,
const xmlNode *);
295 if (patchset != NULL) {
296 GString *buf = g_string_sized_new(1024);
302 g_string_free(buf, TRUE);
310 {
"xml-patchset",
"default", xml_patchset_default },
311 {
"xml-patchset",
"log", xml_patchset_log },
312 {
"xml-patchset",
"xml", xml_patchset_xml },
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
void pcmk__register_messages(pcmk__output_t *out, const pcmk__message_entry_t *table)
void pcmk__xml_string(const xmlNode *data, uint32_t options, GString *buffer, int depth)
#define PCMK_VALUE_CREATE
Include the opening tag of an XML element, and include XML comments.
#define PCMK_XE_CHANGE_LIST
void pcmk__register_patchset_messages(pcmk__output_t *out)
#define PCMK__XML_PREFIX_MOVED
XML has been moved.
void pcmk__add_separated_word(GString **list, size_t init_size, const char *word, const char *separator)
int(* info)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
unsigned int crm_trace_nonlog
#define PCMK_XA_OPERATION
Include indentation and newlines.
Include the children of an XML element.
#define PCMK_VALUE_MODIFY
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define crm_trace(fmt, args...)
#define PCMK_VALUE_DELETE
void pcmk__g_strcat(GString *buffer,...) G_GNUC_NULL_TERMINATED
Wrappers for and extensions to libxml2.
#define PCMK__XML_PREFIX_CREATED
XML is newly created.
xmlNode * pcmk__xe_next(const xmlNode *node, const char *element_name)
gboolean crm_is_callsite_active(struct qb_log_callsite *cs, uint8_t level, uint32_t tags)
#define PCMK_XE_XML_PATCHSET
int pcmk__xml_show(pcmk__output_t *out, const char *prefix, const xmlNode *data, int depth, uint32_t options)
Include the closing tag of an XML element.
#define crm_err(fmt, args...)
int crm_element_value_int(const xmlNode *data, const char *name, int *dest)
Retrieve the integer value of an XML attribute.
This structure contains everything that makes up a single output formatter.
bool xml_patch_versions(const xmlNode *patchset, int add[3], int del[3])
uint8_t pcmk__output_get_log_level(const pcmk__output_t *out)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1