当前位置: 首页>>代码示例>>C++>>正文


C++ LOG_ER函数代码示例

本文整理汇总了C++中LOG_ER函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_ER函数的具体用法?C++ LOG_ER怎么用?C++ LOG_ER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LOG_ER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: avnd_evt_ava_comp_val_req

/******************************************************************************
  Name          : avnd_evt_ava_comp_val_req
 
  Description   : This routine creates a validation req msg and sends to AvD.
 
  Arguments     : cb  - ptr to the AvND control block.
                  evt - ptr to the AvND event.
 
  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
 
  Notes         : None
******************************************************************************/
uns32 avnd_evt_ava_comp_val_req(AVND_CB *cb, AVND_EVT *evt)
{
	uns32 rc = NCSCC_RC_SUCCESS;
	AVND_DND_MSG_LIST *rec = 0;
	AVND_MSG msg;
	AVSV_AMF_API_INFO *api_info = &evt->info.ava.msg->info.api_info;
	AVSV_AMF_COMP_REG_PARAM *reg = &api_info->param.reg;

	TRACE_ENTER2("%s,Type=%u,Hdl=%llx",
			      reg->comp_name.value, api_info->type, reg->hdl);

	memset(&msg, 0, sizeof(AVND_MSG));

	/* populate the msg */
	if (0 != (msg.info.avd = calloc(1, sizeof(AVSV_DND_MSG)))) {
		msg.type = AVND_MSG_AVD;
		msg.info.avd->msg_type = AVSV_N2D_COMP_VALIDATION_MSG;
		msg.info.avd->msg_info.n2d_comp_valid_info.msg_id = ++(cb->snd_msg_id);
		msg.info.avd->msg_info.n2d_comp_valid_info.node_id = cb->node_info.nodeId;
		msg.info.avd->msg_info.n2d_comp_valid_info.comp_name =
		    evt->info.ava.msg->info.api_info.param.reg.comp_name;

		/* add the record to the AvD msg list */
		if ((0 != (rec = avnd_diq_rec_add(cb, &msg)))) {
			/* These parameters would not be encoded or decoded so, wouldn't be sent to AvD. */
			rec->msg.info.avd->msg_info.n2d_comp_valid_info.hdl = reg->hdl;
			rec->msg.info.avd->msg_info.n2d_comp_valid_info.proxy_comp_name = reg->proxy_comp_name;
			rec->msg.info.avd->msg_info.n2d_comp_valid_info.mds_dest = api_info->dest;
			rec->msg.info.avd->msg_info.n2d_comp_valid_info.mds_ctxt = evt->mds_ctxt;
			/* send the message */
			rc = avnd_diq_rec_send(cb, rec);

			if ((NCSCC_RC_SUCCESS != rc) && rec) {
				LOG_ER("avnd_diq_rec_send:failed:%s,Type:%u and Hdl%llx",
						    reg->comp_name.value, api_info->type, reg->hdl);
				/* pop & delete */
				m_AVND_DIQ_REC_FIND_POP(cb, rec);
				avnd_diq_rec_del(cb, rec);
			}
		} else {
			rc = NCSCC_RC_FAILURE;
			LOG_ER("avnd_diq_rec_add failed::%s,Type:%u and Hdl%llx",
						reg->comp_name.value, api_info->type, reg->hdl);
		}
	} else
		rc = NCSCC_RC_FAILURE;

	if (NCSCC_RC_FAILURE == rc) {
		LOG_ER("avnd_evt_ava_comp_val_req:%s,Type:%u and Hdl%llx",
						reg->comp_name.value, api_info->type, reg->hdl); 
	}
	/* free the contents of avnd message */
	avnd_msg_content_free(cb, &msg);

	return rc;

}
开发者ID:kenzaburo,项目名称:OpenSaf-FrameWork,代码行数:69,代码来源:avnd_proxy.c

示例2: smfnd_amf_init

