コード例 #1
0
/**************************************************************************\
 *
 * add_new_req_pid_in_list
 *
 * Description: Add new request in the list..
 *
 * Synopsis:
 *
 * Call Arguments:
 *   pid - Process ID for which timeout has occurrend.
 *
 * Returns:
 *   None.
 *
 * Notes:
 *
\**************************************************************************/
uns32 add_new_req_pid_in_list(NCS_OS_PROC_EXECUTE_TIMED_INFO *req, uns32 pid)
{
	SYSF_PID_LIST *list_entry;

	if (module_cb.init == FALSE)
		return m_LEAP_DBG_SINK(NCSCC_RC_SUCCESS);

	if (NULL == (list_entry = m_MMGR_ALLOC_PRO_EXC))
		return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);

	list_entry->timeout_in_ms = req->i_timeout_in_ms;
	list_entry->exec_cb = req->i_cb;
	list_entry->usr_hdl = req->i_usr_hdl;
	list_entry->exec_hdl = req->o_exec_hdl = NCS_PTR_TO_UNS64_CAST(list_entry);
	list_entry->pid = pid;
	list_entry->pat_node.key_info = (uns8 *)&list_entry->pid;
	list_entry->exec_info_type = SYSF_EXEC_INFO_SIG_CHLD;

	m_NCS_LOCK(&module_cb.tree_lock, NCS_LOCK_WRITE);

	if (NCSCC_RC_SUCCESS != ncs_patricia_tree_add(&module_cb.pid_list, (NCS_PATRICIA_NODE *)list_entry)) {
		m_MMGR_FREE_PRO_EXC(list_entry);
		return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);
	}

	ncs_exc_mdl_start_timer(list_entry);

	m_NCS_UNLOCK(&module_cb.tree_lock, NCS_LOCK_WRITE);

	return NCSCC_RC_SUCCESS;
}
コード例 #2
0
/**********************************************************************************************
 * Name                   : gld_mbcsv_async_update
 *
 * Description            : This routine sends async update events to Standby
 *
 * Arguments              : gld_ab, a2s_evt
 *
 * Return Values          :
 *
 * Notes                  : None
**********************************************************************************************/
uint32_t glsv_gld_mbcsv_async_update(GLSV_GLD_CB *gld_cb, GLSV_GLD_A2S_CKPT_EVT *a2s_evt)
{
	NCS_MBCSV_ARG arg;
	uint32_t rc = SA_AIS_OK;
	TRACE_ENTER();

	if ((a2s_evt == NULL) || (gld_cb == NULL)) {
		LOG_ER("GLD ncs mbcsv svc failed");
		rc = NCSCC_RC_FAILURE;
		goto end;
	}
	/* populate the arg structure */
	arg.i_op = NCS_MBCSV_OP_SEND_CKPT;
	arg.i_mbcsv_hdl = gld_cb->mbcsv_handle;
	arg.info.send_ckpt.i_ckpt_hdl = gld_cb->o_ckpt_hdl;
	arg.info.send_ckpt.i_send_type = NCS_MBCSV_SND_SYNC;
	arg.info.send_ckpt.i_reo_type = a2s_evt->evt_type;
	arg.info.send_ckpt.i_reo_hdl = NCS_PTR_TO_UNS64_CAST(a2s_evt);
	arg.info.send_ckpt.i_action = NCS_MBCSV_ACT_UPDATE;

	/*send the message using MBCSv */
	rc = ncs_mbcsv_svc(&arg);
	if (rc != SA_AIS_OK) 
		LOG_ER("GLD ncs mbcsv svc failed");
	 	
 end:	
	TRACE_LEAVE();
	return rc;
}
コード例 #3
0
ファイル: mqa_init.c プロジェクト: helioloureiro/opensaf-fork
/****************************************************************************
  Name          : mqa_client_tree_find_and_add
 
  Description   : This routine adds the new client to the client tree and creates
                  the selection object for that client.
 
  Arguments     : 
                  mqa_cb : pointer to the mqa control block.
                  hdl_id : the handle id.
                  flag   : true/false if true create the new node if node 
                           doesn't exist.FALSE -> search for an existing node.
 
  Return Values : returns the MQA_CLIENT_INFO node.
 
  Notes         : The caller takes the cb lock before calling this function
                  
******************************************************************************/
MQA_CLIENT_INFO *mqa_client_tree_find_and_add(MQA_CB *mqa_cb, SaMsgHandleT hdl_id, bool flag)
{
	MQA_CLIENT_INFO *client_info = NULL;
	NCS_PATRICIA_PARAMS param;
	uint32_t rc = NCSCC_RC_SUCCESS;
	TRACE_ENTER();

	client_info = (MQA_CLIENT_INFO *)ncs_patricia_tree_get(&mqa_cb->mqa_client_tree, (uint8_t *)&hdl_id);

	if (flag == true) {
		/* create and allocate the memory */
		if (!client_info) {
			client_info = (MQA_CLIENT_INFO *)m_MMGR_ALLOC_MQA_CLIENT_INFO;
			if (!client_info) {
				TRACE_4("Client database creation failed");
				return NULL;
			}
			memset(client_info, 0, sizeof(MQA_CLIENT_INFO));
			/* Store the client_info pointer as msghandle. */
			client_info->msgHandle = NCS_PTR_TO_UNS64_CAST(client_info);
			client_info->patnode.key_info = (uint8_t *)&client_info->msgHandle;

			if ((rc =
			     ncs_patricia_tree_add(&mqa_cb->mqa_client_tree,
						   &client_info->patnode)) != NCSCC_RC_SUCCESS) {
				TRACE_2("Client database Registration Failed");
				m_MMGR_FREE_MQA_CLIENT_INFO(client_info);
				return NULL;
			}

			/* Create the group track tree */
			memset(&param, 0, sizeof(NCS_PATRICIA_PARAMS));
			param.key_size = SA_MAX_NAME_LENGTH;
			if (ncs_patricia_tree_init(&client_info->mqa_track_tree, &param) != NCSCC_RC_SUCCESS) {
				TRACE_2("Initialization of the client tree failed");
				m_MMGR_FREE_MQA_CLIENT_INFO(client_info);
				return NULL;
			}

		}
	}
	TRACE_LEAVE();
	return client_info;
}
コード例 #4
0
/****************************************************************************
  Name          : mqa_client_tree_find_and_add
 
  Description   : This routine adds the new client to the client tree and creates
                  the selection object for that client.
 
  Arguments     : 
                  mqa_cb : pointer to the mqa control block.
                  hdl_id : the handle id.
                  flag   : TRUE/FALSE if TRUE create the new node if node 
                           doesn't exist.FALSE -> search for an existing node.
 
  Return Values : returns the MQA_CLIENT_INFO node.
 
  Notes         : The caller takes the cb lock before calling this function
                  
******************************************************************************/
MQA_CLIENT_INFO *mqa_client_tree_find_and_add(MQA_CB *mqa_cb, SaMsgHandleT hdl_id, NCS_BOOL flag)
{
	MQA_CLIENT_INFO *client_info = NULL;
	NCS_PATRICIA_PARAMS param;
	uns32 rc = NCSCC_RC_SUCCESS;

	client_info = (MQA_CLIENT_INFO *)ncs_patricia_tree_get(&mqa_cb->mqa_client_tree, (uns8 *)&hdl_id);

	if (flag == TRUE) {
		/* create and allocate the memory */
		if (!client_info) {
			client_info = (MQA_CLIENT_INFO *)m_MMGR_ALLOC_MQA_CLIENT_INFO;
			if (!client_info) {
				m_LOG_MQSV_A(MQA_CLIENT_ALLOC_FAILED, NCSFL_LC_MQSV_INIT, NCSFL_SEV_ERROR, 0, __FILE__,
					     __LINE__);
				return NULL;
			}
			memset(client_info, 0, sizeof(MQA_CLIENT_INFO));
			/* Store the client_info pointer as msghandle. */
			client_info->msgHandle = NCS_PTR_TO_UNS64_CAST(client_info);
			client_info->patnode.key_info = (uns8 *)&client_info->msgHandle;

			if ((rc =
			     ncs_patricia_tree_add(&mqa_cb->mqa_client_tree,
						   &client_info->patnode)) != NCSCC_RC_SUCCESS) {
				m_LOG_MQSV_A(MQA_CLIENT_TREE_ADD_FAILED, NCSFL_LC_MQSV_INIT, NCSFL_SEV_ERROR, rc,
					     __FILE__, __LINE__);
				m_MMGR_FREE_MQA_CLIENT_INFO(client_info);
				return NULL;
			}

			/* Create the group track tree */
			memset(&param, 0, sizeof(NCS_PATRICIA_PARAMS));
			param.key_size = SA_MAX_NAME_LENGTH;
			if (ncs_patricia_tree_init(&client_info->mqa_track_tree, &param) != NCSCC_RC_SUCCESS) {
				m_MMGR_FREE_MQA_CLIENT_INFO(client_info);
				return NULL;
			}

		}
	}
	return client_info;
}