From: Amitay Isaacs Date: Wed, 19 Apr 2017 01:46:48 +0000 (+1000) Subject: ctdb-client: Move ctdb_ctrl_modflags() to ctdb tool X-Git-Tag: ldb-1.1.31~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be0a8d6c5fcd4c31224d38523d8d4c03138a9793;p=thirdparty%2Fsamba.git ctdb-client: Move ctdb_ctrl_modflags() to ctdb tool This function is only required by the tool. Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- diff --git a/ctdb/client/client.h b/ctdb/client/client.h index 64fe75da5a0..c55e3120005 100644 --- a/ctdb/client/client.h +++ b/ctdb/client/client.h @@ -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); diff --git a/ctdb/client/client_util.c b/ctdb/client/client_util.c index 1ba1e7d10e8..511778634dc 100644 --- a/ctdb/client/client_util.c +++ b/ctdb/client/client_util.c @@ -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) diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index e8a128e9ae2..55477bf477c 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -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;