Skip to content

Commit b04f6c5

Browse files
committed
Refactor: libcib: Drop section arg from cib__op_fn_t
The request argument provides the section value for functions that need it. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
1 parent 81cc2a4 commit b04f6c5

7 files changed

Lines changed: 102 additions & 93 deletions

File tree

daemons/based/based_messages.c

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ xmlNode *the_cib = NULL;
4141
* \internal
4242
* \brief Process a \c PCMK__CIB_REQUEST_ABS_DELETE
4343
*
44-
* \param[in] section Ignored
4544
* \param[in] req Ignored
4645
* \param[in] input Ignored
4746
* \param[in] cib Ignored
@@ -52,8 +51,8 @@ xmlNode *the_cib = NULL;
5251
* \note This is unimplemented and simply returns an error.
5352
*/
5453
int
55-
based_process_abs_delete(const char *section, xmlNode *req, xmlNode *input,
56-
xmlNode **cib, xmlNode **answer)
54+
based_process_abs_delete(xmlNode *req, xmlNode *input, xmlNode **cib,
55+
xmlNode **answer)
5756
{
5857
/* @COMPAT Remove when PCMK__CIB_REQUEST_ABS_DELETE is removed. Note that
5958
* external clients with Pacemaker versions < 3.0.0 can send it.
@@ -62,8 +61,8 @@ based_process_abs_delete(const char *section, xmlNode *req, xmlNode *input,
6261
}
6362

6463
int
65-
based_process_commit_transact(const char *section, xmlNode *req, xmlNode *input,
66-
xmlNode **cib, xmlNode **answer)
64+
based_process_commit_transact(xmlNode *req, xmlNode *input, xmlNode **cib,
65+
xmlNode **answer)
6766
{
6867
/* On success, our caller will activate *cib locally, trigger a replace
6968
* notification if appropriate, and sync *cib to all nodes. On failure, our
@@ -87,25 +86,25 @@ based_process_commit_transact(const char *section, xmlNode *req, xmlNode *input,
8786
}
8887

8988
int
90-
based_process_is_primary(const char *section, xmlNode *req, xmlNode *input,
91-
xmlNode **cib, xmlNode **answer)
89+
based_process_is_primary(xmlNode *req, xmlNode *input, xmlNode **cib,
90+
xmlNode **answer)
9291
{
9392
// @COMPAT Pacemaker Remote clients <3.0.0 may send this
9493
return (based_is_primary? pcmk_rc_ok : EPERM);
9594
}
9695

9796
// @COMPAT: Remove when PCMK__CIB_REQUEST_NOOP is removed
9897
int
99-
based_process_noop(const char *section, xmlNode *req, xmlNode *input,
100-
xmlNode **cib, xmlNode **answer)
98+
based_process_noop(xmlNode *req, xmlNode *input, xmlNode **cib,
99+
xmlNode **answer)
101100
{
102101
*answer = NULL;
103102
return pcmk_rc_ok;
104103
}
105104

106105
int
107-
based_process_ping(const char *section, xmlNode *req, xmlNode *input,
108-
xmlNode **cib, xmlNode **answer)
106+
based_process_ping(xmlNode *req, xmlNode *input, xmlNode **cib,
107+
xmlNode **answer)
109108
{
110109
const char *host = pcmk__xe_get(req, PCMK__XA_SRC);
111110
const char *seq = pcmk__xe_get(req, PCMK__XA_CIB_PING_ID);
@@ -139,8 +138,8 @@ based_process_ping(const char *section, xmlNode *req, xmlNode *input,
139138
}
140139

141140
int
142-
based_process_primary(const char *section, xmlNode *req, xmlNode *input,
143-
xmlNode **cib, xmlNode **answer)
141+
based_process_primary(xmlNode *req, xmlNode *input, xmlNode **cib,
142+
xmlNode **answer)
144143
{
145144
if (!based_is_primary) {
146145
pcmk__info("We are now in R/W mode");
@@ -154,8 +153,8 @@ based_process_primary(const char *section, xmlNode *req, xmlNode *input,
154153
}
155154

156155
int
157-
based_process_schemas(const char *section, xmlNode *req, xmlNode *input,
158-
xmlNode **cib, xmlNode **answer)
156+
based_process_schemas(xmlNode *req, xmlNode *input, xmlNode **cib,
157+
xmlNode **answer)
159158
{
160159
xmlNode *wrapper = NULL;
161160
xmlNode *data = NULL;
@@ -199,8 +198,8 @@ based_process_schemas(const char *section, xmlNode *req, xmlNode *input,
199198
}
200199

201200
int
202-
based_process_secondary(const char *section, xmlNode *req, xmlNode *input,
203-
xmlNode **cib, xmlNode **answer)
201+
based_process_secondary(xmlNode *req, xmlNode *input, xmlNode **cib,
202+
xmlNode **answer)
204203
{
205204
if (based_is_primary) {
206205
pcmk__info("We are now in R/O mode");
@@ -214,8 +213,8 @@ based_process_secondary(const char *section, xmlNode *req, xmlNode *input,
214213
}
215214

216215
int
217-
based_process_shutdown(const char *section, xmlNode *req, xmlNode *input,
218-
xmlNode **cib, xmlNode **answer)
216+
based_process_shutdown(xmlNode *req, xmlNode *input, xmlNode **cib,
217+
xmlNode **answer)
219218
{
220219
const char *host = pcmk__xe_get(req, PCMK__XA_SRC);
221220

@@ -237,15 +236,15 @@ based_process_shutdown(const char *section, xmlNode *req, xmlNode *input,
237236
}
238237

239238
int
240-
based_process_sync(const char *section, xmlNode *req, xmlNode *input,
241-
xmlNode **cib, xmlNode **answer)
239+
based_process_sync(xmlNode *req, xmlNode *input, xmlNode **cib,
240+
xmlNode **answer)
242241
{
243242
return sync_our_cib(req, true);
244243
}
245244

246245
int
247-
based_process_upgrade(const char *section, xmlNode *req, xmlNode *input,
248-
xmlNode **cib, xmlNode **answer)
246+
based_process_upgrade(xmlNode *req, xmlNode *input, xmlNode **cib,
247+
xmlNode **answer)
249248
{
250249
int rc = pcmk_rc_ok;
251250

@@ -257,7 +256,7 @@ based_process_upgrade(const char *section, xmlNode *req, xmlNode *input,
257256
* re-broadcasts the request with PCMK__XA_CIB_SCHEMA_MAX, and each node
258257
* performs the upgrade (and notifies its local clients) here.
259258
*/
260-
return cib__process_upgrade(section, req, input, cib, answer);
259+
return cib__process_upgrade(req, input, cib, answer);
261260

262261
} else {
263262
xmlNode *scratch = pcmk__xml_copy(NULL, *cib);

daemons/based/based_messages.h

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,41 @@
1717
extern bool based_is_primary;
1818
extern xmlNode *the_cib;
1919

20-
int based_process_abs_delete(const char *section, xmlNode *req, xmlNode *input,
21-
xmlNode **cib, xmlNode **answer);
20+
int based_process_abs_delete(xmlNode *req, xmlNode *input, xmlNode **cib,
21+
xmlNode **answer);
2222

23-
int based_process_apply_patch(const char *section, xmlNode *req, xmlNode *input,
24-
xmlNode **cib, xmlNode **answer);
23+
int based_process_apply_patch(xmlNode *req, xmlNode *input, xmlNode **cib,
24+
xmlNode **answer);
2525

26-
int based_process_commit_transact(const char *section, xmlNode *req,
27-
xmlNode *input, xmlNode **cib,
26+
int based_process_commit_transact(xmlNode *req, xmlNode *input, xmlNode **cib,
2827
xmlNode **answer);
2928

30-
int based_process_is_primary(const char *section, xmlNode *req, xmlNode *input,
31-
xmlNode **cib, xmlNode **answer);
29+
int based_process_is_primary(xmlNode *req, xmlNode *input, xmlNode **cib,
30+
xmlNode **answer);
3231

33-
int based_process_noop(const char *section, xmlNode *req, xmlNode *input,
34-
xmlNode **cib, xmlNode **answer);
32+
int based_process_noop(xmlNode *req, xmlNode *input, xmlNode **cib,
33+
xmlNode **answer);
3534

36-
int based_process_ping(const char *section, xmlNode *req, xmlNode *input,
37-
xmlNode **cib, xmlNode **answer);
35+
int based_process_ping(xmlNode *req, xmlNode *input, xmlNode **cib,
36+
xmlNode **answer);
3837

39-
int based_process_primary(const char *section, xmlNode *req, xmlNode *input,
40-
xmlNode **cib, xmlNode **answer);
38+
int based_process_primary(xmlNode *req, xmlNode *input, xmlNode **cib,
39+
xmlNode **answer);
4140

42-
int based_process_schemas(const char *section, xmlNode *req, xmlNode *input,
43-
xmlNode **cib, xmlNode **answer);
41+
int based_process_schemas(xmlNode *req, xmlNode *input, xmlNode **cib,
42+
xmlNode **answer);
4443

45-
int based_process_secondary(const char *section, xmlNode *req, xmlNode *input,
46-
xmlNode **cib, xmlNode **answer);
44+
int based_process_secondary(xmlNode *req, xmlNode *input, xmlNode **cib,
45+
xmlNode **answer);
4746

48-
int based_process_shutdown(const char *section, xmlNode *req, xmlNode *input,
49-
xmlNode **cib, xmlNode **answer);
47+
int based_process_shutdown(xmlNode *req, xmlNode *input, xmlNode **cib,
48+
xmlNode **answer);
5049

51-
int based_process_sync(const char *section, xmlNode *req, xmlNode *input,
52-
xmlNode **cib, xmlNode **answer);
50+
int based_process_sync(xmlNode *req, xmlNode *input, xmlNode **cib,
51+
xmlNode **answer);
5352

54-
int based_process_upgrade(const char *section, xmlNode *req, xmlNode *input,
55-
xmlNode **cib, xmlNode **answer);
53+
int based_process_upgrade(xmlNode *req, xmlNode *input, xmlNode **cib,
54+
xmlNode **answer);
5655

5756
int sync_our_cib(xmlNode *request, bool all);
5857

include/crm/cib/internal.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ enum cib__op_type {
106106
* replace *cib, but the replacement must become the root of the original
107107
* document.
108108
*/
109-
typedef int (*cib__op_fn_t)(const char *section, xmlNode *request,
110-
xmlNode *input, xmlNode **cib, xmlNode **output);
109+
typedef int (*cib__op_fn_t)(xmlNode *request, xmlNode *input, xmlNode **cib,
110+
xmlNode **output);
111111

112112
typedef struct cib__operation_s {
113113
const char *name;
@@ -210,32 +210,32 @@ void cib_native_notify(gpointer data, gpointer user_data);
210210

211211
int cib__get_operation(const char *op, const cib__operation_t **operation);
212212

213-
int cib__process_apply_patch(const char *section, xmlNode *req, xmlNode *input,
214-
xmlNode **cib, xmlNode **answer);
213+
int cib__process_apply_patch(xmlNode *req, xmlNode *input, xmlNode **cib,
214+
xmlNode **answer);
215215

216-
int cib__process_bump(const char *section, xmlNode *req, xmlNode *input,
217-
xmlNode **cib, xmlNode **answer);
216+
int cib__process_bump(xmlNode *req, xmlNode *input, xmlNode **cib,
217+
xmlNode **answer);
218218

219-
int cib__process_create(const char *section, xmlNode *req, xmlNode *input,
220-
xmlNode **cib, xmlNode **answer);
219+
int cib__process_create(xmlNode *req, xmlNode *input, xmlNode **cib,
220+
xmlNode **answer);
221221

222-
int cib__process_delete(const char *section, xmlNode *req, xmlNode *input,
223-
xmlNode **cib, xmlNode **answer);
222+
int cib__process_delete(xmlNode *req, xmlNode *input, xmlNode **cib,
223+
xmlNode **answer);
224224

225-
int cib__process_erase(const char *section, xmlNode *req, xmlNode *input,
226-
xmlNode **cib, xmlNode **answer);
225+
int cib__process_erase(xmlNode *req, xmlNode *input, xmlNode **cib,
226+
xmlNode **answer);
227227

228-
int cib__process_modify(const char *section, xmlNode *req, xmlNode *input,
229-
xmlNode **cib, xmlNode **answer);
228+
int cib__process_modify(xmlNode *req, xmlNode *input, xmlNode **cib,
229+
xmlNode **answer);
230230

231-
int cib__process_query(const char *section, xmlNode *req, xmlNode *input,
232-
xmlNode **cib, xmlNode **answer);
231+
int cib__process_query(xmlNode *req, xmlNode *input, xmlNode **cib,
232+
xmlNode **answer);
233233

234-
int cib__process_replace(const char *section, xmlNode *req, xmlNode *input,
235-
xmlNode **cib, xmlNode **answer);
234+
int cib__process_replace(xmlNode *req, xmlNode *input, xmlNode **cib,
235+
xmlNode **answer);
236236

237-
int cib__process_upgrade(const char *section, xmlNode *req, xmlNode *input,
238-
xmlNode **cib, xmlNode **answer);
237+
int cib__process_upgrade(xmlNode *req, xmlNode *input, xmlNode **cib,
238+
xmlNode **answer);
239239

240240
int cib_internal_op(cib_t * cib, const char *op, const char *host,
241241
const char *section, xmlNode * data,

include/crm/common/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <crm/common/mainloop.h> // mainloop_io_t, struct ipc_client_callbacks
2525
#include <crm/common/acl_internal.h>
2626
#include <crm/common/actions_internal.h>
27+
#include <crm/common/cib_internal.h>
2728
#include <crm/common/digest_internal.h>
2829
#include <crm/common/health_internal.h>
2930
#include <crm/common/ipc_internal.h>

lib/cib/cib_file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ commit_transaction(cib_t *cib, xmlNode *transaction, xmlNode **result_cib)
307307
}
308308

309309
static int
310-
process_commit_transact(const char *section, xmlNode *req, xmlNode *input,
311-
xmlNode **cib_xml, xmlNode **answer)
310+
process_commit_transact(xmlNode *req, xmlNode *input, xmlNode **cib_xml,
311+
xmlNode **answer)
312312
{
313313
int rc = pcmk_rc_ok;
314314
const char *client_id = pcmk__xe_get(req, PCMK__XA_CIB_CLIENTID);

0 commit comments

Comments
 (0)