void print_resource_cb_info() {

   GLND_CB       *glnd_cb;
   GLND_RESOURCE_INFO *glnd_rsc;
   uint32_t res = NCSCC_RC_SUCCESS;
   uint8_t *key=NULL;

   printf("print_resource_cb_info  %x\n",glnd_rsc);

   glnd_cb =   (GLND_CB*)ncshm_take_hdl(NCS_SERVICE_ID_GLND, gl_glnd_hdl);
   if ( glnd_cb == NULL) {
      printf(" GLND Startup failed ...\n");
      return;
   } else {
      printf("GLND Startup Success ... %x\n",glnd_cb);
   }

   glnd_rsc=(GLND_RESOURCE_INFO *)ncs_patricia_tree_getnext(&glnd_cb->glnd_res_tree,(uint8_t *)0);
   while(glnd_rsc != NULL) {

      printf("\n********************************************\n");
      printf("GLND RSC INFORMATION %x\n",glnd_rsc);
      printf("GLND RSC ID %x\n",glnd_rsc->resource_id);
      printf("GLND RSC NAME %s\n",glnd_rsc->resource_name.value);
      printf("GLND RSC MASTER NODE_ID %d\n",glnd_rsc->master_mds_dest.node_id);
      printf("Locks on this resource ...\n");
      printf("\n********************************************\n");

      key=(uint8_t *)&glnd_rsc->resource_id;
      glnd_rsc=(GLND_RESOURCE_INFO *)ncs_patricia_tree_getnext(&glnd_cb->glnd_res_tree,key);
   }
}
/**************************************************************************
 Function: dts_stby_global_filtering_policy_change

 Purpose:  Change in the Global Filtering policy will affect the entire system
           This function will set the filtering policies of all the nodes and 
           all the services which are currently present in the node and the 
           service registration table respectively.
           The above changes are for stby DTS only.

 Input:    cb       : DTS_CB pointer
           param_id : Parameter for which change is done.

 Returns:  NCSCC_RC_SUCCESSS/NCSCC_RC_FAILURE

 Notes:  
**************************************************************************/
static uns32 dts_stby_global_filtering_policy_change(DTS_CB *cb)
{
	uns32 status = NCSCC_RC_SUCCESS;
	SVC_KEY nt_key;
	DTS_SVC_REG_TBL *service = NULL;

	/* Search through registration table, Set all the policies,
	 * configure all the DTA's using this policy. */
	service = (DTS_SVC_REG_TBL *)ncs_patricia_tree_getnext(&cb->svc_tbl, NULL);
	while (service != NULL) {
		/* Setup key for new search */
		/*  Network order key added */
		nt_key.node = m_NCS_OS_HTONL(service->my_key.node);
		nt_key.ss_svc_id = m_NCS_OS_HTONL(service->my_key.ss_svc_id);

		/* Set the Node Policy as per the Global Policy */
		if (cb->cli_bit_map == osafDtsvGlobalLoggingState_ID)
			service->svc_policy.enable = cb->g_policy.g_policy.enable;
		if (cb->cli_bit_map == osafDtsvGlobalCategoryBitMap_ID)
			service->svc_policy.category_bit_map = cb->g_policy.g_policy.category_bit_map;
		if (cb->cli_bit_map == osafDtsvGlobalSeverityBitMap_ID)
			service->svc_policy.severity_bit_map = cb->g_policy.g_policy.severity_bit_map;
		if (cb->cli_bit_map == osafDtsvGlobalMessageLogging_ID) {
			service->device.new_file = TRUE;
		}
		service = (DTS_SVC_REG_TBL *)ncs_patricia_tree_getnext(&cb->svc_tbl, (const uns8 *)&nt_key);
	}			/* end of while */
	return status;
}
Exemple #3
0
/****************************************************************************
 * Name          : cpnd_evt_node_getnext
 *
 * Description   : Function to get the all repl evt node from Tree.
 *
 * Arguments     : CPND_CB *cb, - CPND Control Block
 *                 
 * Return Values : CPSV_CPND_ALL_REPL_EVT_NODE** - evt Node at CPND
 *
 * Notes         : None.
 *****************************************************************************/
void cpnd_evt_node_getnext(CPND_CB *cb, SaCkptCheckpointHandleT lcl_ckpt_id, CPSV_CPND_ALL_REPL_EVT_NODE **evt_node)
{
	if (lcl_ckpt_id)
		*evt_node = (CPSV_CPND_ALL_REPL_EVT_NODE *)ncs_patricia_tree_getnext(&cb->writeevt_db, (uint8_t *)&lcl_ckpt_id);
	else
		*evt_node = (CPSV_CPND_ALL_REPL_EVT_NODE *)ncs_patricia_tree_getnext(&cb->writeevt_db, (uint8_t *)NULL);
	return;
}
Exemple #4
0
/****************************************************************************
 * Name          : cpnd_ckpt_node_getnext
 *
 * Description   : Function to get the ckpt node from Tree.
 *
 * Arguments     : CPND_CB *cb, - CPND Control Block
 *                 uint32_t ckpt_hdl - ckpt handle
 *                 
 * Return Values : CPND_CKPT_NODE** ckpt_node - Ckpt Node at CPND
 *
 * Notes         : None.
 *****************************************************************************/