/**************************************************************************
 Function: smfnd_amf_init

 Purpose:  Function which initializes SMFND with AMF.  

 Input:    None 

 Returns:  SA_AIS_OK    - everything is OK
           SA_AIS_ERR_* - failure

**************************************************************************/
SaAisErrorT smfnd_amf_init(smfnd_cb_t * cb)
{
	SaAmfCallbacksT amfCallbacks;
	SaVersionT amf_version;
	SaAisErrorT result;

	TRACE_ENTER();

	/* Initialize AMF callbacks */
	memset(&amfCallbacks, 0, sizeof(SaAmfCallbacksT));
	amfCallbacks.saAmfHealthcheckCallback = amf_health_chk_callback;
	amfCallbacks.saAmfCSISetCallback = amf_csi_set_callback;
	amfCallbacks.saAmfComponentTerminateCallback = amf_comp_terminate_callback;
	amfCallbacks.saAmfCSIRemoveCallback = amf_csi_rmv_callback;

	amf_version.releaseCode = 'B';
	amf_version.majorVersion = 0x01;
	amf_version.minorVersion = 0x01;

	/* Initialize the AMF library */
	result = saAmfInitialize(&cb->amf_hdl, &amfCallbacks, &amf_version);
	if (result != SA_AIS_OK) {
		LOG_ER("saAmfInitialize() FAILED: %u", result);
		goto done;
	}

	/* Obtain the AMF selection object to wait for AMF events */
	result = saAmfSelectionObjectGet(cb->amf_hdl, &cb->amfSelectionObject);
	if (result != SA_AIS_OK) {
		LOG_ER("saAmfSelectionObjectGet() FAILED: %u", result);
		goto done;
	}

	/* Get the component name */
	result = saAmfComponentNameGet(cb->amf_hdl, &cb->comp_name);
	if (result != SA_AIS_OK) {
		LOG_ER("saAmfComponentNameGet() FAILED: %u", result);
		goto done;
	}

	/* Register component with AMF */
	result = saAmfComponentRegister(cb->amf_hdl, &cb->comp_name, (SaNameT *) NULL);
	if (result != SA_AIS_OK) {
		LOG_ER("saAmfComponentRegister() FAILED");
		goto done;
	}

	/* Start AMF healthchecks */
	if ((result = amf_healthcheck_start(cb)) != SA_AIS_OK) {
		LOG_ER("amf_healthcheck_start() FAILED");
		goto done;
	}

 done:
	TRACE_LEAVE();
	return result;
}
开发者ID:kenzaburo,项目名称:OpenSaf-FrameWork,代码行数:68,代码来源:smfnd_amf.c

示例3: initialize_smfnd

/**
 * Initialize smfnd
 * 
 * @return uns32
 */
static uns32 initialize_smfnd(void)
{
	uns32 rc;

	TRACE_ENTER();

	if (ncs_agents_startup() != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_agents_startup FAILED");
		rc = NCSCC_RC_FAILURE;
		goto done;
	}

	/* Initialize smfnd control block */
	if (smfnd_cb_init(smfnd_cb) != NCSCC_RC_SUCCESS) {
		TRACE("smfnd_cb_init FAILED");
		rc = NCSCC_RC_FAILURE;
		goto done;
	}

	/* Create the mailbox used for communication with SMFD/SMFA */
	if ((rc = m_NCS_IPC_CREATE(&smfnd_cb->mbx)) != NCSCC_RC_SUCCESS) {
		LOG_ER("m_NCS_IPC_CREATE FAILED %d", rc);
		goto done;
	}

	/* Attach mailbox to this thread */
	if ((rc = m_NCS_IPC_ATTACH(&smfnd_cb->mbx) != NCSCC_RC_SUCCESS)) {
		LOG_ER("m_NCS_IPC_ATTACH FAILED %d", rc);
		goto done;
	}

	/* Create a selection object for USR1 signal handling */
	if ((rc = ncs_sel_obj_create(&smfnd_cb->usr1_sel_obj)) != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_sel_obj_create failed");
		goto done;
	}

	/* Initialize mds communication */
	if ((rc = smfnd_mds_init(smfnd_cb)) != NCSCC_RC_SUCCESS) {
		TRACE("smfnd_mds_init FAILED %d", rc);
		return rc;
	}

	/* Check if AMF started */
	if (smfnd_cb->nid_started == 0) {
		/* Started by AMF, so let's init AMF */
		if ((rc = smfnd_amf_init(smfnd_cb)) != NCSCC_RC_SUCCESS) {
			LOG_ER("init amf failed");
			goto done;
		}
	}

 done:
	TRACE_LEAVE();
	return (rc);
}
开发者ID:kenzaburo,项目名称:OpenSaf-FrameWork,代码行数:61,代码来源:smfnd_main.c

示例4: glsv_gld_standby_rsc_close

/****************************************************************************
 * Name          : glsv_gld_standby_rsc_close
 *
 * Description   : This is the function is invoked when a rsc_close event is
 *                 is sent from avtive GLD to standby GLD. This function will
 *                  remove references to
 *                 to this resource from the mentioned node. If the resource
 *                 is not referred any longer then the data structures are freed
 *                 up.
 *
 * Arguments     : async_evt  - Event structure
 *
 * Return Values : NCSCC_RC_SUCCESS/ NCSCC_RC_FAILURE
 *
 * Notes         : None.
 *****************************************************************************/
