pacemaker
2.0.2-debe490
Scalable High-Availability cluster resource manager
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
crm
common
xml_internal.h
Go to the documentation of this file.
1
/*
2
* Copyright 2017-2018 the Pacemaker project contributors
3
*
4
* The version control history for this file may have further details.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
10
*
11
* This software is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
#ifndef CRM_COMMON_XML_INTERNAL__H
21
# define CRM_COMMON_XML_INTERNAL__H
22
23
/*
24
* Internal-only wrappers for and extensions to libxml2 (libxslt)
25
*/
26
27
# include <stdlib.h>
28
# include <stdio.h>
29
# include <string.h>
30
31
# include <
crm/crm.h
>
/* transitively imports qblog.h */
32
33
77
#define CRM_XML_LOG_BASE(priority, dechunk, postemit, prefix, fmt, ap) \
78
do { \
79
if (!(dechunk) && (prefix) == NULL) {
/* quick pass */
\
80
qb_log_from_external_source_va(__FUNCTION__, __FILE__, (fmt), \
81
(priority), __LINE__, 0, (ap)); \
82
(void) (postemit); \
83
} else { \
84
int CXLB_len = 0; \
85
char *CXLB_buf = NULL; \
86
static int CXLB_buffer_len = 0; \
87
static char *CXLB_buffer = NULL; \
88
static uint8_t CXLB_priority = 0; \
89
\
90
CXLB_len = vasprintf(&CXLB_buf, (fmt), (ap)); \
91
\
92
if (CXLB_len <= 0 || CXLB_buf[CXLB_len - 1] == '\n' || !(dechunk)) { \
93
if (CXLB_len < 0) { \
94
CXLB_buf = (char *) "LOG CORRUPTION HAZARD";
/*we don't modify*/
\
95
CXLB_priority = QB_MIN(CXLB_priority, LOG_ERR); \
96
} else if (CXLB_len > 0
/* && (dechunk) */
\
97
&& CXLB_buf[CXLB_len - 1] == '\n') { \
98
CXLB_buf[CXLB_len - 1] = '\0'; \
99
} \
100
if (CXLB_buffer) { \
101
qb_log_from_external_source(__FUNCTION__, __FILE__, "%s%s%s", \
102
CXLB_priority, __LINE__, 0, \
103
(prefix) != NULL ? (prefix) : "", \
104
CXLB_buffer, CXLB_buf); \
105
free(CXLB_buffer); \
106
} else { \
107
qb_log_from_external_source(__FUNCTION__, __FILE__, "%s%s", \
108
(priority), __LINE__, 0, \
109
(prefix) != NULL ? (prefix) : "", \
110
CXLB_buf); \
111
} \
112
if (CXLB_len < 0) { \
113
CXLB_buf = NULL;
/* restore temporary override */
\
114
} \
115
CXLB_buffer = NULL; \
116
CXLB_buffer_len = 0; \
117
(void) (postemit); \
118
\
119
} else if (CXLB_buffer == NULL) { \
120
CXLB_buffer_len = CXLB_len; \
121
CXLB_buffer = CXLB_buf; \
122
CXLB_buf = NULL; \
123
CXLB_priority = (priority);
/* remember as a running severest */
\
124
\
125
} else { \
126
CXLB_buffer = realloc(CXLB_buffer, 1 + CXLB_buffer_len + CXLB_len); \
127
memcpy(CXLB_buffer + CXLB_buffer_len, CXLB_buf, CXLB_len); \
128
CXLB_buffer_len += CXLB_len; \
129
CXLB_buffer[CXLB_buffer_len] = '\0'; \
130
CXLB_priority = QB_MIN(CXLB_priority, (priority));
/* severest? */
\
131
} \
132
free(CXLB_buf); \
133
} \
134
} while (0)
135
136
#endif
crm.h
A dumping ground.
Generated on Mon Jun 10 2019 11:50:45 for pacemaker by
1.8.5