void cpnd_ckpt_node_getnext(CPND_CB *cb, SaCkptCheckpointHandleT ckpt_hdl, CPND_CKPT_NODE **ckpt_node)
{
	if (ckpt_hdl)
		*ckpt_node = (CPND_CKPT_NODE *)ncs_patricia_tree_getnext(&cb->ckpt_info_db, (uint8_t *)&ckpt_hdl);
	else
		*ckpt_node = (CPND_CKPT_NODE *)ncs_patricia_tree_getnext(&cb->ckpt_info_db, (uint8_t *)NULL);
	return;
}
/****************************************************************************\
 PROCEDURE NAME : mqd_timer_expiry_evt_process

 DESCRIPTION    : This routine process the comp specific message.

 ARGUMENTS      : pMqd - MQD Control block pointer
                  nodeid - NODE ID

 RETURNS        : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
\*****************************************************************************/
uns32 mqd_timer_expiry_evt_process(MQD_CB *pMqd, NODE_ID *nodeid)
{
	MQD_ND_DB_NODE *pNdNode = 0;
	MQD_OBJ_NODE *pNode = 0;
	MQD_A2S_MSG msg;
	uns32 rc = NCSCC_RC_SUCCESS;

	m_LOG_MQSV_D(MQD_TMR_EXPIRED, NCSFL_LC_TIMER, NCSFL_SEV_NOTICE, NCS_PTR_TO_UNS32_CAST(nodeid), __FILE__,
		     __LINE__);
	pNdNode = (MQD_ND_DB_NODE *)ncs_patricia_tree_get(&pMqd->node_db, (uns8 *)nodeid);

	/* We need to scan the entire database and remove the track inforamtion
	 * pertaining to the user
	 */

	if (pNdNode == NULL) {
		rc = NCSCC_RC_FAILURE;
		return rc;
	}
	if (pMqd->ha_state == SA_AMF_HA_ACTIVE) {
		if (pNdNode->info.timer.tmr_id != TMR_T_NULL) {
			m_NCS_TMR_DESTROY(pNdNode->info.timer.tmr_id);
			pNdNode->info.timer.tmr_id = TMR_T_NULL;
		}

		pNode = (MQD_OBJ_NODE *)ncs_patricia_tree_getnext(&pMqd->qdb, (uns8 *)0);
		while (pNode) {
			ASAPi_DEREG_INFO dereg;
			SaNameT name;

			memset(&dereg, 0, sizeof(ASAPi_DEREG_INFO));

			name = pNode->oinfo.name;

			if (m_NCS_NODE_ID_FROM_MDS_DEST(pNode->oinfo.info.q.dest) == pNdNode->info.nodeid) {
				dereg.objtype = ASAPi_OBJ_QUEUE;
				dereg.queue = pNode->oinfo.name;
				rc = mqd_asapi_dereg_hdlr(pMqd, &dereg, NULL);
			}

			pNode = (MQD_OBJ_NODE *)ncs_patricia_tree_getnext(&pMqd->qdb, (uns8 *)&name);
		}
		/* Send an async Update to the standby */
		memset(&msg, 0, sizeof(MQD_A2S_MSG));
		msg.type = MQD_A2S_MSG_TYPE_MQND_TIMER_EXPEVT;
		msg.info.nd_tmr_exp_evt.nodeid = pNdNode->info.nodeid;
		/* Send async update to the standby for MQD redundancy */
		mqd_a2s_async_update(pMqd, MQD_A2S_MSG_TYPE_MQND_TIMER_EXPEVT, (void *)(&msg.info.nd_tmr_exp_evt));

		if (pNdNode)
			mqd_red_db_node_del(pMqd, pNdNode);
		TRACE("MQND TMR EXPIRY PROCESSED ON ACTIVE");
	} else if (pMqd->ha_state == SA_AMF_HA_STANDBY) {
		pNdNode->info.timer.is_expired = TRUE;
		TRACE("MQND TMR EXPIRY PROCESSED ON STANDBY");
	}
	return rc;
}	/* End of mqd_timer_expiry_evt_process() */
Exemple #6
0
/****************************************************************************
 * Name          : mqnd_queue_node_getnext
 *
 * Description   : Function to get the queue node from Tree.
 *
 * Arguments     : MQND_CB *cb, - MQND Control Block
 *                 uint32_t qhdl - queue handle
 *
 * Return Values : MQND_QUEUE_NODE** o_qnode - Queu Node at MQND
 *
 * Notes         : None.
 *****************************************************************************/
