Skip to content

Commit 84a4ef0

Browse files
committed
Refactor: libcib: Drop section arg of cib__perform_query/cib_perform_op
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
1 parent 165f64f commit 84a4ef0

File tree

4 files changed

+19
-22
lines changed

4 files changed

+19
-22
lines changed

daemons/based/based_callbacks.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,6 @@ cib_process_command(xmlNode *request, const cib__operation_t *operation,
517517
uint32_t call_options = cib_none;
518518

519519
const char *op = pcmk__xe_get(request, PCMK__XA_CIB_OP);
520-
const char *section = pcmk__xe_get(request, PCMK__XA_CIB_SECTION);
521520
const char *call_id = pcmk__xe_get(request, PCMK__XA_CIB_CALLID);
522521
const char *client_id = pcmk__xe_get(request, PCMK__XA_CIB_CLIENTID);
523522
const char *client_name = pcmk__xe_get(request, PCMK__XA_CIB_CLIENTNAME);
@@ -553,8 +552,7 @@ cib_process_command(xmlNode *request, const cib__operation_t *operation,
553552
}
554553

555554
if (!pcmk__is_set(operation->flags, cib__op_attr_modifies)) {
556-
rc = cib__perform_query(op_function, section, request, &the_cib,
557-
&output);
555+
rc = cib__perform_query(op_function, request, &the_cib, &output);
558556
goto done;
559557
}
560558

@@ -565,9 +563,8 @@ cib_process_command(xmlNode *request, const cib__operation_t *operation,
565563
* It's not important whether the client variant is cib_native or
566564
* cib_remote.
567565
*/
568-
rc = cib_perform_op(cib_undefined, op_function, section, request,
569-
&config_changed, &the_cib, &result_cib, &cib_diff,
570-
&output);
566+
rc = cib_perform_op(cib_undefined, op_function, request, &config_changed,
567+
&the_cib, &result_cib, &cib_diff, &output);
571568

572569
/* Always write to disk for successful ops with the flag set. This also
573570
* negates the need to detect ordering changes.

include/crm/cib/internal.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,12 @@ cib__client_triggers_refresh(const char *name)
183183

184184
int cib__get_notify_patchset(const xmlNode *msg, const xmlNode **patchset);
185185

186-
int cib__perform_query(cib__op_fn_t fn, const char *section, xmlNode *req,
187-
xmlNode **current_cib, xmlNode **output);
186+
int cib__perform_query(cib__op_fn_t fn, xmlNode *req, xmlNode **current_cib,
187+
xmlNode **output);
188188

189-
int cib_perform_op(enum cib_variant variant, cib__op_fn_t fn,
190-
const char *section, xmlNode *req, bool *config_changed,
191-
xmlNode **current_cib, xmlNode **result_cib, xmlNode **diff,
192-
xmlNode **output);
189+
int cib_perform_op(enum cib_variant variant, cib__op_fn_t fn, xmlNode *req,
190+
bool *config_changed, xmlNode **current_cib,
191+
xmlNode **result_cib, xmlNode **diff, xmlNode **output);
193192

194193
int cib__create_op(cib_t *cib, const char *op, const char *host,
195194
const char *section, xmlNode *data, int call_options,

lib/cib/cib_file.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,8 @@ process_request(cib_t *cib, xmlNode *request, xmlNode **output)
143143
const cib__operation_t *operation = NULL;
144144
cib__op_fn_t op_function = NULL;
145145

146-
int call_id = 0;
147146
uint32_t call_options = cib_none;
148147
const char *op = pcmk__xe_get(request, PCMK__XA_CIB_OP);
149-
const char *section = pcmk__xe_get(request, PCMK__XA_CIB_SECTION);
150148

151149
bool changed = false;
152150
bool read_only = false;
@@ -159,7 +157,6 @@ process_request(cib_t *cib, xmlNode *request, xmlNode **output)
159157
cib__get_operation(op, &operation);
160158
op_function = get_op_function(operation);
161159

162-
pcmk__xe_get_int(request, PCMK__XA_CIB_CALLID, &call_id);
163160
rc = pcmk__xe_get_flags(request, PCMK__XA_CIB_CALLOPT, &call_options,
164161
cib_none);
165162
if (rc != pcmk_rc_ok) {
@@ -169,10 +166,10 @@ process_request(cib_t *cib, xmlNode *request, xmlNode **output)
169166
read_only = !pcmk__is_set(operation->flags, cib__op_attr_modifies);
170167

171168
if (read_only) {
172-
rc = cib__perform_query(op_function, section, request,
173-
&private->cib_xml, output);
169+
rc = cib__perform_query(op_function, request, &private->cib_xml,
170+
output);
174171
} else {
175-
rc = cib_perform_op(cib_file, op_function, section, request, &changed,
172+
rc = cib_perform_op(cib_file, op_function, request, &changed,
176173
&private->cib_xml, &result_cib, &cib_diff, output);
177174
}
178175

lib/cib/cib_utils.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,12 @@ get_op_input(const xmlNode *request)
291291
}
292292

293293
int
294-
cib__perform_query(cib__op_fn_t fn, const char *section, xmlNode *req,
295-
xmlNode **current_cib, xmlNode **output)
294+
cib__perform_query(cib__op_fn_t fn, xmlNode *req, xmlNode **current_cib,
295+
xmlNode **output)
296296
{
297297
int rc = pcmk_rc_ok;
298298
const char *op = NULL;
299+
const char *section = NULL;
299300
const char *user = NULL;
300301
uint32_t call_options = cib_none;
301302
xmlNode *input = NULL;
@@ -308,6 +309,7 @@ cib__perform_query(cib__op_fn_t fn, const char *section, xmlNode *req,
308309
&& (output != NULL) && (*output == NULL));
309310

310311
op = pcmk__xe_get(req, PCMK__XA_CIB_OP);
312+
section = pcmk__xe_get(req, PCMK__XA_CIB_SECTION);
311313
user = pcmk__xe_get(req, PCMK__XA_CIB_USER);
312314
pcmk__xe_get_flags(req, PCMK__XA_CIB_CALLOPT, &call_options, cib_none);
313315

@@ -566,13 +568,14 @@ set_update_origin(xmlNode *new_cib, const xmlNode *request)
566568
}
567569

568570
int
569-
cib_perform_op(enum cib_variant variant, cib__op_fn_t fn, const char *section,
570-
xmlNode *req, bool *config_changed, xmlNode **current_cib,
571+
cib_perform_op(enum cib_variant variant, cib__op_fn_t fn, xmlNode *req,
572+
bool *config_changed, xmlNode **current_cib,
571573
xmlNode **result_cib, xmlNode **diff, xmlNode **output)
572574
{
573575
int rc = pcmk_rc_ok;
574576

575577
const char *op = NULL;
578+
const char *section = NULL;
576579
const char *user = NULL;
577580
uint32_t call_options = cib_none;
578581
xmlNode *input = NULL;
@@ -596,6 +599,7 @@ cib_perform_op(enum cib_variant variant, cib__op_fn_t fn, const char *section,
596599
&& (output != NULL) && (*output == NULL));
597600

598601
op = pcmk__xe_get(req, PCMK__XA_CIB_OP);
602+
section = pcmk__xe_get(req, PCMK__XA_CIB_SECTION);
599603
user = pcmk__xe_get(req, PCMK__XA_CIB_USER);
600604
pcmk__xe_get_flags(req, PCMK__XA_CIB_CALLOPT, &call_options, cib_none);
601605

0 commit comments

Comments
 (0)