From: Martin Schwenke Date: Fri, 7 Jun 2019 20:22:49 +0000 (+1000) Subject: ctdb-daemon: Make type of list_of_nodes() consistent with callers X-Git-Tag: samba-4.11.0rc1~64 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=3ccce53e3e6ebb5f7f628bd1b18b7152f548dd27;p=samba.git 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 Reviewed-by: Amitay Isaacs --- 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;inum;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); } /*