fsa_input2string(fsa_data->fsa_input),
fsa_input2string(cur_input),
s_crmd_fsa(enum crmd_fsa_cause cause){	fsa_data_t *fsa_data = NULL;	long long actions = fsa_actions;	long long new_actions = A_NOTHING;	long long last_action = A_NOTHING;	enum crmd_fsa_input last_input = I_NULL;	enum crmd_fsa_input cur_input  = I_NULL;	enum crmd_fsa_input next_input = I_NULL;	enum crmd_fsa_state starting_state = fsa_state;	enum crmd_fsa_state last_state = starting_state;	enum crmd_fsa_state cur_state  = starting_state;	enum crmd_fsa_state next_state = starting_state;	#ifdef FSA_TRACE	crm_verbose("FSA invoked with Cause: %s\tState: %s",		   fsa_cause2string(cause),		   fsa_state2string(cur_state));#endif#ifdef DOT_FSA_ACTIONS	if(dot_strm == NULL) {		dot_strm = fopen(DEVEL_DIR"/live.dot", "w");		fprintf(dot_strm, "%s", dot_intro);		fflush(dot_strm);	}#endif		/*	 * Process actions in order of priority but do only one	 * action at a time to avoid complicating the ordering.	 *	 * Actions may result in a new I_ event, these are added to	 * (not replace) existing actions before the next iteration.	 *	 */	do_fsa_stall = FALSE;	while(next_input != I_NULL || actions != A_NOTHING || is_message()) {		if(do_fsa_stall) {			/* we may be waiting for an a-sync task to "happen"			 * and until it does, we cant do anything else			 */			crm_info("Wait until something else happens");			break;		} else if((is_message() && fsa_data == NULL)			  || (is_message() && actions == A_NOTHING && next_input == I_NULL)) {			fsa_data_t *stored_msg = NULL;			crm_debug("Finished with current input..."				  " Checking messages (%d remaining)",				  g_list_length(fsa_message_queue));			next_input = I_NULL;			stored_msg = get_message();						if(stored_msg == NULL) {				crm_crit("Invalid stored message");				exit(1);			}						delete_fsa_input(fsa_data);						if(stored_msg->fsa_cause == C_CCM_CALLBACK) {				crm_devel("FSA processing CCM callback from %s",					  stored_msg->where);			} else if(stored_msg->fsa_cause == C_LRM_OP_CALLBACK) {				crm_devel("FSA processing LRM callback from %s",					  stored_msg->where);			} else if(stored_msg->data == NULL) {				crm_devel("FSA processing input from %s",					  stored_msg->where);							} else {				crm_devel("FSA processing XML message from %s",					  stored_msg->where);								crm_xml_devel(stored_msg->data,					      "FSA processing message");			}			fsa_data = stored_msg;			/* set up the input */			next_input = fsa_data->fsa_input;			/* add any actions back to the queue */			actions |= fsa_data->actions;			/* update the cause */			cause = fsa_data->fsa_cause;			fsa_dump_actions(fsa_data->actions, "\tadded back");			crm_debug("FSA input: State=%s\tCause=%s"				  "\tInput=%s\tOrigin=%s()",				  fsa_state2string(cur_state),				  fsa_cause2string(fsa_data->fsa_cause),				  fsa_input2string(fsa_data->fsa_input),				  fsa_data->where);#ifdef DOT_FSA_ACTIONS			fprintf(dot_strm,				"\t// FSA input: State=%s\tCause=%s"				"\tInput=%s\tOrigin=%s()\n",				fsa_state2string(cur_state),				fsa_cause2string(fsa_data->fsa_cause),				fsa_input2string(fsa_data->fsa_input),				fsa_data->where);						fflush(dot_strm);#endif					} else if(fsa_data == NULL) {			crm_malloc(fsa_data, sizeof(fsa_data_t));			fsa_data->fsa_input = I_NULL;			fsa_data->fsa_cause = cause;			fsa_data->actions   = A_NOTHING;			fsa_data->where     = crm_strdup("s_crmd_fsa (enter)");			fsa_data->data      = NULL;			if(fsa_data->where == NULL) {				crm_crit("Out of memory");				exit(1);			}					}				/* update input variables */		cur_input = next_input;		if(cur_input != I_NULL) {			/* record the most recent non I_NULL input */			crm_devel("Updating last_input to %s",				  fsa_input2string(cur_input));			last_input = cur_input;		}				/* get the next batch of actions */		new_actions = crmd_fsa_actions[cur_input][cur_state];		if(new_actions != A_NOTHING) {#ifdef FSA_TRACE			crm_verbose("Adding actions %.16llx", new_actions);			fsa_dump_actions(new_actions, "\tscheduled");#endif			actions |= new_actions;		}		if(fsa_data == NULL) {			crm_err("No input for FSA.... terminating");			exit(1);		}#ifdef FSA_TRACE		crm_verbose("FSA while loop:\tState: %s, Cause: %s,"			    " Input: %s, Origin=%s",			    fsa_state2string(cur_state),			    fsa_cause2string(fsa_data->fsa_cause),			    fsa_input2string(fsa_data->fsa_input),			    fsa_data->where);#endif				/* logging : *before* the state is changed */		IF_FSA_ACTION(A_ERROR, do_log)		else IF_FSA_ACTION(A_WARN, do_log)		else IF_FSA_ACTION(A_LOG,  do_log)		/* update state variables */		next_state  = crmd_fsa_state[cur_input][cur_state];		last_state  = cur_state;		cur_state   = next_state;		fsa_state   = next_state;		/* start doing things... */		/*		 * Hook for change of state.		 * Allows actions to be added or removed when entering a state		 */		if(last_state != cur_state){			actions = do_state_transition(				actions, cause, last_state, cur_state,				cur_input, fsa_data);		}		/* this is always run, some inputs/states may make various		 * actions irrelevant/invalid		 */		actions = clear_flags(actions, cause, cur_state, cur_input);			/* regular action processing in order of action priority		 *		 * Make sure all actions that connect to required systems		 * are performed first		 */		/* get out of here NOW! before anything worse happens */		IF_FSA_ACTION(A_EXIT_1,		do_exit)		/* essential start tasks */		else IF_FSA_ACTION(A_HA_CONNECT,	do_ha_control)		else IF_FSA_ACTION(A_STARTUP,		do_startup)		else IF_FSA_ACTION(A_CIB_START,		do_cib_control)		else IF_FSA_ACTION(A_READCONFIG,	do_read_config)		/* sub-system start/connect */		else IF_FSA_ACTION(A_LRM_CONNECT,	do_lrm_control)		else IF_FSA_ACTION(A_CCM_CONNECT,	do_ccm_control)		else IF_FSA_ACTION(A_TE_START,		do_te_control)		else IF_FSA_ACTION(A_PE_START,		do_pe_control)				/* sub-system restart		 */		else IF_FSA_ACTION(O_CIB_RESTART,	do_cib_control)		else IF_FSA_ACTION(O_PE_RESTART,	do_pe_control)		else IF_FSA_ACTION(O_TE_RESTART,	do_te_control)				/* Timers */		else IF_FSA_ACTION(O_DC_TIMER_RESTART,      do_timer_control)		else IF_FSA_ACTION(A_DC_TIMER_STOP,         do_timer_control)		else IF_FSA_ACTION(A_DC_TIMER_START,        do_timer_control)		else IF_FSA_ACTION(A_INTEGRATE_TIMER_STOP,  do_timer_control)		else IF_FSA_ACTION(A_INTEGRATE_TIMER_START, do_timer_control)		else IF_FSA_ACTION(A_FINALIZE_TIMER_STOP,   do_timer_control)		else IF_FSA_ACTION(A_FINALIZE_TIMER_START,  do_timer_control)				/*		 * Highest priority actions		 */		else IF_FSA_ACTION(A_CIB_BUMPGEN,	do_cib_invoke)		else IF_FSA_ACTION(A_MSG_ROUTE,		do_msg_route)		else IF_FSA_ACTION(A_RECOVER,		do_recover)		else IF_FSA_ACTION(A_CL_JOIN_REQUEST,	do_cl_join_request)		else IF_FSA_ACTION(A_CL_JOIN_RESULT,	do_cl_join_result)		else IF_FSA_ACTION(A_SHUTDOWN_REQ,	do_shutdown_req)		else IF_FSA_ACTION(A_ELECTION_START,	do_election_vote)		else IF_FSA_ACTION(A_ELECTION_VOTE,	do_election_vote)		else IF_FSA_ACTION(A_ELECTION_COUNT,	do_election_count_vote)				/*		 * High priority actions		 * Update the cache first		 */		else IF_FSA_ACTION(A_CCM_UPDATE_CACHE,	do_ccm_update_cache)		else IF_FSA_ACTION(A_CCM_EVENT,		do_ccm_event)		else IF_FSA_ACTION(A_STARTED,		do_started)				/*		 * Medium priority actions		 */		else IF_FSA_ACTION(A_DC_TAKEOVER,	 do_dc_takeover)		else IF_FSA_ACTION(A_DC_RELEASE,	 do_dc_release)		else IF_FSA_ACTION(A_DC_JOIN_OFFER_ALL,	 do_dc_join_offer_all)		else IF_FSA_ACTION(A_DC_JOIN_OFFER_ONE,	 do_dc_join_offer_one)		else IF_FSA_ACTION(A_DC_JOIN_PROCESS_REQ,do_dc_join_req)		else IF_FSA_ACTION(A_DC_JOIN_PROCESS_ACK,do_dc_join_ack)				/*		 * Low(er) priority actions		 * Make sure the CIB is always updated before invoking the		 * PE, and the PE before the TE		 */		else IF_FSA_ACTION(A_CIB_INVOKE_LOCAL,	do_cib_invoke)		else IF_FSA_ACTION(A_CIB_INVOKE,	do_cib_invoke)		else IF_FSA_ACTION(A_DC_JOIN_FINALIZE,	do_dc_join_finalize)		else IF_FSA_ACTION(A_LRM_INVOKE,	do_lrm_invoke)		else IF_FSA_ACTION(A_LRM_EVENT,		do_lrm_event)		else IF_FSA_ACTION(A_TE_CANCEL,		do_te_invoke)		else IF_FSA_ACTION(A_PE_INVOKE,		do_pe_invoke)		else IF_FSA_ACTION(A_TE_INVOKE,		do_te_invoke)		else IF_FSA_ACTION(A_CL_JOIN_ANNOUNCE,	do_cl_join_announce)				/* sub-system stop */		else IF_FSA_ACTION(A_DC_RELEASED,	do_dc_release)		else IF_FSA_ACTION(A_PE_STOP,		do_pe_control)		else IF_FSA_ACTION(A_TE_STOP,		do_te_control)		else IF_FSA_ACTION(A_CCM_DISCONNECT,	do_ccm_control)		else IF_FSA_ACTION(A_SHUTDOWN,		do_shutdown)		else IF_FSA_ACTION(A_LRM_DISCONNECT,	do_lrm_control)		else IF_FSA_ACTION(A_HA_DISCONNECT,	do_ha_control)		else IF_FSA_ACTION(A_CIB_STOP,		do_cib_control)		else IF_FSA_ACTION(A_STOP,		do_stop)				/* exit gracefully */		else IF_FSA_ACTION(A_EXIT_0,	do_exit)/*		else IF_FSA_ACTION(A_, do_) */					/* Error checking and reporting */		else if(cur_input != I_NULL && actions == A_NOTHING) {			crm_warn(			       "No action specified for input,state (%s,%s)",			       fsa_input2string(cur_input),			       fsa_state2string(cur_state));						next_input = I_NULL;					} else if(cur_input == I_NULL && actions == A_NOTHING) {#ifdef FSA_TRACE			crm_info("Nothing left to do...");			fsa_dump_actions(actions, "still here");#endif			break;					} else {			crm_err("Action %s (0x%llx) not supported ",			       fsa_action2string(actions), actions);			next_input = I_ERROR;		}	}	#ifdef FSA_TRACE	crm_verbose("################# Exiting the FSA (%s) ##################",		  fsa_state2string(fsa_state));#endif#ifdef DOT_FSA_ACTIONS	{		time_t now = time(NULL);		fprintf(dot_strm,						"\t// ### Exiting the FSA (%s): %s\n",			fsa_state2string(fsa_state), asctime(localtime(&now)));		fflush(dot_strm);	}#endif	/* cleanup inputs? */	fsa_actions = actions;	delete_fsa_input(fsa_data);		return fsa_state;}