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 int pcmk__result_bounds(enum pcmk_result_type, int *lower, int *upper);
18
19
20
21 extern const size_t pcmk__n_rc;
22
23
24
25 GQuark pcmk__rc_error_quark(void);
26 GQuark pcmk__exitc_error_quark(void);
27
28 #define PCMK__RC_ERROR pcmk__rc_error_quark()
29 #define PCMK__EXITC_ERROR pcmk__exitc_error_quark()
30
31
32
33 typedef struct {
34 int exit_status;
35 enum pcmk_exec_status execution_status;
36 char *exit_reason;
37 char *action_stdout;
38 char *action_stderr;
39 } pcmk__action_result_t;
40
41
42
43
44
45
46
47
48 #define PCMK__UNKNOWN_RESULT { \
49 .exit_status = CRM_EX_OK, \
50 .execution_status = PCMK_EXEC_UNKNOWN, \
51 .exit_reason = NULL, \
52 .action_stdout = NULL, \
53 .action_stderr = NULL, \
54 }
55
56 void pcmk__set_result(pcmk__action_result_t *result, int exit_status,
57 enum pcmk_exec_status exec_status,
58 const char *exit_reason);
59
60 void pcmk__format_result(pcmk__action_result_t *result, int exit_status,
61 enum pcmk_exec_status exec_status,
62 const char *format, ...) G_GNUC_PRINTF(4, 5);
63
64 void pcmk__set_result_output(pcmk__action_result_t *result,
65 char *out, char *err);
66
67 void pcmk__reset_result(pcmk__action_result_t *result);
68
69 void pcmk__copy_result(const pcmk__action_result_t *src,
70 pcmk__action_result_t *dst);
71
72
73
74
75
76
77
78
79
80
81 static inline bool
82 pcmk__result_ok(const pcmk__action_result_t *result)
83 {
84 return (result != NULL) && (result->exit_status == CRM_EX_OK)
85 && (result->execution_status == PCMK_EXEC_DONE);
86 }
87
88 #endif