This source file includes following definitions.
- pcmk__format_result
1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__COMMON_RESULTS_INTERNAL__H
11 #define PCMK__COMMON_RESULTS_INTERNAL__H
12
13 #include <glib.h>
14
15
16
17 GQuark pcmk__rc_error_quark(void);
18 GQuark pcmk__exitc_error_quark(void);
19
20 #define PCMK__RC_ERROR pcmk__rc_error_quark()
21 #define PCMK__EXITC_ERROR pcmk__exitc_error_quark()
22
23
24
25 typedef struct {
26 int exit_status;
27 enum pcmk_exec_status execution_status;
28 char *exit_reason;
29 char *action_stdout;
30 char *action_stderr;
31 } pcmk__action_result_t;
32
33
34
35
36
37
38
39
40 #define PCMK__UNKNOWN_RESULT { \
41 .exit_status = CRM_EX_OK, \
42 .execution_status = PCMK_EXEC_UNKNOWN, \
43 .exit_reason = NULL, \
44 .action_stdout = NULL, \
45 .action_stderr = NULL, \
46 }
47
48 void pcmk__set_result(pcmk__action_result_t *result, int exit_status,
49 enum pcmk_exec_status exec_status,
50 const char *exit_reason);
51
52 void pcmk__format_result(pcmk__action_result_t *result, int exit_status,
53 enum pcmk_exec_status exec_status,
54 const char *format, ...) G_GNUC_PRINTF(4, 5);
55
56 void pcmk__set_result_output(pcmk__action_result_t *result,
57 char *out, char *err);
58
59 void pcmk__reset_result(pcmk__action_result_t *result);
60
61 void pcmk__copy_result(pcmk__action_result_t *src, pcmk__action_result_t *dst);
62
63
64
65
66
67
68
69
70
71
72 static inline bool
73 pcmk__result_ok(const pcmk__action_result_t *result)
74 {
75 return (result != NULL) && (result->exit_status == CRM_EX_OK)
76 && (result->execution_status == PCMK_EXEC_DONE);
77 }
78
79 #endif