Skip to content

Commit 81cc2a4

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

6 files changed

Lines changed: 110 additions & 92 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] options Ignored
4544
* \param[in] section Ignored
4645
* \param[in] req Ignored
4746
* \param[in] input Ignored
@@ -53,8 +52,8 @@ xmlNode *the_cib = NULL;
5352
* \note This is unimplemented and simply returns an error.
5453
*/
5554
int
56-
based_process_abs_delete(int options, const char *section, xmlNode *req,
57-
xmlNode *input, xmlNode **cib, xmlNode **answer)
55+
based_process_abs_delete(const char *section, xmlNode *req, xmlNode *input,
56+
xmlNode **cib, xmlNode **answer)
5857
{
5958
/* @COMPAT Remove when PCMK__CIB_REQUEST_ABS_DELETE is removed. Note that
6059
* external clients with Pacemaker versions < 3.0.0 can send it.
@@ -63,8 +62,8 @@ based_process_abs_delete(int options, const char *section, xmlNode *req,
6362
}
6463

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

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

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

107106
int
108-
based_process_ping(int options, const char *section, xmlNode *req,
109-
xmlNode *input, xmlNode **cib, xmlNode **answer)
107+
based_process_ping(const char *section, xmlNode *req, xmlNode *input,
108+
xmlNode **cib, xmlNode **answer)
110109
{
111110
const char *host = pcmk__xe_get(req, PCMK__XA_SRC);
112111
const char *seq = pcmk__xe_get(req, PCMK__XA_CIB_PING_ID);
@@ -140,8 +139,8 @@ based_process_ping(int options, const char *section, xmlNode *req,
140139
}
141140

142141
int
143-
based_process_primary(int options, const char *section, xmlNode *req,
144-
xmlNode *input, xmlNode **cib, xmlNode **answer)
142+
based_process_primary(const char *section, xmlNode *req, xmlNode *input,
143+
xmlNode **cib, xmlNode **answer)
145144
{
146145
if (!based_is_primary) {
147146
pcmk__info("We are now in R/W mode");
@@ -155,8 +154,8 @@ based_process_primary(int options, const char *section, xmlNode *req,
155154
}
156155

157156
int
158-
based_process_schemas(int options, const char *section, xmlNode *req,
159-
xmlNode *input, xmlNode **cib, xmlNode **answer)
157+
based_process_schemas(const char *section, xmlNode *req, xmlNode *input,
158+
xmlNode **cib, xmlNode **answer)
160159
{
161160
xmlNode *wrapper = NULL;
162161
xmlNode *data = NULL;
@@ -200,8 +199,8 @@ based_process_schemas(int options, const char *section, xmlNode *req,
200199
}
201200

202201
int
203-
based_process_secondary(int options, const char *section, xmlNode *req,
204-
xmlNode *input, xmlNode **cib, xmlNode **answer)
202+
based_process_secondary(const char *section, xmlNode *req, xmlNode *input,
203+
xmlNode **cib, xmlNode **answer)
205204
{
206205
if (based_is_primary) {
207206
pcmk__info("We are now in R/O mode");
@@ -215,8 +214,8 @@ based_process_secondary(int options, const char *section, xmlNode *req,
215214
}
216215

217216
int
218-
based_process_shutdown(int options, const char *section, xmlNode *req,
219-
xmlNode *input, xmlNode **cib, xmlNode **answer)
217+
based_process_shutdown(const char *section, xmlNode *req, xmlNode *input,
218+
xmlNode **cib, xmlNode **answer)
220219
{
221220
const char *host = pcmk__xe_get(req, PCMK__XA_SRC);
222221

@@ -238,15 +237,15 @@ based_process_shutdown(int options, const char *section, xmlNode *req,
238237
}
239238

240239
int
241-
based_process_sync(int options, const char *section, xmlNode *req,
242-
xmlNode *input, xmlNode **cib, xmlNode **answer)
240+
based_process_sync(const char *section, xmlNode *req, xmlNode *input,
241+
xmlNode **cib, xmlNode **answer)
243242
{
244243
return sync_our_cib(req, true);
245244
}
246245

247246
int
248-
based_process_upgrade(int options, const char *section, xmlNode *req,
249-
xmlNode *input, xmlNode **cib, xmlNode **answer)
247+
based_process_upgrade(const char *section, xmlNode *req, xmlNode *input,
248+
xmlNode **cib, xmlNode **answer)
250249
{
251250
int rc = pcmk_rc_ok;
252251

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

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

daemons/based/based_messages.h

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

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

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

26-
int based_process_commit_transact(int options, const char *section,
27-
xmlNode *req, xmlNode *input, xmlNode **cib,
26+
int based_process_commit_transact(const char *section, xmlNode *req,
27+
xmlNode *input, xmlNode **cib,
2828
xmlNode **answer);
2929

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

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

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

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

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

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

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

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

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

5757
int sync_our_cib(xmlNode *request, bool all);
5858

include/crm/cib/internal.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ 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)(int options, const char *section, xmlNode *request,
109+
typedef int (*cib__op_fn_t)(const char *section, xmlNode *request,
110110
xmlNode *input, xmlNode **cib, xmlNode **output);
111111

112112
typedef struct cib__operation_s {
@@ -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(int options, const char *section, xmlNode *req,
214-
xmlNode *input, xmlNode **cib, xmlNode **answer);
213+
int cib__process_apply_patch(const char *section, xmlNode *req, xmlNode *input,
214+
xmlNode **cib, xmlNode **answer);
215215

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

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

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

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

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

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

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

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

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

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(int options, const char *section, xmlNode *req,
311-
xmlNode *input, xmlNode **cib_xml, xmlNode **answer)
310+
process_commit_transact(const char *section, xmlNode *req, xmlNode *input,
311+
xmlNode **cib_xml, 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)