void mqnd_queue_node_getnext(MQND_CB *cb, SaMsgQueueHandleT qhdl, MQND_QUEUE_NODE **o_qnode)
{
    if (cb->is_qhdl_db_up) {
        if (qhdl)
            *o_qnode = (MQND_QUEUE_NODE *)ncs_patricia_tree_getnext(&cb->qhndl_db, (uint8_t *)&qhdl);
        else
            *o_qnode = (MQND_QUEUE_NODE *)ncs_patricia_tree_getnext(&cb->qhndl_db, (uint8_t *)NULL);
    }
    return;
}
Exemple #7
0
/****************************************************************************
  Description   : This routine finds the checkpoint node.
  Arguments     : ckpt_tree - Ckpt Tree.
                  ckpt_hdl - Checkpoint Handle
  Return Values : ckpt_node - Checkpoint Node
                  NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
  Notes         : The caller takes the cb lock before calling this function
******************************************************************************/
void cpd_ckpt_node_getnext(NCS_PATRICIA_TREE *ckpt_tree,
                           SaCkptCheckpointHandleT *ckpt_hdl, CPD_CKPT_INFO_NODE **ckpt_node)
{
    if (ckpt_hdl) {
        *ckpt_node = (CPD_CKPT_INFO_NODE *)ncs_patricia_tree_getnext(ckpt_tree, (uns8 *)ckpt_hdl);
    } else {
        *ckpt_node = (CPD_CKPT_INFO_NODE *)ncs_patricia_tree_getnext(ckpt_tree, (uns8 *)NULL);
    }
    return;
}
/****************************************************************************
 * Name          : mqnd_qname_node_getnext
 *
 * Description   : Function to get the queue node from Tree.
 *
 * Arguments     : MQND_CB *cb, - MQND Control Block
 *                 SaNameT qname- queue name
 *
 * Return Values : MQND_QNAME_NODE** o_qnode
 *
 * Notes         : None.
 *****************************************************************************/
void mqnd_qname_node_getnext(MQND_CB *cb, SaNameT qname, MQND_QNAME_NODE **o_qnode)
{
    if (cb->is_qname_db_up) {
        if (qname.length) {
            qname.length = m_HTON_SANAMET_LEN(qname.length);
            *o_qnode = (MQND_QNAME_NODE *)ncs_patricia_tree_getnext(&cb->qname_db, (uns8 *)&qname);
        } else
            *o_qnode = (MQND_QNAME_NODE *)ncs_patricia_tree_getnext(&cb->qname_db, (uns8 *)NULL);
    }
    return;
}
Exemple #9
0
/*****************************************************************************
  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;
}
Exemple #10
0
/*****************************************************************************
  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 uns32 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;
    uns32 node_id;

    node_id = m_NCS_NODE_ID_FROM_MDS_DEST(evt->info.tmr.mdest_id);
    m_LOG_GLD_HEADLINE(GLD_ND_RESTART_WAIT_TMR_EXP, NCSFL_SEV_NOTICE, __FILE__, __LINE__, node_id);

    if ((node_details =
                (GLSV_GLD_GLND_DETAILS *)ncs_patricia_tree_get(&gld_cb->glnd_details, (uns8 *)&node_id)) == NULL) {
        m_LOG_GLD_HEADLINE(GLD_UNKNOWN_GLND_EVT, NCSFL_SEV_NOTICE, __FILE__, __LINE__, 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, (uns8 *)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,
                            (uns8 *)&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) {
            m_LOG_GLD_HEADLINE(GLD_PATRICIA_TREE_DEL_FAILED, NCSFL_SEV_ERROR, __FILE__, __LINE__,
                               node_details->node_id);
        } else {
            m_MMGR_FREE_GLSV_GLD_GLND_DETAILS(node_details);
            m_LOG_GLD_HEADLINE(GLD_ACTIVE_RMV_NODE, NCSFL_SEV_NOTICE, __FILE__, __LINE__, node_id);
        }
    } else {
        node_details->status = GLND_DOWN_STATE;
    }
    return NCSCC_RC_SUCCESS;
}
Exemple #11
0
/****************************************************************************
 * Name          : mqnd_qevt_node_getnext
 *
 * Description   : Function to get the queue event node from Tree.
 *
 * Arguments     : MQND_CB *cb, - MQND Control Block
 *                 uint32_t qhdl - queue handle
 *
 * Return Values : MQND_QTRANSFER_EVT_NODE** o_qnode - Queu event Node at MQND
 *
 * Notes         : None.
 *****************************************************************************/
