 if(cur_state != S_STARTING && cur_state != S_STOPPING) { crm_devel("Updating the CIB from CCM cache"); do_update_cib_nodes(NULL, FALSE); } 
do_ccm_update_cache(long long action,		    enum crmd_fsa_cause cause,		    enum crmd_fsa_state cur_state,		    enum crmd_fsa_input current_input,		    fsa_data_t *msg_data){	enum crmd_fsa_input next_input = I_NULL;	int lpc, offset;	GHashTable *members = NULL;	oc_ed_t *event = NULL;	const oc_ev_membership_t *oc = NULL;	oc_node_list_t *tmp = NULL, *membership_copy = NULL;	struct crmd_ccm_data_s *ccm_data = fsa_typed_data(fsa_dt_ccm);	if(ccm_data == NULL) {		crm_err("No data provided to FSA function");		register_fsa_error(C_FSA_INTERNAL, I_FAIL, NULL);		return I_NULL;	}	event = ccm_data->event;	oc = ccm_data->oc;	crm_info("Updating CCM cache after a \"%s\" event.", 	       *event==OC_EV_MS_NEW_MEMBERSHIP?"NEW MEMBERSHIP":	       *event==OC_EV_MS_NOT_PRIMARY?"NOT PRIMARY":	       *event==OC_EV_MS_PRIMARY_RESTORED?"PRIMARY RESTORED":	       *event==OC_EV_MS_EVICTED?"EVICTED":	       "NO QUORUM MEMBERSHIP");	crm_debug("instace=%d, nodes=%d, new=%d, lost=%d n_idx=%d, "		  "new_idx=%d, old_idx=%d",		  oc->m_instance,		  oc->m_n_member,		  oc->m_n_in,		  oc->m_n_out,		  oc->m_memb_idx,		  oc->m_in_idx,		  oc->m_out_idx);	crm_malloc(membership_copy, sizeof(oc_node_list_t));	if(membership_copy == NULL) {		crm_crit("Couldnt create membership copy - out of memory");		register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);		return I_NULL;	}	membership_copy->last_event = *event;	crm_devel("Copying members");	/*--*-- All Member Nodes --*--*/	offset = oc->m_memb_idx;	membership_copy->members_size = oc->m_n_member;	if(membership_copy->members_size > 0) {		membership_copy->members =			g_hash_table_new(g_str_hash, g_str_equal);		members = membership_copy->members;				for(lpc=0; lpc < membership_copy->members_size; lpc++) {			oc_node_t *member = NULL;			crm_devel("Copying member %d", lpc);			crm_malloc(member, sizeof(oc_node_t));						if(member == NULL) {				continue;			}			member->node_id =				oc->m_array[offset+lpc].node_id;						member->node_born_on =				oc->m_array[offset+lpc].node_born_on;						member->node_uname = NULL;			if(oc->m_array[offset+lpc].node_uname != NULL) {				member->node_uname =					crm_strdup(oc->m_array[offset+lpc].node_uname);			} else {				crm_err("Node %d had a NULL uname",					member->node_id);			}			g_hash_table_insert(				members, member->node_uname, member);			}			} else {		membership_copy->members = NULL;	}		crm_devel("Copying new members");	/*--*-- New Member Nodes --*--*/	offset = oc->m_in_idx;	membership_copy->new_members_size = oc->m_n_in;	if(membership_copy->new_members_size > 0) {		membership_copy->new_members =			g_hash_table_new(g_str_hash, g_str_equal);		members = membership_copy->new_members;				for(lpc=0; lpc < membership_copy->new_members_size; lpc++) {			oc_node_t *member = NULL;			crm_malloc(member, sizeof(oc_node_t));			if(member == NULL) {				continue;			}						member->node_uname = NULL;			member->node_id = oc->m_array[offset+lpc].node_id;			member->node_born_on =				oc->m_array[offset+lpc].node_born_on;			if(oc->m_array[offset+lpc].node_uname != NULL) {				member->node_uname =					crm_strdup(oc->m_array[offset+lpc].node_uname);			} else {				crm_err("Node %d had a NULL uname",					member->node_id);			}			g_hash_table_insert(				members, member->node_uname, member);				g_hash_table_insert(members, member->node_uname, member);		}	} else {		membership_copy->new_members = NULL;	}		crm_devel("Copying dead members");	/*--*-- Recently Dead Member Nodes --*--*/	offset = oc->m_out_idx;	membership_copy->dead_members_size = oc->m_n_out;	if(membership_copy->dead_members_size > 0) {		membership_copy->dead_members =			g_hash_table_new(g_str_hash, g_str_equal);		members = membership_copy->dead_members;		for(lpc=0; lpc < membership_copy->dead_members_size; lpc++) {			oc_node_t *member = NULL;			crm_malloc(member, sizeof(oc_node_t));			if(member == NULL) {				continue;			}						member->node_id =				oc->m_array[offset+lpc].node_id;						member->node_born_on =				oc->m_array[offset+lpc].node_born_on;						member->node_uname = NULL;			if(oc->m_array[offset+lpc].node_uname != NULL) {				member->node_uname =					crm_strdup(oc->m_array[offset+lpc].node_uname);			} else {				crm_err("Node %d had a NULL uname",					member->node_id);			}			g_hash_table_insert(				members, member->node_uname, member);				g_hash_table_insert(members, member->node_uname, member);		}	} else {		membership_copy->dead_members = NULL;	}	crm_devel("Replacing old copies");	tmp = fsa_membership_copy;	fsa_membership_copy = membership_copy;	/* Free the old copy */	if(tmp != NULL) {		if(tmp->members != NULL)			g_hash_table_foreach_remove(				tmp->members, ghash_node_clfree, NULL);		if(tmp->new_members != NULL)			g_hash_table_foreach_remove(				tmp->new_members, ghash_node_clfree, NULL);		if(tmp->dead_members != NULL)			g_hash_table_foreach_remove(				tmp->dead_members, ghash_node_clfree, NULL);		crm_free(tmp);	}	crm_devel("Free'd old copies");	if(AM_I_DC) {		/* should be sufficient for only the DC to do this */		crm_data_t *foo = NULL;		HA_Message *no_op = NULL;				crm_devel("Updating the CIB");		foo = do_update_cib_nodes(NULL, FALSE);		free_xml(foo);		/* Membership changed, remind everyone we're here.		 * This will aid detection of duplicate DCs		 */		no_op = create_request(CRM_OP_NOOP, NULL, NULL,				       CRM_SYSTEM_DC, CRM_SYSTEM_CRMD, NULL);			send_msg_via_ha(fsa_cluster_conn, no_op);	}		set_bit_inplace(fsa_input_register, R_CCM_DATA);		return next_input;}
8182	/local/tlutelli/issta_data/temp/c/2005_temp/2005/8182/458c63b5798aa901dcd1e07e19ca248b3f96cf09/ccm.c/buggy/crm/crmd/ccm.c