summaryrefslogtreecommitdiff
path: root/ctdb/server/ctdb_client.c
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2019-06-08 06:22:49 +1000
committerAmitay Isaacs <amitay@samba.org>2019-07-05 05:03:22 +0000
commit3ccce53e3e6ebb5f7f628bd1b18b7152f548dd27 (patch)
tree3f5bf04439fef175a2c791ce5a27f1342cb62eb9 /ctdb/server/ctdb_client.c
parent655634790139b08a5093dc3851dee208d13f7294 (diff)
downloadsamba-3ccce53e3e6ebb5f7f628bd1b18b7152f548dd27.tar.gz
ctdb-daemon: Make type of list_of_nodes() consistent with callers
Instead of taking exclude_pnn as a parameter, calculate it from an include_self_parameter, which is passed through from the 2 calling functions. While doing this, fix a signed/unsigned comparison issue by declaring the new exclude_pnn local variable as an unsigned type. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/server/ctdb_client.c')
-rw-r--r--ctdb/server/ctdb_client.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/ctdb/server/ctdb_client.c b/ctdb/server/ctdb_client.c
index c5ffa121c3d..42aa0f5fc39 100644
--- a/ctdb/server/ctdb_client.c
+++ b/ctdb/server/ctdb_client.c
@@ -1769,18 +1769,19 @@ uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb,
return nodes;
}
-/* Get list of nodes not including those with flags specified by mask.
- * If exclude_pnn is not -1 then exclude that pnn from the list.
- */
+/* Get list of nodes not including those with flags specified by mask */
static uint32_t *list_of_nodes(struct ctdb_context *ctdb,
struct ctdb_node_map_old *node_map,
TALLOC_CTX *mem_ctx,
uint32_t mask,
- int exclude_pnn)
+ bool include_self)
{
int i, j, num_nodes;
+ uint32_t exclude_pnn;
uint32_t *nodes;
+ exclude_pnn = include_self ? CTDB_UNKNOWN_PNN : ctdb->pnn;
+
for (i=num_nodes=0;i<node_map->num;i++) {
if (node_map->nodes[i].flags & mask) {
continue;
@@ -1812,8 +1813,11 @@ uint32_t *list_of_active_nodes(struct ctdb_context *ctdb,
TALLOC_CTX *mem_ctx,
bool include_self)
{
- return list_of_nodes(ctdb, node_map, mem_ctx, NODE_FLAGS_INACTIVE,
- include_self ? -1 : ctdb->pnn);
+ return list_of_nodes(ctdb,
+ node_map,
+ mem_ctx,
+ NODE_FLAGS_INACTIVE,
+ include_self);
}
uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb,
@@ -1821,8 +1825,11 @@ uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb,
TALLOC_CTX *mem_ctx,
bool include_self)
{
- return list_of_nodes(ctdb, node_map, mem_ctx, NODE_FLAGS_DISCONNECTED,
- include_self ? -1 : ctdb->pnn);
+ return list_of_nodes(ctdb,
+ node_map,
+ mem_ctx,
+ NODE_FLAGS_DISCONNECTED,
+ include_self);
}
/*