ctdb-client: Move ctdb_ctrl_modflags() to ctdb tool
authorAmitay Isaacs <amitay@gmail.com>
Wed, 19 Apr 2017 01:46:48 +0000 (11:46 +1000)
committerMartin Schwenke <martins@samba.org>
Wed, 7 Jun 2017 14:05:26 +0000 (16:05 +0200)
This function is only required by the tool.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/client/client.h
ctdb/client/client_util.c
ctdb/tools/ctdb.c

index 64fe75da5a053d2f556db75ee7335d01f382a39c..c55e312000569621610087c7e13c959222e9a790 100644 (file)
@@ -833,11 +833,6 @@ int list_of_connected_nodes(struct ctdb_node_map *nodemap,
                            uint32_t exclude_pnn,
                            TALLOC_CTX *mem_ctx, uint32_t **pnn_list);
 
-int ctdb_ctrl_modflags(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                      struct ctdb_client_context *client,
-                      uint32_t destnode, struct timeval timeout,
-                      uint32_t set, uint32_t clear);
-
 struct ctdb_server_id ctdb_client_get_server_id(
                                struct ctdb_client_context *client,
                                uint32_t task_id);
index 1ba1e7d10e858ec1199271e8553949763d3ab719..511778634dc9ff923691f3725da732055f1f0b82 100644 (file)
@@ -78,40 +78,6 @@ int list_of_connected_nodes(struct ctdb_node_map *nodemap,
                             mem_ctx, pnn_list);
 }
 
-int ctdb_ctrl_modflags(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                      struct ctdb_client_context *client,
-                      uint32_t destnode, struct timeval timeout,
-                      uint32_t set, uint32_t clear)
-{
-       struct ctdb_node_map *nodemap;
-       struct ctdb_node_flag_change flag_change;
-       struct ctdb_req_control request;
-       uint32_t *pnn_list;
-       int ret, count;
-
-       ret = ctdb_ctrl_get_nodemap(mem_ctx, ev, client, destnode,
-                                   tevent_timeval_zero(), &nodemap);
-       if (ret != 0) {
-               return ret;
-       }
-
-       flag_change.pnn = destnode;
-       flag_change.old_flags = nodemap->node[destnode].flags;
-       flag_change.new_flags = flag_change.old_flags | set;
-       flag_change.new_flags &= ~clear;
-
-       count = list_of_connected_nodes(nodemap, -1, mem_ctx, &pnn_list);
-       if (count == -1) {
-               return ENOMEM;
-       }
-
-       ctdb_req_control_modify_flags(&request, &flag_change);
-       ret = ctdb_client_control_multi(mem_ctx, ev, client, pnn_list, count,
-                                       tevent_timeval_zero(), &request,
-                                       NULL, NULL);
-       return ret;
-}
-
 struct ctdb_server_id ctdb_client_get_server_id(
                                struct ctdb_client_context *client,
                                uint32_t task_id)
index e8a128e9ae27b4a1e0190504df8aefad816b33b5..55477bf477ccd16eb21cc0b7a49f2fbf23dab139 100644 (file)
@@ -2579,6 +2579,40 @@ static void wait_for_flags(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
        }
 }
 
+static int ctdb_ctrl_modflags(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+                             struct ctdb_client_context *client,
+                             uint32_t destnode, struct timeval timeout,
+                             uint32_t set, uint32_t clear)
+{
+       struct ctdb_node_map *nodemap;
+       struct ctdb_node_flag_change flag_change;
+       struct ctdb_req_control request;
+       uint32_t *pnn_list;
+       int ret, count;
+
+       ret = ctdb_ctrl_get_nodemap(mem_ctx, ev, client, destnode,
+                                   tevent_timeval_zero(), &nodemap);
+       if (ret != 0) {
+               return ret;
+       }
+
+       flag_change.pnn = destnode;
+       flag_change.old_flags = nodemap->node[destnode].flags;
+       flag_change.new_flags = flag_change.old_flags | set;
+       flag_change.new_flags &= ~clear;
+
+       count = list_of_connected_nodes(nodemap, -1, mem_ctx, &pnn_list);
+       if (count == -1) {
+               return ENOMEM;
+       }
+
+       ctdb_req_control_modify_flags(&request, &flag_change);
+       ret = ctdb_client_control_multi(mem_ctx, ev, client, pnn_list, count,
+                                       tevent_timeval_zero(), &request,
+                                       NULL, NULL);
+       return ret;
+}
+
 struct ipreallocate_state {
        int status;
        bool done;