Skip to content

Commit da0e13c

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 844f341 commit da0e13c

4 files changed

Lines changed: 19 additions & 22 deletions

File tree

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
@@ -181,13 +181,12 @@ cib__client_triggers_refresh(const char *name)
181181

182182
int cib__get_notify_patchset(const xmlNode *msg, const xmlNode **patchset);
183183

184-
int cib__perform_query(cib__op_fn_t fn, const char *section, xmlNode *req,
185-
xmlNode **current_cib, xmlNode **output);
184+
int cib__perform_query(cib__op_fn_t fn, xmlNode *req, xmlNode **current_cib,
185+
xmlNode **output);
186186

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

192191
int cib__create_op(cib_t *cib, const char *op, const char *host,
193192
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
@@ -187,11 +187,12 @@ get_op_input(const xmlNode *request)
187187
}
188188

189189
int
190-
cib__perform_query(cib__op_fn_t fn, const char *section, xmlNode *req,
191-
xmlNode **current_cib, xmlNode **output)
190+
cib__perform_query(cib__op_fn_t fn, xmlNode *req, xmlNode **current_cib,
191+
xmlNode **output)
192192
{
193193
int rc = pcmk_rc_ok;
194194
const char *op = NULL;
195+
const char *section = NULL;
195196
const char *user = NULL;
196197
uint32_t call_options = cib_none;
197198
xmlNode *input = NULL;
@@ -204,6 +205,7 @@ cib__perform_query(cib__op_fn_t fn, const char *section, xmlNode *req,
204205
&& (output != NULL) && (*output == NULL));
205206

206207
op = pcmk__xe_get(req, PCMK__XA_CIB_OP);
208+
section = pcmk__xe_get(req, PCMK__XA_CIB_SECTION);
207209
user = pcmk__xe_get(req, PCMK__XA_CIB_USER);
208210
pcmk__xe_get_flags(req, PCMK__XA_CIB_CALLOPT, &call_options, cib_none);
209211

@@ -462,13 +464,14 @@ set_update_origin(xmlNode *new_cib, const xmlNode *request)
462464
}
463465

464466
int
465-
cib_perform_op(enum cib_variant variant, cib__op_fn_t fn, const char *section,
466-
xmlNode *req, bool *config_changed, xmlNode **current_cib,
467+
cib_perform_op(enum cib_variant variant, cib__op_fn_t fn, xmlNode *req,
468+
bool *config_changed, xmlNode **current_cib,
467469
xmlNode **result_cib, xmlNode **diff, xmlNode **output)
468470
{
469471
int rc = pcmk_rc_ok;
470472

471473
const char *op = NULL;
474+
const char *section = NULL;
472475
const char *user = NULL;
473476
uint32_t call_options = cib_none;
474477
xmlNode *input = NULL;
@@ -492,6 +495,7 @@ cib_perform_op(enum cib_variant variant, cib__op_fn_t fn, const char *section,
492495
&& (output != NULL) && (*output == NULL));
493496

494497
op = pcmk__xe_get(req, PCMK__XA_CIB_OP);
498+
section = pcmk__xe_get(req, PCMK__XA_CIB_SECTION);
495499
user = pcmk__xe_get(req, PCMK__XA_CIB_USER);
496500
pcmk__xe_get_flags(req, PCMK__XA_CIB_CALLOPT, &call_options, cib_none);
497501

0 commit comments

Comments
 (0)