mirror of
https://github.com/samba-team/samba.git
synced 2025-03-11 16:58:40 +03:00
ctdb-daemon: Fix signed/unsigned comparisons by declaring as unsigned
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
3ccce53e3e
commit
1e47a1b3f6
@ -713,7 +713,7 @@ int ctdb_load_persistent_health(struct ctdb_context *ctdb,
|
||||
int ctdb_update_persistent_health(struct ctdb_context *ctdb,
|
||||
struct ctdb_db_context *ctdb_db,
|
||||
const char *reason,/* NULL means healthy */
|
||||
int num_healthy_nodes);
|
||||
unsigned int num_healthy_nodes);
|
||||
int ctdb_recheck_persistent_health(struct ctdb_context *ctdb);
|
||||
|
||||
int32_t ctdb_control_db_set_healthy(struct ctdb_context *ctdb,
|
||||
|
@ -1746,7 +1746,7 @@ uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
bool include_self)
|
||||
{
|
||||
int i, j, num_nodes;
|
||||
unsigned int i, j, num_nodes;
|
||||
uint32_t *nodes;
|
||||
|
||||
for (i=num_nodes=0;i<vnn_map->size;i++) {
|
||||
@ -1776,7 +1776,7 @@ static uint32_t *list_of_nodes(struct ctdb_context *ctdb,
|
||||
uint32_t mask,
|
||||
bool include_self)
|
||||
{
|
||||
int i, j, num_nodes;
|
||||
unsigned int i, j, num_nodes;
|
||||
uint32_t exclude_pnn;
|
||||
uint32_t *nodes;
|
||||
|
||||
|
@ -1345,7 +1345,7 @@ static void ctdb_create_pidfile(TALLOC_CTX *mem_ctx)
|
||||
|
||||
static void ctdb_initialise_vnn_map(struct ctdb_context *ctdb)
|
||||
{
|
||||
int i, j, count;
|
||||
unsigned int i, j, count;
|
||||
|
||||
/* initialize the vnn mapping table, skipping any deleted nodes */
|
||||
ctdb->vnn_map = talloc(ctdb, struct ctdb_vnn_map);
|
||||
|
@ -86,7 +86,7 @@ static int db_transaction_start_handler(struct ctdb_db_context *ctdb_db,
|
||||
static int db_transaction_commit_handler(struct ctdb_db_context *ctdb_db,
|
||||
void *private_data)
|
||||
{
|
||||
int healthy_nodes = *(int *)private_data;
|
||||
unsigned int healthy_nodes = *(unsigned int *)private_data;
|
||||
int ret;
|
||||
|
||||
tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
|
||||
@ -414,7 +414,7 @@ static int db_invalidate(struct ctdb_db_context *ctdb_db, void *private_data)
|
||||
*/
|
||||
static int db_count(struct ctdb_db_context *ctdb_db, void *private_data)
|
||||
{
|
||||
int *count = (int *)private_data;
|
||||
unsigned int *count = (unsigned int *)private_data;
|
||||
|
||||
*count += 1;
|
||||
|
||||
@ -464,7 +464,7 @@ static void ctdb_start_freeze(struct ctdb_context *ctdb)
|
||||
ctdb_db_iterator(ctdb, db_invalidate, NULL);
|
||||
|
||||
if (ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
|
||||
int count = 0;
|
||||
unsigned int count = 0;
|
||||
|
||||
/*
|
||||
* Check if all the databases are frozen
|
||||
@ -711,7 +711,7 @@ static int db_cancel_transaction(struct ctdb_db_context *ctdb_db,
|
||||
|
||||
struct db_commit_transaction_state {
|
||||
uint32_t transaction_id;
|
||||
int healthy_nodes;
|
||||
unsigned int healthy_nodes;
|
||||
};
|
||||
|
||||
static int db_commit_transaction(struct ctdb_db_context *ctdb_db,
|
||||
@ -809,7 +809,7 @@ int32_t ctdb_control_db_transaction_commit(struct ctdb_context *ctdb,
|
||||
(struct ctdb_transdb *)indata.dptr;
|
||||
struct ctdb_db_context *ctdb_db;
|
||||
struct db_commit_transaction_state state;
|
||||
int healthy_nodes, i;
|
||||
unsigned int healthy_nodes, i;
|
||||
|
||||
ctdb_db = find_ctdb_db(ctdb, w->db_id);
|
||||
if (ctdb_db == NULL) {
|
||||
|
@ -107,7 +107,7 @@ static void ctdb_check_for_dead_nodes(struct tevent_context *ev,
|
||||
struct timeval t, void *private_data)
|
||||
{
|
||||
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
/* send a keepalive to all other nodes, unless */
|
||||
for (i=0;i<ctdb->num_nodes;i++) {
|
||||
|
@ -86,7 +86,8 @@ static void usage(const char *progname)
|
||||
static uint8_t *hex_decode_talloc(TALLOC_CTX *mem_ctx,
|
||||
const char *hex_in, size_t *len)
|
||||
{
|
||||
int i, num;
|
||||
unsigned int i;
|
||||
int num;
|
||||
uint8_t *buffer;
|
||||
|
||||
*len = strlen(hex_in) / 2;
|
||||
|
@ -425,7 +425,7 @@ int ctdb_load_persistent_health(struct ctdb_context *ctdb,
|
||||
int ctdb_update_persistent_health(struct ctdb_context *ctdb,
|
||||
struct ctdb_db_context *ctdb_db,
|
||||
const char *given_reason,/* NULL means healthy */
|
||||
int num_healthy_nodes)
|
||||
unsigned int num_healthy_nodes)
|
||||
{
|
||||
struct tdb_context *tdb = ctdb->db_persistent_health->tdb;
|
||||
int ret;
|
||||
|
@ -178,7 +178,7 @@ int32_t ctdb_control_trans3_commit(struct ctdb_context *ctdb,
|
||||
{
|
||||
struct ctdb_client *client;
|
||||
struct ctdb_persistent_state *state;
|
||||
int i;
|
||||
unsigned int i;
|
||||
struct ctdb_marshall_buffer *m = (struct ctdb_marshall_buffer *)recdata.dptr;
|
||||
struct ctdb_db_context *ctdb_db;
|
||||
|
||||
|
@ -72,7 +72,7 @@ static int convert_node_map_to_list(struct ctdb_context *ctdb,
|
||||
struct ctdb_node ***nodes,
|
||||
uint32_t *num_nodes)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
*nodes = talloc_zero_array(mem_ctx,
|
||||
struct ctdb_node *, node_map->num);
|
||||
@ -157,7 +157,7 @@ int ctdb_set_address(struct ctdb_context *ctdb, const char *address)
|
||||
*/
|
||||
uint32_t ctdb_get_num_active_nodes(struct ctdb_context *ctdb)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
uint32_t count=0;
|
||||
for (i=0; i < ctdb->num_nodes; i++) {
|
||||
if (!(ctdb->nodes[i]->flags & NODE_FLAGS_INACTIVE)) {
|
||||
@ -383,7 +383,7 @@ static void ctdb_defer_packet(struct ctdb_context *ctdb, struct ctdb_req_header
|
||||
static void ctdb_broadcast_packet_all(struct ctdb_context *ctdb,
|
||||
struct ctdb_req_header *hdr)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
for (i=0; i < ctdb->num_nodes; i++) {
|
||||
if (ctdb->nodes[i]->flags & NODE_FLAGS_DELETED) {
|
||||
continue;
|
||||
@ -399,7 +399,7 @@ static void ctdb_broadcast_packet_all(struct ctdb_context *ctdb,
|
||||
static void ctdb_broadcast_packet_active(struct ctdb_context *ctdb,
|
||||
struct ctdb_req_header *hdr)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
for (i = 0; i < ctdb->num_nodes; i++) {
|
||||
if (ctdb->nodes[i]->flags & NODE_FLAGS_INACTIVE) {
|
||||
continue;
|
||||
@ -416,7 +416,7 @@ static void ctdb_broadcast_packet_active(struct ctdb_context *ctdb,
|
||||
static void ctdb_broadcast_packet_connected(struct ctdb_context *ctdb,
|
||||
struct ctdb_req_header *hdr)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
for (i=0; i < ctdb->num_nodes; i++) {
|
||||
if (ctdb->nodes[i]->flags & NODE_FLAGS_DELETED) {
|
||||
continue;
|
||||
|
@ -75,9 +75,11 @@ struct ctdb_vnn {
|
||||
ctdb_sock_addr public_address;
|
||||
uint8_t public_netmask_bits;
|
||||
|
||||
/* the node number that is serving this public address, if any.
|
||||
If no node serves this ip it is set to -1 */
|
||||
int32_t pnn;
|
||||
/*
|
||||
* The node number that is serving this public address - set
|
||||
* to CTDB_UNKNOWN_PNN if node is serving it
|
||||
*/
|
||||
uint32_t pnn;
|
||||
|
||||
/* List of clients to tickle for this public address */
|
||||
struct ctdb_tcp_array *tcp_array;
|
||||
@ -370,7 +372,7 @@ static void ctdb_control_send_arp(struct tevent_context *ev,
|
||||
{
|
||||
struct ctdb_takeover_arp *arp = talloc_get_type(private_data,
|
||||
struct ctdb_takeover_arp);
|
||||
int i, ret;
|
||||
int ret;
|
||||
struct ctdb_tcp_array *tcparray;
|
||||
const char *iface = ctdb_vnn_iface_string(arp->vnn);
|
||||
|
||||
@ -382,6 +384,8 @@ static void ctdb_control_send_arp(struct tevent_context *ev,
|
||||
|
||||
tcparray = arp->tcparray;
|
||||
if (tcparray) {
|
||||
unsigned int i;
|
||||
|
||||
for (i=0;i<tcparray->num;i++) {
|
||||
struct ctdb_connection *tcon;
|
||||
|
||||
@ -1366,7 +1370,7 @@ int32_t ctdb_control_tcp_client(struct ctdb_context *ctdb, uint32_t client_id,
|
||||
static struct ctdb_connection *ctdb_tcp_find(struct ctdb_tcp_array *array,
|
||||
struct ctdb_connection *tcp)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (array == NULL) {
|
||||
return NULL;
|
||||
@ -1949,7 +1953,7 @@ int32_t ctdb_control_get_tcp_tickle_list(struct ctdb_context *ctdb, TDB_DATA ind
|
||||
ctdb_sock_addr *addr = (ctdb_sock_addr *)indata.dptr;
|
||||
struct ctdb_tickle_list_old *list;
|
||||
struct ctdb_tcp_array *tcparray;
|
||||
int num, i;
|
||||
unsigned int num, i;
|
||||
struct ctdb_vnn *vnn;
|
||||
unsigned port;
|
||||
|
||||
@ -2393,7 +2397,8 @@ static int ctdb_reloadips_child(struct ctdb_context *ctdb)
|
||||
TDB_DATA data;
|
||||
struct ctdb_client_control_state *state;
|
||||
bool first_add;
|
||||
int i, ret;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
CTDB_NO_MEMORY(ctdb, mem_ctx);
|
||||
|
||||
|
@ -692,7 +692,7 @@ struct takeover_state {
|
||||
struct tevent_context *ev;
|
||||
struct ctdb_client_context *client;
|
||||
struct timeval timeout;
|
||||
int num_nodes;
|
||||
unsigned int num_nodes;
|
||||
uint32_t *pnns_connected;
|
||||
int num_connected;
|
||||
uint32_t *pnns_active;
|
||||
@ -1076,8 +1076,8 @@ void takeover_failed(struct tevent_req *req, int ret)
|
||||
req, struct takeover_state);
|
||||
struct tevent_req *subreq;
|
||||
uint32_t max_pnn = CTDB_UNKNOWN_PNN;
|
||||
int max_credits = 0;
|
||||
int pnn;
|
||||
unsigned int max_credits = 0;
|
||||
uint32_t pnn;
|
||||
|
||||
/* Check that bans are enabled */
|
||||
if (state->tun_list->enable_bans == 0) {
|
||||
|
@ -390,7 +390,7 @@ static struct ctdb_traverse_all_handle *ctdb_daemon_traverse_all(struct ctdb_db_
|
||||
/* volatile database, traverse all active nodes */
|
||||
destination = CTDB_BROADCAST_ACTIVE;
|
||||
} else {
|
||||
int i;
|
||||
unsigned int i;
|
||||
/* persistent database, traverse one node, preferably
|
||||
* the local one
|
||||
*/
|
||||
|
@ -53,7 +53,8 @@ struct ctdb_persistent_write_state {
|
||||
*/
|
||||
static int ctdb_persistent_store(struct ctdb_persistent_write_state *state)
|
||||
{
|
||||
int ret, i;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
struct ctdb_rec_data_old *rec = NULL;
|
||||
struct ctdb_marshall_buffer *m = state->m;
|
||||
|
||||
@ -73,8 +74,10 @@ static int ctdb_persistent_store(struct ctdb_persistent_write_state *state)
|
||||
rec = ctdb_marshall_loop_next(m, rec, NULL, &header, &key, &data);
|
||||
|
||||
if (rec == NULL) {
|
||||
DEBUG(DEBUG_ERR,("Failed to get next record %d for db_id 0x%08x in ctdb_persistent_store\n",
|
||||
i, state->ctdb_db->db_id));
|
||||
D_ERR("Failed to get next record %u for db_id 0x%08x "
|
||||
"in ctdb_persistent_store\n",
|
||||
i,
|
||||
state->ctdb_db->db_id);
|
||||
talloc_free(tmp_ctx);
|
||||
goto failed;
|
||||
}
|
||||
|
@ -655,7 +655,7 @@ static void ctdb_vacuum_traverse_db(struct ctdb_db_context *ctdb_db,
|
||||
static void ctdb_process_vacuum_fetch_lists(struct ctdb_db_context *ctdb_db,
|
||||
struct vacuum_data *vdata)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
struct ctdb_context *ctdb = ctdb_db->ctdb;
|
||||
|
||||
for (i = 0; i < ctdb->num_nodes; i++) {
|
||||
@ -924,7 +924,7 @@ static struct vacuum_data *ctdb_vacuum_init_vacuum_data(
|
||||
struct ctdb_db_context *ctdb_db,
|
||||
TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
struct ctdb_context *ctdb = ctdb_db->ctdb;
|
||||
struct vacuum_data *vdata;
|
||||
|
||||
|
@ -741,7 +741,7 @@ static bool event_allowed_during_recovery(enum ctdb_event event)
|
||||
CTDB_EVENT_RELEASE_IP,
|
||||
CTDB_EVENT_IPREALLOCATED,
|
||||
};
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(allowed_events); i++) {
|
||||
if (event == allowed_events[i]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user