Blob Blame History Raw
From 6df10102c02f93890c1994136b3ce6a60b33a05e Mon Sep 17 00:00:00 2001
From: Ken Gaillot <kgaillot@redhat.com>
Date: Mon, 6 Jan 2020 11:01:38 -0600
Subject: [PATCH] Refactor: controller: remove unused function arguments

... and rename affected functions
---
 daemons/controld/controld_execd.c       |  2 +-
 daemons/controld/controld_fsa.c         |  1 -
 daemons/controld/controld_fsa.h         |  4 ++--
 daemons/controld/controld_join_client.c |  4 ++--
 daemons/controld/controld_join_dc.c     | 32 ++++++++++++++------------------
 5 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/daemons/controld/controld_execd.c b/daemons/controld/controld_execd.c
index f068413..16751b9 100644
--- a/daemons/controld/controld_execd.c
+++ b/daemons/controld/controld_execd.c
@@ -839,7 +839,7 @@ do_lrm_query_internal(lrm_state_t *lrm_state, int update_flags)
 }
 
 xmlNode *
-do_lrm_query(gboolean is_replace, const char *node_name)
+controld_query_executor_state(const char *node_name)
 {
     lrm_state_t *lrm_state = lrm_state_find(node_name);
 
diff --git a/daemons/controld/controld_fsa.c b/daemons/controld/controld_fsa.c
index bd732bc..db2b3f3 100644
--- a/daemons/controld/controld_fsa.c
+++ b/daemons/controld/controld_fsa.c
@@ -41,7 +41,6 @@ enum crmd_fsa_state fsa_state = S_STARTING;
 
 extern uint highest_born_on;
 extern uint num_join_invites;
-extern void initialize_join(gboolean before);
 
 #define DOT_PREFIX "actions:trace: "
 #define do_dot_log(fmt, args...)     crm_trace( fmt, ##args)
diff --git a/daemons/controld/controld_fsa.h b/daemons/controld/controld_fsa.h
index 06794cb..8aaaadf 100644
--- a/daemons/controld/controld_fsa.h
+++ b/daemons/controld/controld_fsa.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2019 the Pacemaker project contributors
+ * Copyright 2004-2020 the Pacemaker project contributors
  *
  * The version control history for this file may have further details.
  *
@@ -484,7 +484,7 @@ extern gboolean ever_had_quorum;
 // These should be moved elsewhere
 void do_update_cib_nodes(gboolean overwrite, const char *caller);
 int crmd_cib_smart_opt(void);
-xmlNode *do_lrm_query(gboolean, const char *node_name);
+xmlNode *controld_query_executor_state(const char *node_name);
 
 const char *fsa_input2string(enum crmd_fsa_input input);
 const char *fsa_state2string(enum crmd_fsa_state state);
diff --git a/daemons/controld/controld_join_client.c b/daemons/controld/controld_join_client.c
index 4ac0d2a..383ee29 100644
--- a/daemons/controld/controld_join_client.c
+++ b/daemons/controld/controld_join_client.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2019 the Pacemaker project contributors
+ * Copyright 2004-2020 the Pacemaker project contributors
  *
  * The version control history for this file may have further details.
  *
@@ -264,7 +264,7 @@ do_cl_join_finalize_respond(long long action,
     update_dc_expected(input->msg);
 
     /* send our status section to the DC */
-    tmp1 = do_lrm_query(TRUE, fsa_our_uname);
+    tmp1 = controld_query_executor_state(fsa_our_uname);
     if (tmp1 != NULL) {
         xmlNode *reply = create_request(CRM_OP_JOIN_CONFIRM, tmp1, fsa_our_dc,
                                         CRM_SYSTEM_DC, CRM_SYSTEM_CRMD, NULL);
diff --git a/daemons/controld/controld_join_dc.c b/daemons/controld/controld_join_dc.c
index ac6b430..885b2a9 100644
--- a/daemons/controld/controld_join_dc.c
+++ b/daemons/controld/controld_join_dc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2019 the Pacemaker project contributors
+ * Copyright 2004-2020 the Pacemaker project contributors
  *
  * The version control history for this file may have further details.
  *
@@ -21,7 +21,6 @@ char *max_epoch = NULL;
 char *max_generation_from = NULL;
 xmlNode *max_generation_xml = NULL;
 
-void initialize_join(gboolean before);
 void finalize_join_for(gpointer key, gpointer value, gpointer user_data);
 void finalize_sync_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *user_data);
 gboolean check_join_state(enum crmd_fsa_state cur_state, const char *source);
@@ -68,8 +67,8 @@ crm_update_peer_join(const char *source, crm_node_t * node, enum crm_join_phase
     }
 }
 
-void
-initialize_join(gboolean before)
+static void
+start_join_round()
 {
     GHashTableIter iter;
     crm_node_t *peer = NULL;
@@ -80,19 +79,16 @@ initialize_join(gboolean before)
     while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &peer)) {
         crm_update_peer_join(__FUNCTION__, peer, crm_join_none);
     }
-
-    if (before) {
-        if (max_generation_from != NULL) {
-            free(max_generation_from);
-            max_generation_from = NULL;
-        }
-        if (max_generation_xml != NULL) {
-            free_xml(max_generation_xml);
-            max_generation_xml = NULL;
-        }
-        clear_bit(fsa_input_register, R_HAVE_CIB);
-        clear_bit(fsa_input_register, R_CIB_ASKED);
+    if (max_generation_from != NULL) {
+        free(max_generation_from);
+        max_generation_from = NULL;
+    }
+    if (max_generation_xml != NULL) {
+        free_xml(max_generation_xml);
+        max_generation_xml = NULL;
     }
+    clear_bit(fsa_input_register, R_HAVE_CIB);
+    clear_bit(fsa_input_register, R_CIB_ASKED);
 }
 
 /*!
@@ -192,7 +188,7 @@ do_dc_join_offer_all(long long action,
      * will be seen as offline by the scheduler anyway.
      */
     current_join_id++;
-    initialize_join(TRUE);
+    start_join_round();
 /* 	do_update_cib_nodes(TRUE, __FUNCTION__); */
 
     update_dc(NULL);
@@ -590,7 +586,7 @@ do_dc_join_ack(long long action,
     controld_delete_node_state(join_from, controld_section_lrm,
                                cib_scope_local);
     if (safe_str_eq(join_from, fsa_our_uname)) {
-        xmlNode *now_dc_lrmd_state = do_lrm_query(TRUE, fsa_our_uname);
+        xmlNode *now_dc_lrmd_state = controld_query_executor_state(fsa_our_uname);
 
         if (now_dc_lrmd_state != NULL) {
             fsa_cib_update(XML_CIB_TAG_STATUS, now_dc_lrmd_state,
-- 
1.8.3.1