void mqnd_qevt_node_getnext(MQND_CB *cb, SaMsgQueueHandleT qhdl, MQND_QTRANSFER_EVT_NODE **o_qnode)
{
    if (cb->is_qevt_hdl_db_up) {
        if (qhdl)
            *o_qnode = (MQND_QTRANSFER_EVT_NODE *)ncs_patricia_tree_getnext(&cb->q_transfer_evt_db,
                       (uint8_t *)&qhdl);
        else
            *o_qnode = (MQND_QTRANSFER_EVT_NODE *)ncs_patricia_tree_getnext(&cb->q_transfer_evt_db,
                       (uint8_t *)NULL);
    }
    return;
}
Exemple #12
0
/****************************************************************************
  Name          : cpd_ckpt_reploc_getnext
  Description   : This routine finds the checkpoint node.
  Arguments     : ckpt_reploc_tree - Ckpt Tree.
                  ckpt_name - Checkpoint Name
  Return Values : ckpt_reploc_node - Checkpoint Node
                  NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
  Notes         : The caller takes the cb lock before calling this function
******************************************************************************/
void cpd_ckpt_reploc_getnext(NCS_PATRICIA_TREE *ckpt_reploc_tree,
                             CPD_REP_KEY_INFO *key_info, CPD_CKPT_REPLOC_INFO **ckpt_reploc_node)
{
    if (key_info) {
        key_info->ckpt_name.length = m_NCS_OS_HTONS(key_info->ckpt_name.length);
        key_info->node_name.length = m_NCS_OS_HTONS(key_info->node_name.length);
        *ckpt_reploc_node =
            (CPD_CKPT_REPLOC_INFO *)ncs_patricia_tree_getnext(ckpt_reploc_tree, (uns8 *)key_info);
    } else {
        *ckpt_reploc_node = (CPD_CKPT_REPLOC_INFO *)ncs_patricia_tree_getnext(ckpt_reploc_tree, (uns8 *)NULL);
    }
    return;
}
Exemple #13
0
/****************************************************************************\
 PROCEDURE NAME : mqd_user_evt_track_delete

 DESCRIPTION    : This routine updates the database.It deletes the
                  track information of the given destination.

 ARGUMENTS      : pMqd - MQD Control block pointer
                  dest - MDS_DEST pointer                  

 RETURNS        : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
\*****************************************************************************/
uint32_t mqd_user_evt_track_delete(MQD_CB *pMqd, MDS_DEST *dest)
{
	MQD_OBJ_NODE *pNode = 0;
	/* We need to scan the entire database and remove the track inforamtion
	 * pertaining to the user
	 */
	for (pNode = (MQD_OBJ_NODE *)ncs_patricia_tree_getnext(&pMqd->qdb, (uint8_t *)0); pNode;
	     pNode = (MQD_OBJ_NODE *)ncs_patricia_tree_getnext(&pMqd->qdb, pNode->node.key_info)) {

		/* Delete the track information for the user */
		mqd_track_del(&pNode->oinfo.tlist, dest);
	}
	return NCSCC_RC_SUCCESS;
}	/* End of mqd_user_evt_track_delete() */
Exemple #14
0
/****************************************************************************
  Name          : cpd_ckpt_map_node_getnext
  Description   : This routine finds the checkpoint node.
  Arguments     : ckpt_map_tree - Ckpt Tree.
                  ckpt_name - Checkpoint Name
  Return Values : ckpt_map_node - Checkpoint Node
                  NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
  Notes         : The caller takes the cb lock before calling this function
******************************************************************************/
void cpd_ckpt_map_node_getnext(NCS_PATRICIA_TREE *ckpt_map_tree, SaNameT *ckpt_name, CPD_CKPT_MAP_INFO **ckpt_map_node)
{

    if (ckpt_name) {
        ckpt_name->length = m_NCS_OS_HTONS(ckpt_name->length);
        *ckpt_map_node = (CPD_CKPT_MAP_INFO *)ncs_patricia_tree_getnext(ckpt_map_tree, (uns8 *)ckpt_name);
        ckpt_name->length = m_NCS_OS_NTOHS(ckpt_name->length);
    }

    else {
        *ckpt_map_node = (CPD_CKPT_MAP_INFO *)ncs_patricia_tree_getnext(ckpt_map_tree, (uns8 *)NULL);
    }

    return;
}
/****************************************************************************
  Name          : mqa_queue_tree_cleanup
 
  Description   : This routine cleansup the MQA queue tree
 
  Arguments     : destroy_info - ptr to the destroy info
 
  Return Values : None
 
  Notes         : None
******************************************************************************/
static void mqa_queue_tree_cleanup(MQA_CB *mqa_cb)
{
	MQA_QUEUE_INFO *queue_info;
	SaMsgQueueHandleT *temp_ptr = NULL;
	SaMsgQueueHandleT temp_hdl;
	uns32 rc = NCSCC_RC_SUCCESS;

	/* scan the entire handle db & delete each record */
	while ((queue_info = (MQA_QUEUE_INFO *)
		ncs_patricia_tree_getnext(&mqa_cb->mqa_queue_tree, (uns8 *const)temp_ptr))) {
		temp_hdl = queue_info->queueHandle;
		temp_ptr = &temp_hdl;

		/* delete the client info */
		if ((rc = ncs_patricia_tree_del(&mqa_cb->mqa_queue_tree, &queue_info->patnode)) != NCSCC_RC_SUCCESS) {
			m_LOG_MQSV_A(MQA_QUEUE_TREE_DEL_FAILED, NCSFL_LC_MQSV_INIT, NCSFL_SEV_ERROR, rc, __FILE__,
				     __LINE__);
		} else {
			/* free the mem */
			m_MMGR_FREE_MQA_QUEUE_INFO(queue_info);
		}

	}

	return;
}
/****************************************************************************
  Name          : avnd_internode_avail_comp_db_destroy
 
  Description   : This routine destroys the available internode components database.
                  It deletes all the components records from the database.
 
  Arguments     : cb  - ptr to the AvND control block
 
  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
 
  Notes         : None.
******************************************************************************/
uns32 avnd_internode_avail_comp_db_destroy(AVND_CB *cb)
{
	AVND_COMP *comp = 0;
	uns32 rc = NCSCC_RC_SUCCESS;

	/* scan & delete each su */
	while (0 != (comp = (AVND_COMP *)ncs_patricia_tree_getnext(&cb->internode_avail_comp_db, (uns8 *)0))) {
		/* delete the record */
		m_AVND_SEND_CKPT_UPDT_ASYNC_RMV(cb, comp, AVND_CKPT_COMP_CONFIG);
		rc = avnd_internode_comp_del(cb, &cb->internode_avail_comp_db, &comp->name);
		if (NCSCC_RC_SUCCESS != rc)
			goto err;
	}

	/* finally destroy patricia tree */
	rc = ncs_patricia_tree_destroy(&cb->internode_avail_comp_db);
	if (NCSCC_RC_SUCCESS != rc)
		goto err;

	return rc;

 err:

	LOG_ER("internode_avail_comp_db_destroy failed");
	return rc;
}
/****************************************************************************
  Name          : avnd_nodeid_to_mdsdest_map_db_destroy
 
  Description   : This routine destroys the node_id to mds dest mapping database.
                  It deletes all the mapping records from the database.
 
  Arguments     : cb  - ptr to the AvND control block
 
  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
 
  Notes         : None.
******************************************************************************/
uns32 avnd_nodeid_to_mdsdest_map_db_destroy(AVND_CB *cb)
{
	AVND_NODEID_TO_MDSDEST_MAP *mapping = 0;
	uns32 rc = NCSCC_RC_SUCCESS;

	/* scan & delete each su */
	while (0 != (mapping =
		     (AVND_NODEID_TO_MDSDEST_MAP *)ncs_patricia_tree_getnext(&cb->nodeid_mdsdest_db, (uns8 *)0))) {
		/* delete the record */
		rc = avnd_nodeid_mdsdest_rec_del(cb, mapping->mds_dest);
		if (NCSCC_RC_SUCCESS != rc)
			goto err;
	}

	/* finally destroy patricia tree */
	rc = ncs_patricia_tree_destroy(&cb->nodeid_mdsdest_db);
	if (NCSCC_RC_SUCCESS != rc)
		goto err;

	return rc;

 err:

	LOG_ER("nodeid_to_mdsdest_map_db_destroy failed");
	return rc;
}
/***********************************************************************//**
* @brief	This routine is used to destroy the group info tree.
*
* @return	NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.
***************************************************************************/
uns32 plma_group_tree_destroy()
{
	/* cleanup the client tree */
	PLMA_CB *cb = plma_ctrlblk;
	PLMA_ENTITY_GROUP_INFO *grp_info_node;
	SaPlmEntityGroupHandleT *temp_ptr = 0;
	SaPlmEntityGroupHandleT temp_hdl = 0;
	uns32    rc = NCSCC_RC_SUCCESS;

	TRACE_ENTER();	
	/* scan the entire handle db & delete each record */
	while ((grp_info_node = (PLMA_ENTITY_GROUP_INFO *)
		ncs_patricia_tree_getnext(&cb->entity_group_info, (uns8 *)temp_ptr)))
	{		
		/* delete the client info */
		temp_hdl = grp_info_node->entity_group_handle;
		temp_ptr = &temp_hdl;

		 if (grp_info_node != NULL){
			/* Remove the Node from the client tree */
			if (ncs_patricia_tree_del(&cb->entity_group_info, &grp_info_node->pat_node) != NCSCC_RC_SUCCESS){
				LOG_ER("PLMA: GROUP_INFO NODE DELETE FAILED");
		                rc = NCSCC_RC_FAILURE;
	        	}
			clean_group_info_node(grp_info_node);
			free(grp_info_node);
		 }
							
			
	}
	TRACE_LEAVE();
	return rc;
}
/****************************************************************************
  Name          : avnd_pgdb_destroy
 
  Description   : This routine destroys the PG database.
 
  Arguments     : cb  - ptr to the AvND control block
 
  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
 
  Notes         : None.
******************************************************************************/
uns32 avnd_pgdb_destroy(AVND_CB *cb)
{
	AVND_PG *pg = 0;
	uns32 rc = NCSCC_RC_SUCCESS;

	/* scan & delete each pg rec */
	while (0 != (pg = (AVND_PG *)ncs_patricia_tree_getnext(&cb->pgdb, (uns8 *)0))) {
		/* delete the record */
		rc = avnd_pgdb_rec_del(cb, &pg->csi_name);
		if (NCSCC_RC_SUCCESS != rc)
			goto err;
	}

	/* finally destroy patricia tree */
	rc = ncs_patricia_tree_destroy(&cb->pgdb);
	if (NCSCC_RC_SUCCESS != rc)
		goto err;

	TRACE("PG DB destroy success");
	return rc;

 err:
	LOG_CR("PG DB destroy failed");
	return rc;
}
Exemple #20
0
/****************************************************************************
  Name          : mqa_queue_tree_cleanup
 
  Description   : This routine cleansup the MQA queue tree
 
  Arguments     : destroy_info - ptr to the destroy info
 
  Return Values : None
 
  Notes         : None
******************************************************************************/
static void mqa_queue_tree_cleanup(MQA_CB *mqa_cb)
{
	MQA_QUEUE_INFO *queue_info;
	SaMsgQueueHandleT *temp_ptr = NULL;
	SaMsgQueueHandleT temp_hdl;
	uint32_t rc = NCSCC_RC_SUCCESS;
	TRACE_ENTER();

	/* scan the entire handle db & delete each record */
	while ((queue_info = (MQA_QUEUE_INFO *)
		ncs_patricia_tree_getnext(&mqa_cb->mqa_queue_tree, (uint8_t *const)temp_ptr))) {
		temp_hdl = queue_info->queueHandle;
		temp_ptr = &temp_hdl;

		/* delete the client info */
		if ((rc = ncs_patricia_tree_del(&mqa_cb->mqa_queue_tree, &queue_info->patnode)) != NCSCC_RC_SUCCESS) {
			TRACE_2("Queue database Deregistration Failed");
		} else {
			/* free the mem */
			m_MMGR_FREE_MQA_QUEUE_INFO(queue_info);
		}

	}

	TRACE_LEAVE();
	return;
}
Exemple #21
0
/****************************************************************************
  Name          : cpd_ckpt_tree_cleanup
  Description   : This routine Removes & Frees all the internal nodes.
  Arguments     : CPD_CB *cb - CPD Control Block.
  Return Values : None
  Notes         : None
******************************************************************************/
void cpd_ckpt_tree_cleanup(CPD_CB *cb)
{
    CPD_CKPT_INFO_NODE *ckpt_node;
    SaCkptCheckpointHandleT prev_ckpt_id = 0;

    /* Get the First Node */
    ckpt_node = (CPD_CKPT_INFO_NODE *)ncs_patricia_tree_getnext(&cb->ckpt_tree, (uns8 *)&prev_ckpt_id);
    while (ckpt_node) {
        prev_ckpt_id = ckpt_node->ckpt_id;

        cpd_ckpt_node_delete(cb, ckpt_node);

        ckpt_node = (CPD_CKPT_INFO_NODE *)ncs_patricia_tree_getnext(&cb->ckpt_tree, (uns8 *)&prev_ckpt_id);
    }

    return;
}
/*****************************************************************************
  PROCEDURE NAME : glnd_client_node_find_next

  DESCRIPTION    : Finds the Client info node from the tree.

  ARGUMENTS      :glnd_cb      - ptr to the GLND control block
                  handle_id - the handle id of the client.

  RETURNS        :The pointer to the client info node

  NOTES         : None
*****************************************************************************/
GLND_CLIENT_INFO *glnd_client_node_find_next(GLND_CB *glnd_cb, SaLckHandleT handle_id, MDS_DEST agent_mds_dest)
{
	GLND_CLIENT_INFO *client_info;

	/* search for the agent id */
	client_info = (GLND_CLIENT_INFO *)ncs_patricia_tree_getnext(&glnd_cb->glnd_client_tree, (uns8 *)&handle_id);

	while (client_info) {
		if (memcmp(&client_info->agent_mds_dest, &agent_mds_dest, sizeof(MDS_DEST)) == 0)
			return client_info;
		else
			client_info = (GLND_CLIENT_INFO *)ncs_patricia_tree_getnext(&glnd_cb->glnd_client_tree, (uns8 *)
										    &client_info->app_handle_id);
	}
	return NULL;

}
Exemple #23
0
/****************************************************************************
 * Name          : glnd_cb_destroy
 *
 * Description   : Destroy the CB 
 *
 * Arguments     : glnd_cb  - GLND control block pointer.
 *
 * Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.
 *
 * Notes         : None.
 *****************************************************************************/