static uint32_t glsv_gld_standby_rsc_close(GLSV_GLD_A2S_CKPT_EVT *async_evt)
{
	GLSV_GLD_CB *gld_cb;
	GLSV_GLD_GLND_DETAILS *node_details;
	GLSV_GLD_GLND_RSC_REF *glnd_rsc;
	bool orphan_flag;
	uint32_t node_id;
	uint32_t rc = NCSCC_RC_FAILURE;
	TRACE_ENTER();

	if (async_evt == NULL)
		goto end;
	node_id = m_NCS_NODE_ID_FROM_MDS_DEST(async_evt->info.rsc_details.mdest_id);

	if ((gld_cb = (NCSCONTEXT)ncshm_take_hdl(NCS_SERVICE_ID_GLD, gl_gld_hdl))
	    == NULL) {
		LOG_ER("Handle take failed");
		goto end;
	}

	orphan_flag = async_evt->info.rsc_details.orphan;

	/* Find if the node details are available */
	if ((node_details =
	     (GLSV_GLD_GLND_DETAILS *)ncs_patricia_tree_get(&gld_cb->glnd_details, (uint8_t *)&node_id)) == NULL) {
		LOG_ER("Patricia tree get failed: node_id %u", node_id);
		goto error;
	}

	glnd_rsc = (GLSV_GLD_GLND_RSC_REF *)ncs_patricia_tree_get(&node_details->rsc_info_tree,
								  (uint8_t *)&async_evt->info.rsc_details.rsc_id);
	if (glnd_rsc == NULL) {
		LOG_ER("Patricia tree get failed");
		goto error;

	}

	glnd_rsc->rsc_info->saf_rsc_no_of_users = glnd_rsc->rsc_info->saf_rsc_no_of_users - 1;

	if (async_evt->info.rsc_details.lcl_ref_cnt == 0)
		gld_rsc_rmv_node_ref(gld_cb, glnd_rsc->rsc_info, glnd_rsc, node_details, orphan_flag);

	TRACE_1("GLD a2s evt rsc close success: rsc_id %u node_id %u",
		      async_evt->info.rsc_details.rsc_id, node_id);
	ncshm_give_hdl(gld_cb->my_hdl);
	rc = NCSCC_RC_SUCCESS;
	goto end;
 error:
	LOG_ER("GLD a2s evt rsc close failed: rsc_id %u node_id %u",
		      async_evt->info.rsc_details.rsc_id, node_id);
	ncshm_give_hdl(gld_cb->my_hdl);
 end:	
	TRACE_LEAVE();
	return rc;
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:71,代码来源:gld_standby.c

示例5: initialize_rde

/**
 * Initialize the RDE server.
 * 
 * @return int, 0=OK
 */
static int initialize_rde(void)
{
	RDE_RDA_CB *rde_rda_cb = &rde_cb->rde_rda_cb;
	int rc = NCSCC_RC_FAILURE;
	char *val;

	/* Determine how this process was started, by NID or AMF */
	if (getenv("SA_AMF_COMPONENT_NAME") == NULL)
		rde_cb->rde_amf_cb.nid_started = true;

	if ((val = getenv("RDE_DISCOVER_PEER_TIMEOUT")) != NULL)
		discover_peer_timeout = strtoul(val, NULL, 0);

	TRACE("discover_peer_timeout=%d", discover_peer_timeout);

	if ((rc = ncs_core_agents_startup()) != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_core_agents_startup FAILED");
		goto init_failed;
	}

	if (rde_cb->rde_amf_cb.nid_started &&
		(rc = ncs_sel_obj_create(&usr1_sel_obj)) != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_sel_obj_create FAILED");
		goto init_failed;
	}

	if ((rc = ncs_ipc_create(&rde_cb->mbx)) != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_ipc_create FAILED");
		goto init_failed;
	}

	if ((rc = ncs_ipc_attach(&rde_cb->mbx)) != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_ipc_attach FAILED");
		goto init_failed;
	}

	rde_my_node_id = ncs_get_node_id();

	if ((rc = rde_rda_open(RDE_RDA_SOCK_NAME, rde_rda_cb)) != NCSCC_RC_SUCCESS)
		goto init_failed;

	if (rde_cb->rde_amf_cb.nid_started &&
		signal(SIGUSR1, sigusr1_handler) == SIG_ERR) {
		LOG_ER("signal USR1 FAILED: %s", strerror(errno));
		goto init_failed;
	}

	if (rde_mds_register(rde_cb) != NCSCC_RC_SUCCESS)
		goto init_failed;

	rc = NCSCC_RC_SUCCESS;

 init_failed:
	return rc;
}
开发者ID:indonexia2004,项目名称:opensaf-indo,代码行数:60,代码来源:rde_main.c

示例6: plms_amf_init

/****************************************************************************
 * Name          : plms_amf_init
 *
 * Description   : PLMS initializes AMF for invoking process and registers 
 *                 the various callback functions.
 *
 * Arguments     : PLMS_CB - PLMS control block pointer.
 *
 * Return Values : NCSCC_RC_SUCCESS/Error Code.
 *
 * Notes         : None.
 *****************************************************************************/
SaUint32T plms_amf_init()
{
	PLMS_CB * cb = plms_cb;
	SaAmfCallbacksT amfCallbacks;
	SaVersionT amf_version;
	uint32_t rc = NCSCC_RC_SUCCESS;

	TRACE_ENTER();

	if (cb->nid_started &&
		amf_comp_name_get_set_from_file("PLMD_COMP_NAME_FILE", &cb->comp_name) != NCSCC_RC_SUCCESS)
                goto done;

	/* Initialize amf callbacks */
	memset(&amfCallbacks, 0, sizeof(SaAmfCallbacksT));

	amfCallbacks.saAmfHealthcheckCallback = plms_amf_health_chk_callback;
	amfCallbacks.saAmfCSISetCallback = plms_amf_CSI_set_callback;
	amfCallbacks.saAmfComponentTerminateCallback = plms_amf_comp_terminate_callback;
	amfCallbacks.saAmfCSIRemoveCallback = plms_amf_csi_rmv_callback;

	m_PLMS_GET_AMF_VER(amf_version);

	/*Initialize the amf library */

	rc = saAmfInitialize(&cb->amf_hdl, &amfCallbacks, &amf_version);

	if (rc != SA_AIS_OK) {
		LOG_ER("  plms_amf_init: saAmfInitialize() AMF initialization FAILED\n");
		goto done;
	}
	LOG_IN("  plms_amf_init: saAmfInitialize() AMF initialization SUCCESS\n");

	/* Obtain the amf selection object to wait for amf events */
	if (SA_AIS_OK != (rc = saAmfSelectionObjectGet(cb->amf_hdl, &cb->amf_sel_obj))) {
		LOG_ER("saAmfSelectionObjectGet() FAILED\n");
		goto done;
	}
	LOG_IN("saAmfSelectionObjectGet() SUCCESS\n");

	/* get the component name */

	rc = saAmfComponentNameGet(cb->amf_hdl, &cb->comp_name);
	if (rc != SA_AIS_OK) {
		LOG_ER("  plmss_amf_init: saAmfComponentNameGet() FAILED\n");
		goto done ;
	}

	rc = NCSCC_RC_SUCCESS;
done:
        TRACE_LEAVE2("%u, %s", rc, cb->comp_name.value);
        return rc;

}	/*End plms_amf_init */
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:66,代码来源:plms_amf.c

示例7: amf_active_state_handler

/****************************************************************************
 * Name          : amf_active_state_handler
 *
 * Description   : This function is called upon receiving an active state
 *                 assignment from AMF.
 *
 * Arguments     : invocation - Designates a particular invocation.
 *                 cb         - A pointer to the LGS control block. 
 *
 * Return Values : None
 *
 * Notes         : None 
 *****************************************************************************/
static SaAisErrorT amf_active_state_handler(lgs_cb_t *cb, SaInvocationT invocation)
{
	log_stream_t *stream;
	SaAisErrorT error = SA_AIS_OK;

	TRACE_ENTER2("HA ACTIVE request");

	if (cb->ha_state == SA_AMF_HA_ACTIVE) {
		/* State change was already processed in RDA callback */
		goto done;
	}

	/* switch over, become implementer
	 * If a configuration object exists then we are an object applier that has
	 * to be cleared before we can become an object implementer.
	 */
	immutilWrapperProfile.nTries = 250; /* LOG will be blocked until IMM responds */
	immutilWrapperProfile.errorsAreFatal = 0;
	if ((error = immutil_saImmOiImplementerSet(lgs_cb->immOiHandle, "safLogService"))
			!= SA_AIS_OK) {
		LOG_ER("saImmOiClassImplementerSet (safLogService) failed: %d", error);
		goto done;
	}
	if ((error = immutil_saImmOiClassImplementerSet(lgs_cb->immOiHandle,
			"SaLogStreamConfig")) != SA_AIS_OK) {
		LOG_ER("saImmOiClassImplementerSet (SaLogStreamConfig) failed: %d", error);
		goto done;
	}
	/* Do this only if the class exists */
	if (*(bool*) lgs_imm_logconf_get(LGS_IMM_LOG_OPENSAFLOGCONFIG_CLASS_EXIST, NULL)) {
		if ((error = immutil_saImmOiClassImplementerSet(cb->immOiHandle, "OpenSafLogConfig"))
				!= SA_AIS_OK) {
			LOG_ER("saImmOiClassImplementerSet (OpenSafLogConfig) failed: %d", error);
			goto done;
		}
	}

	/* check existing streams */
	stream = log_stream_getnext_by_name(NULL);
	if (!stream)
		LOG_ER("No streams exist!");
	while (stream != NULL) {
		*stream->p_fd = -1; /* First Initialize fd */
		stream = log_stream_getnext_by_name(stream->name);
	}

 done:
	immutilWrapperProfile.nTries = 20; /* Reset retry time to more normal value. */
	immutilWrapperProfile.errorsAreFatal = 1;
	/* Update role independent of stream processing */
	lgs_cb->mds_role = V_DEST_RL_ACTIVE;
	TRACE_LEAVE();
	return error;
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:67,代码来源:lgs_amf.c

示例8: rde_amf_init

uns32 rde_amf_init(RDE_AMF_CB *rde_amf_cb)
{
	uns32 rc = NCSCC_RC_SUCCESS;
	SaAisErrorT amf_error = SA_AIS_OK;
	SaNameT sname;
	SaAmfCallbacksT amfCallbacks;
	SaVersionT amf_version;

	TRACE_ENTER();

	if (amf_comp_name_get_set_from_file("RDE_COMP_NAME_FILE", &sname) != NCSCC_RC_SUCCESS)
		return NCSCC_RC_FAILURE;

	amfCallbacks.saAmfHealthcheckCallback = rde_saf_health_chk_callback;
	amfCallbacks.saAmfCSISetCallback = rde_saf_CSI_set_callback;
	amfCallbacks.saAmfCSIRemoveCallback = rde_saf_CSI_rem_callback;
	amfCallbacks.saAmfComponentTerminateCallback = rde_saf_comp_terminate_callback;

	m_RDE_GET_AMF_VER(amf_version);

	amf_error = saAmfInitialize(&rde_amf_cb->amf_hdl, &amfCallbacks, &amf_version);
	if (amf_error != SA_AIS_OK) {
		LOG_ER("saAmfInitialize FAILED %u", amf_error);
		return NCSCC_RC_FAILURE;
	}

	memset(&sname, 0, sizeof(sname));
	amf_error = saAmfComponentNameGet(rde_amf_cb->amf_hdl, &sname);
	if (amf_error != SA_AIS_OK) {
		LOG_ER("saAmfComponentNameGet FAILED %u", amf_error);
		return NCSCC_RC_FAILURE;
	}

	strcpy((char*)rde_amf_cb->comp_name, (char*)sname.value);

	amf_error = saAmfSelectionObjectGet(rde_amf_cb->amf_hdl, &rde_amf_cb->amf_fd);
	if (amf_error != SA_AIS_OK) {
		LOG_ER("saAmfSelectionObjectGet FAILED %u", amf_error);
		return NCSCC_RC_FAILURE;
	}

	amf_error = saAmfComponentRegister(rde_amf_cb->amf_hdl, &sname, (SaNameT *)NULL);
	if (amf_error != SA_AIS_OK) {
		LOG_ER("saAmfComponentRegister FAILED %u", amf_error);
		return NCSCC_RC_FAILURE;
	}

	rc = rde_amf_healthcheck_start(rde_amf_cb);
	if (rc != NCSCC_RC_SUCCESS)
		return NCSCC_RC_FAILURE;

	TRACE_LEAVE2("AMF Initialization SUCCESS......");
	return(rc);
}
开发者ID:kenzaburo,项目名称:OpenSaf-FrameWork,代码行数:54,代码来源:rde_amf.c

示例9: gld_process_tmr_node_restart_wait_timeout

/*****************************************************************************
  PROCEDURE NAME : gld_process_tmr_node_restart_wait_timeout

  DESCRIPTION    :

  ARGUMENTS      :gld_cb      - ptr to the GLD control block
                  evt          - ptr to the event.

  RETURNS        :NCSCC_RC_FAILURE/NCSCC_RC_SUCCESS

  NOTES         : None
*****************************************************************************/
static uint32_t gld_process_tmr_node_restart_wait_timeout(GLSV_GLD_EVT *evt)
{
	GLSV_GLD_CB *gld_cb = evt->gld_cb;
	GLSV_GLD_GLND_DETAILS *node_details;
	GLSV_GLD_GLND_RSC_REF *glnd_rsc;
	SaLckResourceIdT rsc_id;
	uint32_t node_id;

	node_id = m_NCS_NODE_ID_FROM_MDS_DEST(evt->info.tmr.mdest_id);
	TRACE_ENTER2("Node restart wait timer expired: node_id %u", node_id);

	if ((node_details =
	     (GLSV_GLD_GLND_DETAILS *)ncs_patricia_tree_get(&gld_cb->glnd_details, (uint8_t *)&node_id)) == NULL) {
		LOG_ER("Evenr from unknown glnd: node_id %u", node_id);
		return NCSCC_RC_FAILURE;
	}

	if (gld_cb->ha_state == SA_AMF_HA_ACTIVE) {

		/* checkpoint node_details */
		glsv_gld_a2s_ckpt_node_details(gld_cb, node_details->dest_id, GLSV_GLD_EVT_GLND_DOWN);

		/* If this node is non master for any resource, then send node status to the master */
		gld_process_send_non_master_status(gld_cb, node_details, GLND_DOWN_STATE);

		/* Remove the reference to each of the resource referred by this node */
		glnd_rsc = (GLSV_GLD_GLND_RSC_REF *)ncs_patricia_tree_getnext(&node_details->rsc_info_tree, (uint8_t *)0);
		if (glnd_rsc) {
			rsc_id = glnd_rsc->rsc_id;
			while (glnd_rsc) {
				gld_rsc_rmv_node_ref(gld_cb, glnd_rsc->rsc_info, glnd_rsc, node_details,
						     glnd_rsc->rsc_info->can_orphan);
				glnd_rsc =
				    (GLSV_GLD_GLND_RSC_REF *)ncs_patricia_tree_getnext(&node_details->rsc_info_tree,
										       (uint8_t *)&rsc_id);
				if (glnd_rsc)
					rsc_id = glnd_rsc->rsc_id;
			}
		}

		/* Now delete this node details node */
		if (ncs_patricia_tree_del(&gld_cb->glnd_details, (NCS_PATRICIA_NODE *)node_details) != NCSCC_RC_SUCCESS) {
			LOG_ER("Patricia tree del failed: node_id %u",
					   node_details->node_id);
		} else {
			m_MMGR_FREE_GLSV_GLD_GLND_DETAILS(node_details);
			TRACE("Node getting removed on active: node_id %u", node_id);
		}
	} else {
		node_details->status = GLND_DOWN_STATE;
	}
	return NCSCC_RC_SUCCESS;
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:65,代码来源:gld_evt.c

示例10: gld_rsc_close

/****************************************************************************
 * Name          : gld_rsc_close
 *
 * Description   : This is the function is invoked when a rsc_close event is
 *                 is sent from a GLND. This function will remove references to
 *                 to this resource from the mentioned node. If the resource 
 *                 is not referred any longer then the data structures are freed
 *                 up.
 *
 * Arguments     : evt  - Event structure
 *
 * Return Values : NCSCC_RC_SUCCESS/ NCSCC_RC_FAILURE
 *
 * Notes         : None.
 *****************************************************************************/
static uint32_t gld_rsc_close(GLSV_GLD_EVT *evt)
{
	GLSV_GLD_CB *gld_cb = evt->gld_cb;
	GLSV_GLD_GLND_DETAILS *node_details;
	GLSV_GLD_GLND_RSC_REF *glnd_rsc;
	bool orphan_flag;
	uint32_t node_id;
	uint32_t rc = NCSCC_RC_SUCCESS;
	TRACE_ENTER2("component name %s", gld_cb->comp_name.value);

	node_id = m_NCS_NODE_ID_FROM_MDS_DEST(evt->fr_dest_id);

	if ((evt == GLSV_GLD_EVT_NULL) || (gld_cb == NULL)){
		rc = NCSCC_RC_FAILURE;
		goto end;
	}

	orphan_flag = evt->info.rsc_details.orphan;

	/* Find if the node details are available */
	if ((node_details = (GLSV_GLD_GLND_DETAILS *)ncs_patricia_tree_get(&gld_cb->glnd_details,
									   (uint8_t *)&node_id)) == NULL) {
		LOG_ER("Event from unknown glnd: node_id %u ", node_id);
		rc = NCSCC_RC_FAILURE;
		goto end;
	}

	glnd_rsc = (GLSV_GLD_GLND_RSC_REF *)ncs_patricia_tree_get(&node_details->rsc_info_tree,
								  (uint8_t *)&evt->info.rsc_details.rsc_id);
	if ((glnd_rsc == NULL) || (glnd_rsc->rsc_info == NULL)) {
		LOG_ER("Rsc operation for unopened rsc: rsc_id %u node_id %u ",
				   evt->info.rsc_details.rsc_id, node_details->node_id);
		goto end;
	}

	TRACE("EVT Processing rsc close rsc_id %u node_id %u", glnd_rsc->rsc_info->rsc_id,
		      node_details->node_id);

	if (glnd_rsc->rsc_info->saf_rsc_no_of_users > 0)
		glnd_rsc->rsc_info->saf_rsc_no_of_users = glnd_rsc->rsc_info->saf_rsc_no_of_users - 1;

	/*Checkkpoint resource close event */
	glsv_gld_a2s_ckpt_rsc_details(gld_cb, evt->evt_type, evt->info.rsc_details, node_details->dest_id,
				      evt->info.rsc_details.lcl_ref_cnt);

	if (evt->info.rsc_details.lcl_ref_cnt == 0)
		gld_rsc_rmv_node_ref(gld_cb, glnd_rsc->rsc_info, glnd_rsc, node_details, orphan_flag);
 end:	
	TRACE_LEAVE2("Return value %u", rc);
	return rc;
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:66,代码来源:gld_evt.c

示例11: plms_hrb_initialize

/***********************************************************************
* Name          : plms_hrb_initialize
*
* Description   : This function initializes the HRB control block
*                 and creates plms_hrb thread, It registers to MDS  
*		  to receive requests from PLMS
*
* Arguments     : 
*
* Return Values : NCSCC_RC_SUCCESS
*		  NCSCC_RC_FAILURE
***********************************************************************/
SaUint32T plms_hrb_initialize()
{
	PLMS_HRB_CB      *cb =  hrb_cb;
	pthread_t        thread_id;
	pthread_attr_t   attr;
	struct sched_param thread_priority;
	SaUint32T        policy;
	SaUint32T	 rc;

	TRACE_ENTER();

	/* create the mail box and attach it */
	if ((rc = m_NCS_IPC_CREATE(&cb->mbx)) != NCSCC_RC_SUCCESS){
		LOG_ER("error creating mail box err val:%d",rc);
		return NCSCC_RC_FAILURE;
	}

	if ((rc = m_NCS_IPC_ATTACH(&cb->mbx)) != NCSCC_RC_SUCCESS){
		LOG_ER("error attaching mail box err val:%d",rc);
		return NCSCC_RC_FAILURE;
	}

	/* Initialize with the MDS */
	if(hrb_mds_initialize() != NCSCC_RC_SUCCESS){
		LOG_ER("HRB: mds initialization failed");
		return NCSCC_RC_FAILURE;
	}

	/* Initialize thread attribute */
	pthread_attr_init(&attr);
	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);

	pthread_attr_setstacksize(&attr, PLMS_HRB_STACKSIZE);

	/* Create PLMS_HRB thread */
	rc = pthread_create(&thread_id, &attr, plms_hrb, NULL);
	if(rc){
		LOG_ER("pthread_create FAILED ret code:%d error:%s",
				rc,strerror(errno));
		return NCSCC_RC_FAILURE;
	}
	
	/*scheduling parameters of the thread */
        memset(&thread_priority, 0, sizeof(thread_priority));
	thread_priority.sched_priority = PLMS_HRB_TASK_PRIORITY;
	policy = SCHED_OTHER;
	pthread_setschedparam(thread_id, policy, &thread_priority);

	TRACE_LEAVE();
	return NCSCC_RC_SUCCESS;
}
开发者ID:indonexia2004,项目名称:opensaf-indo,代码行数:63,代码来源:plms_hrb.c

示例12: plma_mds_register

/***********************************************************************//**
* @brief	This routine registers the PLMA with MDS.
*
* @return	NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.
***************************************************************************/
uint32_t plma_mds_register()
{
        uint32_t rc = NCSCC_RC_SUCCESS;
        NCSMDS_INFO svc_info;
        MDS_SVC_ID svc_id[1] = { NCSMDS_SVC_ID_PLMS};
	PLMA_CB *plma_cb = plma_ctrlblk;
	TRACE_ENTER();

        /* STEP 1: the MDS handle for PLMA*/
        rc = plma_mds_get_handle();
        if (NCSCC_RC_SUCCESS != rc) {
                LOG_ER("PLMA - mds get handle failed");
                return rc;
        }
        
        /* STEP 2 : Install with MDS with service ID NCSMDS_SVC_ID_PLMA. */
	memset(&svc_info, 0, sizeof(NCSMDS_INFO));

        svc_info.i_mds_hdl = plma_cb->mds_hdl;
        svc_info.i_svc_id = NCSMDS_SVC_ID_PLMA;
        svc_info.i_op = MDS_INSTALL;

        svc_info.info.svc_install.i_yr_svc_hdl = 0; 
        svc_info.info.svc_install.i_install_scope = NCSMDS_SCOPE_NONE;  /*node specific */
        svc_info.info.svc_install.i_svc_cb = plma_mds_callback; /* callback */
        svc_info.info.svc_install.i_mds_q_ownership = false;
	/***************************FIXME : MDS svc private sub part ver no?.**/
        svc_info.info.svc_install.i_mds_svc_pvt_ver = PLMA_MDS_PVT_SUBPART_VERSION;

        if (ncsmds_api(&svc_info) == NCSCC_RC_FAILURE) {
                LOG_ER("PLMA - MDS Install Failed");
                return NCSCC_RC_FAILURE;
        }

	/* STEP 3 : Subscribe to PLMS up/down events */
        memset(&svc_info, 0, sizeof(NCSMDS_INFO));
        svc_info.i_mds_hdl = plma_cb->mds_hdl;
        svc_info.i_svc_id = NCSMDS_SVC_ID_PLMA;
        svc_info.i_op = MDS_SUBSCRIBE;
        svc_info.info.svc_subscribe.i_num_svcs = 1;
        svc_info.info.svc_subscribe.i_scope = NCSMDS_SCOPE_NONE;
        svc_info.info.svc_subscribe.i_svc_ids = svc_id;
        if (ncsmds_api(&svc_info) == NCSCC_RC_FAILURE) {
                LOG_ER("PLMA - MDS Subscribe for PLMS up/down Failed");
                plma_mds_unregister();
                return NCSCC_RC_FAILURE;
        }
	TRACE_LEAVE();
	return rc;

}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:56,代码来源:plma_mds.c

示例13: saSmfDispatch

/*************************************************************************** 
@brief		: saSmfDispatch 
@param[in]	: smfHandle - Handle returned by successful intialize. 
@param[in]	: dispatchFlags - Dispatch flag. 
@return		: SA_AIS_OK if successful otherwise appropiate err code.
*****************************************************************************/
SaAisErrorT saSmfDispatch(
		SaSmfHandleT smfHandle,
		SaDispatchFlagsT dispatchFlags)
{	
	
	SMFA_CB *cb = &_smfa_cb;
	SMFA_CLIENT_INFO *client_info;
	SaAisErrorT rc = SA_AIS_OK;

	TRACE_ENTER2("SMFA: Handle %llu.",smfHandle);
	if (cb->is_finalized){
		LOG_ER("SMFA: Already finalized, Bad handle: %llu.",smfHandle);
		TRACE_LEAVE();
		return SA_AIS_ERR_BAD_HANDLE;
	}
	
	/* To protect the finalize during dispatch.*/
	if (NCSCC_RC_SUCCESS != m_NCS_LOCK(&cb->cb_lock,NCS_LOCK_READ)){
		LOG_ER("SMFA: Cb lock acquire FAILED.");
		TRACE_LEAVE();
		return SA_AIS_ERR_NO_RESOURCES;
	}
	
	/* Get the client info structure for the handle.*/
	client_info = smfa_client_info_get(smfHandle);
	if (NULL == client_info){
		LOG_ER("SMFA: Bad handle.");
		m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_READ);
		TRACE_LEAVE();
		return SA_AIS_ERR_BAD_HANDLE;
	}
	m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_READ);

	/* Validate the flags and invoke corresponding functions.*/
	switch(dispatchFlags){
		case SA_DISPATCH_ONE:
			rc = smfa_dispatch_cbk_one(client_info);
			break;
		case SA_DISPATCH_ALL:
			rc = smfa_dispatch_cbk_all(client_info);
			break;
		case SA_DISPATCH_BLOCKING:
			rc = smfa_dispatch_cbk_block(client_info);
			break;
		default:
			LOG_ER("SMFA: Invalid flag: %d",dispatchFlags);
			rc = SA_AIS_ERR_INVALID_PARAM;
	}
	TRACE_LEAVE();
	return rc;
}
开发者ID:kenzaburo,项目名称:OpenSaf-FrameWork,代码行数:57,代码来源:smfa_api.c

示例14: ntfsv_sanamet_is_valid

/**
 *  @Brief: Check SaNameT is a valid formation
 *
 */
bool ntfsv_sanamet_is_valid(const SaNameT* pName)
{
	if (!osaf_is_extended_name_valid(pName)) {
		LOG_ER("Environment variable SA_ENABLE_EXTENDED_NAMES "
			"is not set, or not using extended name api");
		return false;
	}
	if (osaf_extended_name_length(pName) > kOsafMaxDnLength) {
		LOG_ER("Exceeding maximum of extended name length(%u)"
			,kOsafMaxDnLength);
		return false;
	}
	return true;
}
开发者ID:indonexia2004,项目名称:opensaf-indo,代码行数:18,代码来源:ntfsv_mem.c

示例15: saSmfFinalize

/*************************************************************************** 
@brief		: saSmfFinalize 
@param[in]	: smfHandle - Handle returned by successful intialize. 
@return		: SA_AIS_OK if successful otherwise appropiate err code.
*****************************************************************************/
SaAisErrorT saSmfFinalize(SaSmfHandleT smfHandle)
{
	SMFA_CB *cb = &_smfa_cb;
	SMFA_CLIENT_INFO *client_info;
	
	TRACE_ENTER2("Handle: %llu",smfHandle);
	if (cb->is_finalized){
		LOG_ER("SMFA: Already finalized. Bad handle %llu.",smfHandle);
		TRACE_LEAVE();
		return SA_AIS_ERR_BAD_HANDLE;
	}

	if (NCSCC_RC_SUCCESS != m_NCS_LOCK(&cb->cb_lock,NCS_LOCK_WRITE)){
		LOG_ER("SMFA: Cb lock acquire FAILED.");
		TRACE_LEAVE();
		return SA_AIS_ERR_NO_RESOURCES;
	}
	
	/* Get the client info structure for the handle.*/
	client_info = smfa_client_info_get(smfHandle);
	if (NULL == client_info){
		LOG_ER("SMFA: Could not retrieve client info, Bad handle %llu.",smfHandle);
		m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE);
		TRACE_LEAVE();
		return SA_AIS_ERR_BAD_HANDLE;
	}
	/* Free all the scope info registered for this client.*/
	smfa_client_info_clean(client_info);
	
	/* Release the MBX.*/
	m_NCS_IPC_DETACH(&client_info->cbk_mbx,smfa_client_mbx_clnup,client_info);
	m_NCS_IPC_RELEASE(&client_info->cbk_mbx,NULL);

	/* Clear the list cb->cbk_list for this handle.*/
	smfa_cbk_list_cleanup(smfHandle);

	/* Remove the client from the cb.*/
	smfa_client_info_rmv(client_info->client_hdl);
	
	m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE);
	
	/* If last client, then destroy the agent CB.*/
	if (NCSCC_RC_SUCCESS != smfa_finalize()){
		TRACE_LEAVE();
		return SA_AIS_ERR_LIBRARY;
	}

	TRACE_LEAVE();
	return SA_AIS_OK;
}
开发者ID:kenzaburo,项目名称:OpenSaf-FrameWork,代码行数:55,代码来源:smfa_api.c


注:本文中的LOG_ER函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。