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,
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++) {
uint32_t mask,
bool include_self)
{
- int i, j, num_nodes;
+ unsigned int i, j, num_nodes;
uint32_t exclude_pnn;
uint32_t *nodes;
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);
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);
*/
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;
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
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,
(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) {
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++) {
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;
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;
{
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;
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);
*/
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)) {
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;
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;
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;
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;
{
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);
tcparray = arp->tcparray;
if (tcparray) {
+ unsigned int i;
+
for (i=0;i<tcparray->num;i++) {
struct ctdb_connection *tcon;
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;
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;
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);
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;
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) {
/* 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
*/
*/
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;
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;
}
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++) {
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;
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]) {