uns32 glnd_cb_destroy(GLND_CB *glnd_cb)
{

	GLND_AGENT_INFO *agent_info;

	/* destroy the handle */
	if (glnd_cb->cb_hdl_id) {
		m_GLND_GIVEUP_GLND_CB;
		ncshm_destroy_hdl(NCS_SERVICE_ID_GLND, glnd_cb->cb_hdl_id);
	}

	/* detach the mail box */
	if (m_NCS_IPC_DETACH(&glnd_cb->glnd_mbx, glnd_cleanup_mbx, glnd_cb) != NCSCC_RC_SUCCESS)
		return NCSCC_RC_FAILURE;

	/* delete the mailbox */
	if (m_NCS_IPC_RELEASE(&glnd_cb->glnd_mbx, NULL) != NCSCC_RC_SUCCESS)
		return NCSCC_RC_FAILURE;

	/* delete all the internal structures */
	/* delete the trees */
	for (agent_info = (GLND_AGENT_INFO *)ncs_patricia_tree_getnext(&glnd_cb->glnd_agent_tree, (uns8 *)0);
	     agent_info != NULL;
	     agent_info = (GLND_AGENT_INFO *)ncs_patricia_tree_getnext(&glnd_cb->glnd_agent_tree, (uns8 *)0)) {
		glnd_agent_node_del(glnd_cb, agent_info);
	}
	ncs_patricia_tree_destroy(&glnd_cb->glnd_agent_tree);
	ncs_patricia_tree_destroy(&glnd_cb->glnd_client_tree);
	ncs_patricia_tree_destroy(&glnd_cb->glnd_res_tree);

	/* deresigter with the MDS */
	glnd_mds_unregister(glnd_cb);

	/* EDU cleanup */
	m_NCS_EDU_HDL_FLUSH(&glnd_cb->glnd_edu_hdl);

	/* free the control block */
	m_MMGR_FREE_GLND_CB(glnd_cb);

	/* deregister with the log service */
	glnd_flx_log_dereg();
	/* reset the global cb handle */
	gl_glnd_hdl = 0;
	return (NCSCC_RC_SUCCESS);
}
Exemple #24
0
/****************************************************************************
 * Name          : gld_dump_cb
 *
 * Description   : This is the function dumps the contents of the control block.
 *
 * Arguments     : gld_cb  -  Pointer to the control block
 *
 * Return Values : None.
 *
 * Notes         : None.
 *****************************************************************************/
