Skip to content

Commit fc7510e

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 596ec9d commit fc7510e

6 files changed

Lines changed: 101 additions & 93 deletions

File tree

daemons/based/based_messages.c

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ xmlNode *the_cib = NULL;
3737
* \internal
3838
* \brief Process a \c PCMK__CIB_REQUEST_ABS_DELETE
3939
*
40-
* \param[in] section Ignored
4140
* \param[in] req Ignored
4241
* \param[in] input Ignored
4342
* \param[in] cib Ignored
@@ -48,8 +47,8 @@ xmlNode *the_cib = NULL;
4847
* \note This is unimplemented and simply returns an error.
4948
*/
5049
int
51-
based_process_abs_delete(const char *section, xmlNode *req, xmlNode *input,
52-
xmlNode **cib, xmlNode **answer)
50+
based_process_abs_delete(xmlNode *req, xmlNode *input, xmlNode **cib,
51+
xmlNode **answer)
5352
{
5453
/* @COMPAT Remove when PCMK__CIB_REQUEST_ABS_DELETE is removed. Note that
5554
* external clients with Pacemaker versions < 3.0.0 can send it.
@@ -58,8 +57,8 @@ based_process_abs_delete(const char *section, xmlNode *req, xmlNode *input,
5857
}
5958

6059
int
61-
based_process_commit_transact(const char *section, xmlNode *req, xmlNode *input,
62-
xmlNode **cib, xmlNode **answer)
60+
based_process_commit_transact(xmlNode *req, xmlNode *input, xmlNode **cib,
61+
xmlNode **answer)
6362
{
6463
/* On success, our caller will activate *cib locally, trigger a replace
6564
* notification if appropriate, and sync *cib to all nodes. On failure, our
@@ -83,25 +82,25 @@ based_process_commit_transact(const char *section, xmlNode *req, xmlNode *input,
8382
}
8483

8584
int
86-
based_process_is_primary(const char *section, xmlNode *req, xmlNode *input,
87-
xmlNode **cib, xmlNode **answer)
85+
based_process_is_primary(xmlNode *req, xmlNode *input, xmlNode **cib,
86+
xmlNode **answer)
8887
{
8988
// @COMPAT Pacemaker Remote clients <3.0.0 may send this
9089
return (based_is_primary? pcmk_rc_ok : EPERM);
9190
}
9291

9392
// @COMPAT: Remove when PCMK__CIB_REQUEST_NOOP is removed
9493
int
95-
based_process_noop(const char *section, xmlNode *req, xmlNode *input,
96-
xmlNode **cib, xmlNode **answer)
94+
based_process_noop(xmlNode *req, xmlNode *input, xmlNode **cib,
95+
xmlNode **answer)
9796
{
9897
*answer = NULL;
9998
return pcmk_rc_ok;
10099
}
101100

102101
int
103-
based_process_ping(const char *section, xmlNode *req, xmlNode *input,
104-
xmlNode **cib, xmlNode **answer)
102+
based_process_ping(xmlNode *req, xmlNode *input, xmlNode **cib,
103+
xmlNode **answer)
105104
{
106105
/* existing_cib and *cib should be identical. In the absence of ACL
107106
* filtering, they should also match the_cib. However, they may be copies
@@ -144,8 +143,8 @@ based_process_ping(const char *section, xmlNode *req, xmlNode *input,
144143
}
145144

146145
int
147-
based_process_primary(const char *section, xmlNode *req, xmlNode *input,
148-
xmlNode **cib, xmlNode **answer)
146+
based_process_primary(xmlNode *req, xmlNode *input, xmlNode **cib,
147+
xmlNode **answer)
149148
{
150149
if (!based_is_primary) {
151150
pcmk__info("We are now in R/W mode");
@@ -159,8 +158,8 @@ based_process_primary(const char *section, xmlNode *req, xmlNode *input,
159158
}
160159

161160
int
162-
based_process_schemas(const char *section, xmlNode *req, xmlNode *input,
163-
xmlNode **cib, xmlNode **answer)
161+
based_process_schemas(xmlNode *req, xmlNode *input, xmlNode **cib,
162+
xmlNode **answer)
164163
{
165164
xmlNode *wrapper = NULL;
166165
xmlNode *data = NULL;
@@ -204,8 +203,8 @@ based_process_schemas(const char *section, xmlNode *req, xmlNode *input,
204203
}
205204

206205
int
207-
based_process_secondary(const char *section, xmlNode *req, xmlNode *input,
208-
xmlNode **cib, xmlNode **answer)
206+
based_process_secondary(xmlNode *req, xmlNode *input, xmlNode **cib,
207+
xmlNode **answer)
209208
{
210209
if (based_is_primary) {
211210
pcmk__info("We are now in R/O mode");
@@ -219,8 +218,8 @@ based_process_secondary(const char *section, xmlNode *req, xmlNode *input,
219218
}
220219

221220
int
222-
based_process_shutdown(const char *section, xmlNode *req, xmlNode *input,
223-
xmlNode **cib, xmlNode **answer)
221+
based_process_shutdown(xmlNode *req, xmlNode *input, xmlNode **cib,
222+
xmlNode **answer)
224223
{
225224
const char *host = pcmk__xe_get(req, PCMK__XA_SRC);
226225

@@ -242,15 +241,15 @@ based_process_shutdown(const char *section, xmlNode *req, xmlNode *input,
242241
}
243242

244243
int
245-
based_process_sync(const char *section, xmlNode *req, xmlNode *input,
246-
xmlNode **cib, xmlNode **answer)
244+
based_process_sync(xmlNode *req, xmlNode *input, xmlNode **cib,
245+
xmlNode **answer)
247246
{
248247
return sync_our_cib(req, true);
249248
}
250249

251250
int
252-
based_process_upgrade(const char *section, xmlNode *req, xmlNode *input,
253-
xmlNode **cib, xmlNode **answer)
251+
based_process_upgrade(xmlNode *req, xmlNode *input, xmlNode **cib,
252+
xmlNode **answer)
254253
{
255254
int rc = pcmk_rc_ok;
256255

@@ -262,7 +261,7 @@ based_process_upgrade(const char *section, xmlNode *req, xmlNode *input,
262261
* re-broadcasts the request with PCMK__XA_CIB_SCHEMA_MAX, and each node
263262
* performs the upgrade (and notifies its local clients) here.
264263
*/
265-
return cib__process_upgrade(section, req, input, cib, answer);
264+
return cib__process_upgrade(req, input, cib, answer);
266265

267266
} else {
268267
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
@@ -103,8 +103,8 @@ enum cib__op_type {
103103
* replace *cib, but the replacement must become the root of the original
104104
* document.
105105
*/
106-
typedef int (*cib__op_fn_t)(const char *section, xmlNode *request,
107-
xmlNode *input, xmlNode **cib, xmlNode **output);
106+
typedef int (*cib__op_fn_t)(xmlNode *request, xmlNode *input, xmlNode **cib,
107+
xmlNode **output);
108108

109109
typedef struct {
110110
const char *name;
@@ -207,32 +207,32 @@ void cib_native_notify(gpointer data, gpointer user_data);
207207

208208
int cib__get_operation(const char *op, const cib__operation_t **operation);
209209

210-
int cib__process_apply_patch(const char *section, xmlNode *req, xmlNode *input,
211-
xmlNode **cib, xmlNode **answer);
210+
int cib__process_apply_patch(xmlNode *req, xmlNode *input, xmlNode **cib,
211+
xmlNode **answer);
212212

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

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

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

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

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

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

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

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

237237
int cib_internal_op(cib_t * cib, const char *op, const char *host,
238238
const char *section, xmlNode * data,

lib/cib/cib_file.c

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

304304
static int
305-
process_commit_transact(const char *section, xmlNode *req, xmlNode *input,
306-
xmlNode **cib_xml, xmlNode **answer)
305+
process_commit_transact(xmlNode *req, xmlNode *input, xmlNode **cib_xml,
306+
xmlNode **answer)
307307
{
308308
int rc = pcmk_rc_ok;
309309
const char *client_id = pcmk__xe_get(req, PCMK__XA_CIB_CLIENTID);

0 commit comments

Comments
 (0)