enum crmd_fsa_input next_input = I_NULL;
s_crmd_fsa(enum crmd_fsa_cause cause){	fsa_data_t *fsa_data = NULL;	long long register_copy = fsa_input_register;	long long new_actions = A_NOTHING;	long long last_action = A_NOTHING;	enum crmd_fsa_input next_input = I_NULL;	enum crmd_fsa_state last_state = fsa_state;		crm_debug("FSA invoked with Cause: %s\tState: %s",		    fsa_cause2string(cause),		    fsa_state2string(fsa_state));	do_fsa_stall = FALSE;	if(is_message() == FALSE && fsa_actions != A_NOTHING) {		/* fake the first message so we can get into the loop */		crm_malloc0(fsa_data, sizeof(fsa_data_t));		fsa_data->fsa_input = I_NULL;		fsa_data->fsa_cause = C_FSA_INTERNAL;		fsa_data->origin    = __FUNCTION__;		fsa_data->data_type = fsa_dt_none;		fsa_message_queue = g_list_append(fsa_message_queue, fsa_data);		fsa_data = NULL;	}	while(is_message() && do_fsa_stall == FALSE) {		crm_debug("Checking messages (%d remaining)",			    g_list_length(fsa_message_queue));				delete_fsa_input(fsa_data);		fsa_data = get_message();				CRM_DEV_ASSERT(fsa_data != NULL);		if(crm_assert_failed) {			continue;		}		log_fsa_input(fsa_data);				/* add any actions back to the queue */		fsa_actions |= fsa_data->actions;		/* get the next batch of actions */		new_actions = crmd_fsa_actions[fsa_data->fsa_input][fsa_state];		fsa_actions |= new_actions;#ifdef FSA_TRACE		if(new_actions != A_NOTHING) {			crm_debug("Adding FSA actions %.16llx for %s/%s",				  new_actions, fsa_input2string(fsa_data->fsa_input),				  fsa_state2string(fsa_state));			fsa_dump_actions(new_actions, "\tFSA scheduled");		} else if(fsa_data->fsa_input != I_NULL && new_actions == A_NOTHING) {			crm_debug("No action specified for input,state (%s,%s)",				  fsa_input2string(fsa_data->fsa_input),				  fsa_state2string(fsa_state));		}		if(fsa_data->actions != A_NOTHING) {			crm_debug("Adding input actions %.16llx for %s/%s",				    new_actions, fsa_input2string(fsa_data->fsa_input),				    fsa_state2string(fsa_state));			fsa_dump_actions(fsa_data->actions,"\tInput scheduled");		}				do_dot_log(DOT_PREFIX"\t// FSA input: State=%s \tCause=%s"			   " \tInput=%s \tOrigin=%s() \tid=%d",			   fsa_state2string(fsa_state),			   fsa_cause2string(fsa_data->fsa_cause),			   fsa_input2string(fsa_data->fsa_input),			   fsa_data->origin, fsa_data->id);#endif		/* logging : *before* the state is changed */		IF_FSA_ACTION(A_ERROR, do_log)		IF_FSA_ACTION(A_WARN,  do_log)		IF_FSA_ACTION(A_LOG,   do_log)		/* update state variables */		last_state = fsa_state;		fsa_state  = crmd_fsa_state[fsa_data->fsa_input][fsa_state];		/*		 * Hook to allow actions to removed due to certain inputs		 */		fsa_actions = clear_flags(			fsa_actions, cause, fsa_state, fsa_data->fsa_input);				/*		 * Hook for change of state.		 * Allows actions to be added or removed when entering a state		 */		if(last_state != fsa_state){			fsa_actions = do_state_transition(				fsa_actions, last_state, fsa_state, fsa_data);		}		/* start doing things... */		s_crmd_fsa_actions(fsa_data);	}		crm_debug("Exiting the FSA: is_message=%s, queue=%d, fsa_data=%p,"		  " fsa_actions=0x%llx, next_input=%s, stalled=%s",		  is_message()?"true":"false", g_list_length(fsa_message_queue),		  fsa_data, fsa_actions, fsa_input2string(next_input),		  do_fsa_stall?"true":"false");		/* cleanup inputs? */	delete_fsa_input(fsa_data);	if(register_copy != fsa_input_register) {		fsa_dump_inputs(LOG_DEBUG, fsa_input_register);	}		fsa_dump_queue(LOG_DEBUG_2);		return fsa_state;}