void gld_dump_cb()
{
	GLSV_GLD_CB *gld_cb = NULL;
	GLSV_GLD_GLND_DETAILS *node_details;
	MDS_DEST mds_dest_id;
	GLSV_GLD_RSC_INFO *rsc_info;
	SaLckResourceIdT rsc_id = 0;
	uns32 node_id = 0;

	gld_cb = (NCSCONTEXT)ncshm_take_hdl(NCS_SERVICE_ID_GLD, gl_gld_hdl);
	if (!gld_cb) {
		m_LOG_GLD_HEADLINE(GLD_TAKE_HANDLE_FAILED, NCSFL_SEV_ERROR, __FILE__, __LINE__, 0);
		return;
	}

	memset(&mds_dest_id, 0, sizeof(MDS_DEST));

	TRACE("************ GLD CB info *************** ");
	/* print Amf Info */
	TRACE("AMF HA state : %d ", gld_cb->ha_state);
	/* print the Node details */
	TRACE("GLND info :");
	while ((node_details = (GLSV_GLD_GLND_DETAILS *)ncs_patricia_tree_getnext(&gld_cb->glnd_details,
										  (uns8 *)&node_id))) {
		node_id = node_details->node_id;
		TRACE("Node Id - :%d ", node_details->node_id);
	}

	/* print the Resource details */
	while ((rsc_info = (GLSV_GLD_RSC_INFO *)ncs_patricia_tree_getnext(&gld_cb->rsc_info_id, (uns8 *)&rsc_id))) {
		GLSV_NODE_LIST *list;
		rsc_id = rsc_info->rsc_id;
		TRACE("Resource Id - : %d  Resource Name - %.10s ", (uns32)rsc_info->rsc_id, rsc_info->lck_name.value);
		TRACE("Can Orphan - %d Mode - %d ", rsc_info->can_orphan, (uns32)rsc_info->orphan_lck_mode);
		list = rsc_info->node_list;
		TRACE("List of Nodes :");
		while (list != NULL) {
			TRACE("%d    ", m_NCS_NODE_ID_FROM_MDS_DEST(list->dest_id));
			list = list->next;
		}
	}
	ncshm_give_hdl(gl_gld_hdl);
	TRACE("************************************************** ");

}
Exemple #25
0
/****************************************************************************
  Name          : cpd_cpnd_info_node_getnext
  Description   : This routine finds the CPND Info node.
  Arguments     : cpnd_tree - Ckpt Tree.
                  dest - MDS_DEST
  Return Values : cpnd_info_node - Checkpoint Node
                  NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
  Notes         : The caller takes the cb lock before calling this function
******************************************************************************/
void cpd_cpnd_info_node_getnext(NCS_PATRICIA_TREE *cpnd_tree, MDS_DEST *dest, CPD_CPND_INFO_NODE **cpnd_info_node)
{
    NODE_ID key;
    memset(&key, 0, sizeof(NODE_ID));
    /* Fill the Key */

    if (dest) {
        key = m_NCS_NODE_ID_FROM_MDS_DEST((*dest));

        *cpnd_info_node = (CPD_CPND_INFO_NODE *)
                          ncs_patricia_tree_getnext(cpnd_tree, (uns8 *)&key);
    } else
        *cpnd_info_node = (CPD_CPND_INFO_NODE *)
                          ncs_patricia_tree_getnext(cpnd_tree, (uns8 *)NULL);

    return;

}
Exemple #26
0
/****************************************************************************
  Name          : immd_immnd_info_node_getnext
  Description   : This routine finds the IMMND Info node.
  Arguments     : immnd_tree - IMMND Tree.
                  dest - MDS_DEST
  Return Values : immnd_info_node - IMMND Node
                  NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
  Notes         : The caller takes the cb lock before calling this function
*****************************************************************************/
void immd_immnd_info_node_getnext(NCS_PATRICIA_TREE *immnd_tree, MDS_DEST *dest, IMMD_IMMND_INFO_NODE **immnd_info_node)
{
	NODE_ID key;
	memset(&key, 0, sizeof(NODE_ID));
	/* Fill the Key */

	if (dest) {
		key = m_NCS_NODE_ID_FROM_MDS_DEST((*dest));

		*immnd_info_node = (IMMD_IMMND_INFO_NODE *)
		    ncs_patricia_tree_getnext(immnd_tree, (uns8 *)&key);
	} else
		*immnd_info_node = (IMMD_IMMND_INFO_NODE *)
		    ncs_patricia_tree_getnext(immnd_tree, (uns8 *)NULL);

	return;

}
Exemple #27
0
AVD_APP *avd_app_getnext(const SaNameT *dn)
{
	SaNameT tmp = {0};

	tmp.length = dn->length;
	memcpy(tmp.value, dn->value, tmp.length);

	return (AVD_APP *)ncs_patricia_tree_getnext(&app_db, (uns8 *)&tmp);
}
Exemple #28
0
/****************************************************************************
  Name          : cpd_cpnd_info_tree_cleanup
  Description   : This routine Free all the nodes in cpnd_tree.
  Arguments     : CPD_CB *cb - CPD Control Block.
  Return Values : None
  Notes         : None
******************************************************************************/
void cpd_cpnd_info_tree_cleanup(CPD_CB *cb)
{
    CPD_CPND_INFO_NODE *cpnd_info_node;
    NODE_ID key;

    memset(&key, 0, sizeof(NODE_ID));

    /* Get the First Node */
    cpnd_info_node = (CPD_CPND_INFO_NODE *)ncs_patricia_tree_getnext(&cb->cpnd_tree, (uns8 *)&key);
    while (cpnd_info_node) {
        key = m_NCS_NODE_ID_FROM_MDS_DEST(cpnd_info_node->cpnd_dest);

        cpd_cpnd_info_node_delete(cb, cpnd_info_node);

        cpnd_info_node = (CPD_CPND_INFO_NODE *)ncs_patricia_tree_getnext(&cb->cpnd_tree, (uns8 *)&key);
    }

    return;
}
Exemple #29
0
/****************************************************************************
  Name          : cpd_ckpt_map_tree_cleanup
  Description   : This routine Frees all the nodes in the map_tree.
  Arguments     : CPD_CB *cb - CPD Control Block.
  Return Values : None
  Notes         : None
******************************************************************************/
void cpd_ckpt_map_tree_cleanup(CPD_CB *cb)
{
    CPD_CKPT_MAP_INFO *ckpt_map_node;
    SaNameT name;

    memset(&name, 0, sizeof(SaNameT));

    /* Get the First Node */
    ckpt_map_node = (CPD_CKPT_MAP_INFO *)ncs_patricia_tree_getnext(&cb->ckpt_map_tree, (uns8 *)&name);
    while (ckpt_map_node) {
        name = ckpt_map_node->ckpt_name;

        cpd_ckpt_map_node_delete(cb, ckpt_map_node);

        ckpt_map_node = (CPD_CKPT_MAP_INFO *)ncs_patricia_tree_getnext(&cb->ckpt_map_tree, (uns8 *)&name);
    }

    return;
}
Exemple #30
0
/****************************************************************************
  Name          : cpd_ckpt_reploc_cleanup
  Description   : This routine cleans up the Checkpoint node from tree
  Arguments     : CPD_CB *cb - CPD Control Block.
                : CPD_CKPT_REPLOC_INFO  *ckpt_reploc_node - Local Ckeckpoint Node.
  Return Values : None
  Notes         : None
******************************************************************************/
void cpd_ckpt_reploc_cleanup(CPD_CB *cb)
{
    CPD_CKPT_REPLOC_INFO *ckpt_reploc_node;
    CPD_REP_KEY_INFO key_info;

    memset(&key_info, 0, sizeof(CPD_REP_KEY_INFO));

    /*  Get the 1st Node */
    ckpt_reploc_node = (CPD_CKPT_REPLOC_INFO *)ncs_patricia_tree_getnext(&cb->ckpt_reploc_tree, (uns8 *)&key_info);
    while (ckpt_reploc_node) {
        key_info = ckpt_reploc_node->rep_key;

        cpd_ckpt_reploc_node_delete(cb, ckpt_reploc_node, FALSE);

        ckpt_reploc_node =
            (CPD_CKPT_REPLOC_INFO *)ncs_patricia_tree_getnext(&cb->ckpt_reploc_tree, (uns8 *)&key_info);

    }
    return;
}