I added my comments below. /Thanks HansN
-----Original Message----- From: Gary Lee [mailto:gary....@dektech.com.au] Sent: den 26 augusti 2015 07:41 To: Hans Nordebäck; praveen.malv...@oracle.com; nagendr...@oracle.com Cc: opensaf-devel@lists.sourceforge.net Subject: Re: [PATCH 1 of 1] amfd: Convert AVD_AVND list_of_ncs_su and list_of_ncs_su to std::vector [#1142] ack (not tested) - two minor comments below. On 21/08/15 23:22, Hans Nordeback wrote: > osaf/services/saf/amf/amfd/ckpt_dec.cc | 2 +- > osaf/services/saf/amf/amfd/clm.cc | 12 +- > osaf/services/saf/amf/amfd/include/node.h | 27 +--- > osaf/services/saf/amf/amfd/include/su.h | 1 - > osaf/services/saf/amf/amfd/main.cc | 3 +- > osaf/services/saf/amf/amfd/ndfsm.cc | 15 +- > osaf/services/saf/amf/amfd/ndproc.cc | 7 +- > osaf/services/saf/amf/amfd/node.cc | 161 > +++++++++----------------- > osaf/services/saf/amf/amfd/nodegroup.cc | 31 ++--- > osaf/services/saf/amf/amfd/nodeswbundle.cc | 5 +- > osaf/services/saf/amf/amfd/role.cc | 6 +- > osaf/services/saf/amf/amfd/sg_2n_fsm.cc | 21 +-- > osaf/services/saf/amf/amfd/sg_nored_fsm.cc | 27 +--- > osaf/services/saf/amf/amfd/sg_npm_fsm.cc | 28 +--- > osaf/services/saf/amf/amfd/sg_nway_fsm.cc | 39 ++---- > osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc | 25 +-- > osaf/services/saf/amf/amfd/sgproc.cc | 56 ++------ > osaf/services/saf/amf/amfd/su.cc | 5 +- > osaf/services/saf/amf/amfd/util.cc | 4 +- > 19 files changed, 152 insertions(+), 323 deletions(-) > > > diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc > b/osaf/services/saf/amf/amfd/ckpt_dec.cc > --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc > +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc > @@ -3043,7 +3043,7 @@ static uint32_t dec_ng_admin_state(AVD_C > AVD_AVND *node = avd_node_get(*iter); > AVD_SU *su = NULL; > //If this node has any susi on it. > - for (su = node->list_of_su; su; su = su->avnd_list_su_next) > + for (const auto& su : node->list_of_su) > if (su->list_of_susi != NULL) > break; > if ((ng->saAmfNGAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) && > (su != NULL)) > diff --git a/osaf/services/saf/amf/amfd/clm.cc > b/osaf/services/saf/amf/amfd/clm.cc > --- a/osaf/services/saf/amf/amfd/clm.cc > +++ b/osaf/services/saf/amf/amfd/clm.cc > @@ -26,8 +26,6 @@ static SaVersionT clmVersion = { 'B', 4, > > static void clm_node_join_complete(AVD_AVND *node) > { > - AVD_SU *su; > - > TRACE_ENTER(); > /* For each of the SUs calculate the readiness state. > ** call the SG FSM with the new readiness state. > @@ -39,8 +37,7 @@ static void clm_node_join_complete(AVD_A > } > > avd_node_oper_state_set(node, SA_AMF_OPERATIONAL_ENABLED); > - su = node->list_of_su; > - while (su != NULL) { > + for (const auto& su : node->list_of_su) { > /* For non-preinstantiable SU unlock-inst will not lead to its > inst until unlock. */ > if ( su->saAmfSUPreInstantiable == false ) { > /* Skip the instantiation. */ > @@ -68,8 +65,6 @@ static void clm_node_join_complete(AVD_A > } > } > } > - /* get the next SU on the node */ > - su = su->avnd_list_su_next; > } > > node_reset_su_try_inst_counter(node); > @@ -82,7 +77,6 @@ done: > /* validating this node for a graceful exit */ > static void clm_node_exit_validate(AVD_AVND *node) > { > - AVD_SU *su; > AVD_SU_SI_REL *susi; > bool reject = false; > SaAisErrorT rc = SA_AIS_OK; > @@ -99,8 +93,7 @@ static void clm_node_exit_validate(AVD_A > > /* now go through each SU to determine whether > any SI assigned becomes unassigned due to node exit*/ > - su = node->list_of_su; > - while (su != NULL) { > + for (const auto& su : node->list_of_su) { > susi = su->list_of_susi; > /* now evalutate each SI that is assigned to this SU */ > while (susi != NULL) { > @@ -114,7 +107,6 @@ static void clm_node_exit_validate(AVD_A > } > susi = susi->su_next; > } > - su = su->avnd_list_su_next; > } > > done: > diff --git a/osaf/services/saf/amf/amfd/include/node.h > b/osaf/services/saf/amf/amfd/include/node.h > --- a/osaf/services/saf/amf/amfd/include/node.h > +++ b/osaf/services/saf/amf/amfd/include/node.h > @@ -43,6 +43,7 @@ > #include <timer.h> > #include <db_template.h> > #include <set> > +#include <vector> > > class AVD_SU; > struct avd_cluster_tag; > @@ -76,6 +77,8 @@ class AVD_AVND { > public: > AVD_AVND(); > explicit AVD_AVND(const SaNameT* dn); > + > + bool is_node_lock(); > SaNameT name; /* DN */ > char *node_name; /* RDN value, normally the short host name */ > SaClmClusterNodeT_4 node_info; /* the node information of the node on > @@ -112,10 +115,10 @@ class AVD_AVND { > * Checkpointing - Sent independent update > */ > > - AVD_SU *list_of_ncs_su; /* the list of NCS service units on > + std::vector<AVD_SU*> list_of_ncs_su; /* the list of NCS service > units on > * this node. > */ > - AVD_SU *list_of_su; /* the list of service units on this > + std::vector<AVD_SU*> list_of_su; /* the list of service units on this > * node that are application specific. > */ in some previous patches, I started using std::list. I guess it probably makes more sense to use std::vector as insertions/deletions are rarer than lookups in our use cases, and the number of elements is going to be small. [HansN] the std::vector is I guess preferred and in this case the sorting in SU rank order is done at insertion. A vector is also more cache-friendly. > NCS_DB_LINK_LIST pg_csi_list; /* list of csis for which pg is tracked > @@ -192,26 +195,6 @@ node->rcv_msg_id = rcvid;\ > m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(cb, node, AVSV_CKPT_AVND_RCV_MSG_ID);\ > } > > -#define m_AVD_IS_NODE_LOCK(node,flag)\ > -{\ > - AVD_SU *i_su;\ > - AVD_SU_SI_REL *curr_susi = 0; \ > - flag = true;\ > - i_su = node->list_of_su;\ > - while ((i_su != NULL) && (flag == true))\ > - {\ > - if ((i_su->sg_of_su->sg_fsm_state == AVD_SG_FSM_SU_OPER) ||\ > - (i_su->sg_of_su->sg_fsm_state == AVD_SG_FSM_SG_REALIGN)) { \ > - for (curr_susi = i_su->list_of_susi; \ > - (curr_susi) && ((SA_AMF_HA_QUIESCING != curr_susi->state) ||\ > - ((AVD_SU_SI_STATE_UNASGN == curr_susi->fsm))); \ > - curr_susi = curr_susi->su_next); \ > - if (curr_susi) flag = false; \ > - } \ > - i_su = i_su->avnd_list_su_next;\ > - }\ > -} > - > /* AMF Node */ > extern AVD_AVND *avd_node_new(const SaNameT *dn); > extern void avd_node_delete(AVD_AVND *avnd); > diff --git a/osaf/services/saf/amf/amfd/include/su.h > b/osaf/services/saf/amf/amfd/include/su.h > --- a/osaf/services/saf/amf/amfd/include/su.h > +++ b/osaf/services/saf/amf/amfd/include/su.h > @@ -94,7 +94,6 @@ class AVD_SU { > AVD_COMP *list_of_comp; /* the list of components in this SU */ > > AVD_SU *sg_list_su_next; /* the next SU in the SG */ > - AVD_SU *avnd_list_su_next; /* the next SU in the AvND */ > AVD_SUTYPE *su_type; > AVD_SU *su_list_su_type_next; > > diff --git a/osaf/services/saf/amf/amfd/main.cc > b/osaf/services/saf/amf/amfd/main.cc > --- a/osaf/services/saf/amf/amfd/main.cc > +++ b/osaf/services/saf/amf/amfd/main.cc > @@ -409,8 +409,7 @@ static void handle_event_in_failover_sta > if (AVD_AVND_STATE_ABSENT == node->node_state) { > /* Check whether this node failover has been > performed or not. */ > - for (AVD_SU *i_su = node->list_of_ncs_su; i_su; > - i_su = i_su->avnd_list_su_next) > { > + for (const auto& i_su : node->list_of_ncs_su) { > if > ((i_su->sg_of_su->sg_redundancy_model == SA_AMF_NO_REDUNDANCY_MODEL) && > (i_su->list_of_susi == > NULL)) { > fover_done = true; > diff --git a/osaf/services/saf/amf/amfd/ndfsm.cc > b/osaf/services/saf/amf/amfd/ndfsm.cc > --- a/osaf/services/saf/amf/amfd/ndfsm.cc > +++ b/osaf/services/saf/amf/amfd/ndfsm.cc > @@ -186,21 +186,15 @@ done: > > void avd_nd_ncs_su_assigned(AVD_CL_CB *cb, AVD_AVND *avnd) > { > - AVD_SU *ncs_su, *su; > - > TRACE_ENTER(); > > - ncs_su = avnd->list_of_ncs_su; > - > - while (ncs_su != NULL) { > + for (const auto& ncs_su : avnd->list_of_ncs_su) { > if ((ncs_su->list_of_susi == AVD_SU_SI_REL_NULL) || > (ncs_su->list_of_susi->fsm != AVD_SU_SI_STATE_ASGND)) { > TRACE_LEAVE(); > /* this is an unassigned SU so no need to scan further > return here. */ > return; > } > - > - ncs_su = ncs_su->avnd_list_su_next; > } > > /* All the NCS SUs are assigned now change the state to present */ > @@ -209,7 +203,7 @@ void avd_nd_ncs_su_assigned(AVD_CL_CB *c > avd_node_oper_state_set(avnd, SA_AMF_OPERATIONAL_ENABLED); > > /* Make application SUs operational state ENABLED */ > - for (su = avnd->list_of_su; su != NULL; su = > su->avnd_list_su_next) { > + for (const auto& su : avnd->list_of_su) { > su->set_oper_state(SA_AMF_OPERATIONAL_ENABLED); > AVD_COMP *comp; > for (comp = su->list_of_comp; comp; comp = > comp->su_comp_next) > @@ -468,7 +462,6 @@ void avd_fail_over_event(AVD_CL_CB *cb) > void avd_ack_nack_evh(AVD_CL_CB *cb, AVD_EVT *evt) > { > AVD_AVND *avnd; > - AVD_SU *su_ptr; > AVD_SU_SI_REL *rel_ptr; > AVD_DND_MSG *n2d_msg; > bool node_found = false; > @@ -546,7 +539,7 @@ void avd_ack_nack_evh(AVD_CL_CB *cb, AVD > * Send SU_SI relationship which are in ASSIGN, MODIFY and > * UNASSIGN state.for this node. > */ > - for (su_ptr = avnd->list_of_ncs_su; su_ptr != NULL; su_ptr = > su_ptr->avnd_list_su_next) { > + for (const auto& su_ptr : avnd->list_of_ncs_su) { > for (rel_ptr = su_ptr->list_of_susi; rel_ptr != NULL; > rel_ptr = rel_ptr->su_next) { > if ((AVD_SU_SI_STATE_ASGND == rel_ptr->fsm) || > (AVD_SU_SI_STATE_ABSENT == rel_ptr->fsm)) > continue; > @@ -568,7 +561,7 @@ void avd_ack_nack_evh(AVD_CL_CB *cb, AVD > /* > * We have take care of NCS SU's, now do the same for normal > SU's. > */ > - for (su_ptr = avnd->list_of_su; su_ptr != NULL; su_ptr = > su_ptr->avnd_list_su_next) { > + for (const auto& su_ptr : avnd->list_of_su) { > /* check if susi. If not continue */ > if (!su_ptr->list_of_susi) > continue; > diff --git a/osaf/services/saf/amf/amfd/ndproc.cc > b/osaf/services/saf/amf/amfd/ndproc.cc > --- a/osaf/services/saf/amf/amfd/ndproc.cc > +++ b/osaf/services/saf/amf/amfd/ndproc.cc > @@ -146,13 +146,12 @@ void avd_reg_su_evh(AVD_CL_CB *cb, AVD_E > */ > > if (n2d_msg->msg_info.n2d_reg_su.error == NCSCC_RC_SUCCESS) { > - AVD_SU *su; > > /* the node has been successfully updated with SU information */ > avd_node_state_set(node, AVD_AVND_STATE_NCS_INIT); > > /* Instantiate all OpenSAF SUs on this node */ > - for (su = node->list_of_ncs_su; su != NULL; su = > su->avnd_list_su_next) { > + for (const auto& su : node->list_of_ncs_su) { > if ((su->saAmfSUAdminState == SA_AMF_ADMIN_UNLOCKED) || > (su->saAmfSUAdminState == SA_AMF_ADMIN_LOCKED)) { > avd_snd_presence_msg(cb, su, false); > @@ -520,9 +519,7 @@ node_walk: > TRACE("node name '%s', Oper'%u'", node->name.value, > node->saAmfNodeOperState); > if (node->saAmfNodeOperState == SA_AMF_OPERATIONAL_ENABLED) > { > - AVD_SU *su_ptr; > - su_ptr = node->list_of_su; > - for (su_ptr = node->list_of_su; su_ptr != NULL; su_ptr > = su_ptr->avnd_list_su_next) { > + for (const auto& su_ptr : node->list_of_su) { > if ((su_ptr->saAmfSUAdminState != > SA_AMF_ADMIN_LOCKED_INSTANTIATION) && > > (su_ptr->sg_of_su->saAmfSGAdminState != > > SA_AMF_ADMIN_LOCKED_INSTANTIATION) && > diff --git a/osaf/services/saf/amf/amfd/node.cc > b/osaf/services/saf/amf/amfd/node.cc > --- a/osaf/services/saf/amf/amfd/node.cc > +++ b/osaf/services/saf/amf/amfd/node.cc > @@ -24,6 +24,7 @@ > #include <amfd.h> > #include <cluster.h> > #include <imm.h> > +#include <algorithm> > > AmfDb<std::string, AVD_AVND> *node_name_db = 0; /* SaNameT index */ > AmfDb<uint32_t, AVD_AVND> *node_id_db = 0; /* SaClmNodeIdT index */ > @@ -79,6 +80,23 @@ void avd_node_db_add(AVD_AVND *node) > } > > // > +bool AVD_AVND::is_node_lock() { > + AVD_SU_SI_REL *curr_susi; > + for (const auto& su : list_of_su) { > + if ((su->sg_of_su->sg_fsm_state == AVD_SG_FSM_SU_OPER) || > + (su->sg_of_su->sg_fsm_state == AVD_SG_FSM_SG_REALIGN)) { > + for (curr_susi = su->list_of_susi; > + (curr_susi) && ((SA_AMF_HA_QUIESCING != curr_susi->state) || > + ((AVD_SU_SI_STATE_UNASGN == curr_susi->fsm))); > + curr_susi = curr_susi->su_next); \ > + if (curr_susi) > + return false; > + } > + } > + return true; > +} > + > +// > void AVD_AVND::initialize() { > name = {}; > node_name = {}; > @@ -453,7 +471,6 @@ static SaAisErrorT node_ccb_completed_de > { > SaAisErrorT rc = SA_AIS_OK; > AVD_AVND *node = avd_node_get(&opdata->objectName); > - AVD_SU *su; > bool su_exist = false; > CcbUtilOperationData_t *t_opData; > > @@ -476,18 +493,16 @@ static SaAisErrorT node_ccb_completed_de > } > > /* Check to see that no SUs exists on this node */ > - if (node->list_of_su != NULL) { > + if (node->list_of_su.empty() != true) { > /* check whether there exists a delete operation for > * each of the SU in the node list in the current CCB > */ > - su = node->list_of_su; > - while (su != NULL) { > + for (const auto& su : node->list_of_su) { > t_opData = ccbutil_getCcbOpDataByDN(opdata->ccbId, > &su->name); > if ((t_opData == NULL) || (t_opData->operationType != > CCBUTIL_DELETE)) { > su_exist = true; > break; > } > - su = su->avnd_list_su_next; > } > if (su_exist == true) { > report_ccb_validation_error(opdata, "Node '%s' still > has SUs", opdata->objectName.value); > @@ -778,14 +793,12 @@ void node_admin_state_set(AVD_AVND *node > */ > uint32_t avd_node_admin_lock_instantiation(AVD_AVND *node) > { > - AVD_SU *su; > uint32_t rc = NCSCC_RC_SUCCESS; > > TRACE_ENTER2("%s", node->name.value); > > /* terminate all the SUs on this Node */ > - su = node->list_of_su; > - while (su != NULL) { > + for (const auto& su : node->list_of_su) { > if ((su->saAmfSUPreInstantiable == true) && > (su->saAmfSUPresenceState != > SA_AMF_PRESENCE_UNINSTANTIATED) && > (su->saAmfSUPresenceState != > SA_AMF_PRESENCE_INSTANTIATION_FAILED) && > @@ -798,7 +811,6 @@ uint32_t avd_node_admin_lock_instantiati > LOG_WA("Failed Termination '%s'", > su->name.value); > } > } > - su = su->avnd_list_su_next; > } > > TRACE_LEAVE2("%u, %u", rc, node->su_cnt_admin_oper); > @@ -812,14 +824,12 @@ uint32_t avd_node_admin_lock_instantiati > */ > uint32_t node_admin_unlock_instantiation(AVD_AVND *node) > { > - AVD_SU *su; > uint32_t rc = NCSCC_RC_SUCCESS; > > TRACE_ENTER2("%s", node->name.value); > > /* instantiate the SUs on this Node */ > - su = node->list_of_su; > - while (su != NULL) { > + for (const auto& su : node->list_of_su) { > if ((su->saAmfSUAdminState != > SA_AMF_ADMIN_LOCKED_INSTANTIATION) && > (su->sg_of_su->saAmfSGAdminState != > SA_AMF_ADMIN_LOCKED_INSTANTIATION) && > (su->saAmfSUPresenceState == > SA_AMF_PRESENCE_UNINSTANTIATED) && > @@ -839,7 +849,6 @@ uint32_t node_admin_unlock_instantiation > } > } > } > - su = su->avnd_list_su_next; > } > > node_reset_su_try_inst_counter(node); > @@ -859,7 +868,7 @@ void avd_node_admin_lock_unlock_shutdown > SaInvocationT invocation, > SaAmfAdminOperationIdT operationId) > { > AVD_CL_CB *cb = (AVD_CL_CB *)avd_cb; > - AVD_SU *su, *su_sg; > + AVD_SU *su_sg; > bool su_admin = false; > AVD_SU_SI_REL *curr_susi; > AVD_AVND *su_node_ptr = NULL; > @@ -900,8 +909,8 @@ void avd_node_admin_lock_unlock_shutdown > switch (new_admin_state) { > case SA_AMF_ADMIN_UNLOCKED: > > - su = node->list_of_su; > - while (su != NULL) { > + for (const auto& su : node->list_of_su) { > + > /* if SG to which this SU belongs and has SI > assignments is undergoing > * su semantics return error. > */ > @@ -918,9 +927,6 @@ void avd_node_admin_lock_unlock_shutdown > "invalid sg state %u > for unlock", su->sg_of_su->sg_fsm_state); > goto end; > } > - > - /* get the next SU on the node */ > - su = su->avnd_list_su_next; > } /* while(su != AVD_SU_NULL) */ > > /* For each of the SUs calculate the readiness state. This > routine is called > @@ -935,8 +941,7 @@ void avd_node_admin_lock_unlock_shutdown > node->admin_node_pend_cbk.admin_oper = operationId; > node->su_cnt_admin_oper = 0; > > - su = node->list_of_su; > - while (su != NULL) { > + for (const auto& su : node->list_of_su) { > if (su->is_in_service() == true) { > > su->set_readiness_state(SA_AMF_READINESS_IN_SERVICE); > su->sg_of_su->su_insvc(cb, su); > @@ -946,9 +951,6 @@ void avd_node_admin_lock_unlock_shutdown > */ > } > avd_sg_app_su_inst_func(cb, su->sg_of_su); > - > - /* get the next SU on the node */ > - su = su->avnd_list_su_next; > } > if (node->su_cnt_admin_oper == 0 && invocation != 0) { > avd_saImmOiAdminOperationResult(cb->immOiHandle, > invocation, SA_AIS_OK); > @@ -961,8 +963,7 @@ void avd_node_admin_lock_unlock_shutdown > case SA_AMF_ADMIN_LOCKED: > case SA_AMF_ADMIN_SHUTTING_DOWN: > > - su = node->list_of_su; > - while (su != NULL) { > + for (const auto& su : node->list_of_su) { > if (su->list_of_susi != AVD_SU_SI_REL_NULL) { > is_assignments_done = true; > /* verify that two assigned SUs belonging to > the same SG are not > @@ -1033,11 +1034,7 @@ void avd_node_admin_lock_unlock_shutdown > } > > } > - > - /* if(su->list_of_susi != AVD_SU_SI_REL_NULL) */ > - /* get the next SU on the node */ > - su = su->avnd_list_su_next; > - } /* while(su != AVD_SU_NULL) */ > + } /* for (const auto& su : node->list_of_su) */ > > if(invocation != 0) { > node_admin_state_set(node, new_admin_state); > @@ -1052,8 +1049,7 @@ void avd_node_admin_lock_unlock_shutdown > } > > /* Now call the SG FSM for each of the SUs that have SI > assignment. */ > - su = node->list_of_su; > - while (su != NULL) { > + for (const auto& su : node->list_of_su) { > is_assignments_done = false; > > su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE); > if (su->list_of_susi != AVD_SU_SI_REL_NULL) { > @@ -1069,9 +1065,6 @@ void avd_node_admin_lock_unlock_shutdown > node->su_cnt_admin_oper++; > TRACE("su_cnt_admin_oper:%u", > node->su_cnt_admin_oper); > } > - > - /* get the next SU on the node */ > - su = su->avnd_list_su_next; > } > > if ((node->saAmfNodeAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) > && (su_admin == false)) { > @@ -1101,9 +1094,7 @@ void avd_node_admin_lock_unlock_shutdown > */ > static void node_sus_termstate_set(AVD_AVND *node, bool term_state) > { > - AVD_SU *su; > - > - for (su = node->list_of_su; su; su = su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > if (su->saAmfSUPreInstantiable == true) > su->set_term_state(term_state); > } > @@ -1123,7 +1114,6 @@ static void node_admin_op_cb(SaImmOiHand > const SaImmAdminOperationParamsT_2 **params) > { > AVD_AVND *node; > - AVD_SU *su = NULL; > SaAisErrorT rc = SA_AIS_OK; > > TRACE_ENTER2("%llu, '%s', %llu", invocation, objectName->value, > operationId); > @@ -1141,8 +1131,7 @@ static void node_admin_op_cb(SaImmOiHand > > /* Check for any conflicting admin operations */ > > - su = node->list_of_su; > - while (su != NULL) { > + for (const auto& su : node->list_of_su) { > if (su->pend_cbk.admin_oper != 0) { > report_admin_op_error(immOiHandle, invocation, > SA_AIS_ERR_TRY_AGAIN, NULL, > "SU on this node is undergoing admin op > (%s)", su->name.value); > @@ -1163,7 +1152,6 @@ static void node_admin_op_cb(SaImmOiHand > su->sg_of_su->name.value, > su->name.value); > goto done; > } > - su = su->avnd_list_su_next; > } > > if (node->clm_pend_inv != 0) { > @@ -1220,7 +1208,7 @@ static void node_admin_op_cb(SaImmOiHand > > if (avd_cb->init_state == AVD_INIT_DONE) { > node_admin_state_set(node, SA_AMF_ADMIN_UNLOCKED); > - for(su = node->list_of_su; su != NULL; su = > su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > if (su->is_in_service() == true) { > > su->set_readiness_state(SA_AMF_READINESS_IN_SERVICE); > } > @@ -1255,7 +1243,7 @@ static void node_admin_op_cb(SaImmOiHand > > if (avd_cb->init_state == AVD_INIT_DONE) { > node_admin_state_set(node, SA_AMF_ADMIN_LOCKED); > - for(su = node->list_of_su; su != NULL; su = > su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > > su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE); > } > avd_saImmOiAdminOperationResult(immOiHandle, > invocation, SA_AIS_OK); > @@ -1381,69 +1369,34 @@ static void node_admin_op_cb(SaImmOiHand > > void avd_node_add_su(AVD_SU *su) > { > - AVD_SU *i_su; > - AVD_SU *prev_su = NULL; > - > if (strstr((char *)su->name.value, "safApp=OpenSAF") != NULL) { > - i_su = su->su_on_node->list_of_ncs_su; > + su->su_on_node->list_of_ncs_su.push_back(su); > + std::sort(su->su_on_node->list_of_ncs_su.begin(), > su->su_on_node->list_of_ncs_su.end(), > + [](const AVD_SU *a, const AVD_SU *b) -> bool {return > a->saAmfSURank < b->saAmfSURank;}); > } else { > - i_su = su->su_on_node->list_of_su; > - } > - > - for(;(i_su != NULL && i_su->saAmfSURank < su->saAmfSURank);i_su = > i_su->avnd_list_su_next) > - prev_su = i_su; > - > - if (prev_su == NULL) { > - if (strstr((char *)su->name.value, "safApp=OpenSAF") != NULL) { > - su->avnd_list_su_next = su->su_on_node->list_of_ncs_su; > - su->su_on_node->list_of_ncs_su = su; > - } else { > - su->avnd_list_su_next = su->su_on_node->list_of_su; > - su->su_on_node->list_of_su = su; > - } > - } else { > - prev_su->avnd_list_su_next = su; > - su->avnd_list_su_next = i_su; > + su->su_on_node->list_of_su.push_back(su); > + std::sort(su->su_on_node->list_of_su.begin(), > su->su_on_node->list_of_su.end(), > + [](const AVD_SU *a, const AVD_SU *b) -> bool {return > a->saAmfSURank < b->saAmfSURank;}); > } > } > > -void avd_node_remove_su(AVD_SU *su) > -{ > - AVD_SU *i_su = NULL; > - AVD_SU *prev_su = NULL; > - bool isNcs; > +void avd_node_remove_su(AVD_SU *su) { > + std::vector<AVD_SU*> *su_list; > > - if ((su->sg_of_su) && (su->sg_of_su->sg_ncs_spec == true)) > - isNcs = true; > - else > - isNcs = false; > + if ((su->sg_of_su) && (su->sg_of_su->sg_ncs_spec == true)) { > + su_list = &su->su_on_node->list_of_ncs_su; > + } > + else { > + su_list = &su->su_on_node->list_of_su; > + } > > - /* For external component, there is no AvND attached, so let it return. > */ > - if (su->su_on_node != NULL) { > - /* remove SU from node */ > - i_su = (isNcs) ? su->su_on_node->list_of_ncs_su : > su->su_on_node->list_of_su; > - > - while ((i_su != NULL) && (i_su != su)) { > - prev_su = i_su; > - i_su = i_su->avnd_list_su_next; > - } > - > - if (i_su != su) { > - osafassert(0); > - } else { > - if (prev_su == NULL) { > - if (isNcs) > - su->su_on_node->list_of_ncs_su = > su->avnd_list_su_next; > - else > - su->su_on_node->list_of_su = > su->avnd_list_su_next; > - } else { > - prev_su->avnd_list_su_next = > su->avnd_list_su_next; > - } > - } > - > - su->avnd_list_su_next = NULL; > - su->su_on_node = NULL; > - } > + auto pos = std::find(su_list->begin(), su_list->end(), su); > + if(pos != su_list->end()) { > + su_list->erase(pos); > + } else { > + /* Log a fatal error */ > + osafassert(0); > + } > } > > /** > @@ -1454,13 +1407,9 @@ void avd_node_remove_su(AVD_SU *su) > */ > void node_reset_su_try_inst_counter(const AVD_AVND *node) > { > - AVD_SU *su; > - > /* Reset the counters.*/ > - su = node->list_of_su; > - while (su != NULL) { > + for (const auto& su : node->list_of_su) { > su->sg_of_su->try_inst_counter = 0; > - su = su->avnd_list_su_next; > } > } > /** > diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc > b/osaf/services/saf/amf/amfd/nodegroup.cc > --- a/osaf/services/saf/amf/amfd/nodegroup.cc > +++ b/osaf/services/saf/amf/amfd/nodegroup.cc > @@ -292,7 +292,6 @@ static SaAisErrorT ng_ccb_completed_modi > unsigned j = 0; > const SaImmAttrModificationT_2 *mod; > AVD_AVND *node; > - AVD_SU *su; > int delete_found = 0; > int add_found = 0; > int nodes_deleted = 0; > @@ -336,7 +335,7 @@ static SaAisErrorT ng_ccb_completed_modi > /* Ensure no SU is mapped to this node via the > node group */ > > /* for all OpenSAF SUs hosted by this node */ > - for (su = node->list_of_ncs_su; su; su = > su->avnd_list_su_next) { > + for (const auto& su : node->list_of_ncs_su) { > if > (su_is_mapped_to_node_via_nodegroup(su, ng)) { > > report_ccb_validation_error(opdata, "Cannot delete '%s' from '%s'." > " An SU is > mapped using node group", > @@ -347,7 +346,7 @@ static SaAisErrorT ng_ccb_completed_modi > } > > /* for all application SUs hosted by this node > */ > - for (su = node->list_of_su; su; su = > su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > if > (su_is_mapped_to_node_via_nodegroup(su, ng)) { > > report_ccb_validation_error(opdata, "Cannot delete '%s' from '%s'." > " An SU is > mapped using node group", > @@ -432,7 +431,6 @@ static bool is_deleted_in_ccb(SaImmOiCcb > static SaAisErrorT ng_ccb_completed_delete_hdlr(CcbUtilOperationData_t > *opdata) > { > SaAisErrorT rc = SA_AIS_ERR_BAD_OPERATION; > - AVD_SU *su; > AVD_AVND *node; > AVD_AMF_NG *ng = avd_ng_get(&opdata->objectName); > > @@ -459,8 +457,7 @@ static SaAisErrorT ng_ccb_completed_dele > ** application removal), reject the deletion. > ** If no SU is mapped, deletion is OK. > */ > - > - for (su = node->list_of_ncs_su; su; su = su->avnd_list_su_next) > { > + for (const auto& su : node->list_of_ncs_su) { > if (su_is_mapped_to_node_via_nodegroup(su, ng) && > is_deleted_in_ccb(opdata->ccbId, &su->name) == > false) { > report_ccb_validation_error(opdata, "Cannot > delete '%s' because '%s' is mapped using it", > @@ -469,7 +466,7 @@ static SaAisErrorT ng_ccb_completed_dele > } > } > > - for (su = node->list_of_su; su; su = su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > if (su_is_mapped_to_node_via_nodegroup(su, ng) && > is_deleted_in_ccb(opdata->ccbId, &su->name) == > false) { > report_ccb_validation_error(opdata, "Cannot > delete '%s' because '%s' is mapped using it", > @@ -632,8 +629,7 @@ static SaAisErrorT check_node_stability( > rc = SA_AIS_ERR_TRY_AGAIN; > goto done; > } > - for (AVD_SU *su = node->list_of_su; su != NULL; > - su = su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > rc = su->sg_of_su->check_sg_stability(); > if (rc != SA_AIS_OK) > goto done; > @@ -657,8 +653,7 @@ static SaAisErrorT check_red_model_servi > for (std::set<std::string>::const_iterator iter = > ng->saAmfNGNodeList.begin(); > iter != ng->saAmfNGNodeList.end(); ++iter) { > AVD_AVND *node = avd_node_get(*iter); > - for (AVD_SU *su = node->list_of_su; su != NULL; > - su = su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > //Make a temorary list_of_SG for later verification of > service outage. > tmp_sg_list.insert(Amf::to_string(&su->sg_of_su->name)); > } > @@ -756,14 +751,14 @@ void ng_node_lock_and_shutdown(AVD_AVND > } > if (avd_cb->init_state == AVD_INIT_DONE) { > node_admin_state_set(node, SA_AMF_ADMIN_LOCKED); > - for(AVD_SU *su = node->list_of_su; su != NULL; su = > su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > > su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE); > } > return; > } > if (node->saAmfNodeOperState == SA_AMF_OPERATIONAL_DISABLED) > return; > - for (AVD_SU *su = node->list_of_su; su != NULL; su = > su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE); > su->sg_of_su->ng_admin(su, node->admin_ng); > } > @@ -803,7 +798,7 @@ void ng_unlock(AVD_AMF_NG *ng) > (node->saAmfNodeAdminState == > SA_AMF_ADMIN_LOCKED_INSTANTIATION) || > (node->node_info.member == false)) > continue; > - for (AVD_SU *su = node->list_of_su; su != NULL; su = > su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > if (su->is_in_service() == true) { > > su->set_readiness_state(SA_AMF_READINESS_IN_SERVICE); > } > @@ -821,7 +816,7 @@ void ng_unlock(AVD_AMF_NG *ng) > By this time Nodes of node group are in unlocked state.Let > the > SG semantics decide which su to chose for assignment and > instantiation. > */ > - for (AVD_SU *su = node->list_of_su; su != NULL; su = > su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > su->sg_of_su->su_insvc(avd_cb, su); > avd_sg_app_su_inst_func(avd_cb, su->sg_of_su); > } > @@ -838,9 +833,7 @@ void ng_unlock(AVD_AMF_NG *ng) > */ > static void node_sus_termstate_set(AVD_AVND *node, bool term_state) > { > - AVD_SU *su; > - > - for (su = node->list_of_su; su; su = su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > if (su->saAmfSUPreInstantiable == true) > su->set_term_state(term_state); > } > @@ -870,7 +863,7 @@ static void ng_admin_unlock_inst(AVD_AMF > LOG_NO("'%s' UNLOCK_INSTANTIATION: AMF node oper state > disabled", node->name.value); > continue; > } > - for (AVD_SU *node_su = node->list_of_su; node_su != NULL; > node_su = node_su->avnd_list_su_next) { > + for (const auto& node_su : node->list_of_su) { > /*Instantiate only those SUs in this SG which are > hosted on the Nodes of NG. > Also honor saAmfSURank while instantating. > */ > diff --git a/osaf/services/saf/amf/amfd/nodeswbundle.cc > b/osaf/services/saf/amf/amfd/nodeswbundle.cc > --- a/osaf/services/saf/amf/amfd/nodeswbundle.cc > +++ b/osaf/services/saf/amf/amfd/nodeswbundle.cc > @@ -69,13 +69,12 @@ static int is_config_valid(const SaNameT > * @return int > */ > static int is_swbdl_delete_ok_for_node(const SaNameT *bundle_dn_to_delete, > - const SaNameT *node_dn, const AVD_SU *su_list, CcbUtilOperationData_t > *opdata) > + const SaNameT *node_dn, const std::vector<AVD_SU*> &su_list, > CcbUtilOperationData_t *opdata) > { > - const AVD_SU *su; > const AVD_COMP *comp; > SaNameT bundle_dn; > > - for (su = su_list; su != NULL; su = su->avnd_list_su_next) { > + for (const auto& su : su_list) { > for (comp = su->list_of_comp; comp != NULL; comp = > comp->su_comp_next) { > > avsv_create_association_class_dn(&comp->comp_type->saAmfCtSwBundle, > node_dn, "safInstalledSwBundle", &bundle_dn); > diff --git a/osaf/services/saf/amf/amfd/role.cc > b/osaf/services/saf/amf/amfd/role.cc > --- a/osaf/services/saf/amf/amfd/role.cc > +++ b/osaf/services/saf/amf/amfd/role.cc > @@ -550,7 +550,6 @@ static uint32_t avd_role_failover_qsd_ac > void avd_role_switch_ncs_su_evh(AVD_CL_CB *cb, AVD_EVT *evt) > { > AVD_AVND *avnd = NULL, *other_avnd = NULL; > - AVD_SU *i_su = NULL; > > TRACE_ENTER(); > > @@ -561,7 +560,7 @@ void avd_role_switch_ncs_su_evh(AVD_CL_C > } > other_avnd = avd_node_find_nodeid(cb->node_id_avd_other); > > - for (i_su = avnd->list_of_ncs_su; i_su != NULL; i_su = > i_su->avnd_list_su_next) { > + for (const auto& i_su : avnd->list_of_ncs_su) { > if ((i_su->list_of_susi != 0) && > (i_su->sg_of_su->sg_redundancy_model == > SA_AMF_2N_REDUNDANCY_MODEL) && > (i_su->list_of_susi->state != SA_AMF_HA_ACTIVE)) { > @@ -742,7 +741,6 @@ try_again: > void amfd_switch(AVD_CL_CB *cb) > { > AVD_AVND *avnd = NULL; > - AVD_SU *i_su = NULL; > > TRACE_ENTER(); > > @@ -753,7 +751,7 @@ void amfd_switch(AVD_CL_CB *cb) > /* get the avnd from node_id */ > avnd = avd_node_find_nodeid(cb->node_id_avd); > > - for (i_su = avnd->list_of_ncs_su; i_su != NULL; i_su = > i_su->avnd_list_su_next) { > + for (const auto& i_su : avnd->list_of_ncs_su) { > if ((i_su->list_of_susi != 0) && > (i_su->sg_of_su->sg_redundancy_model == > SA_AMF_2N_REDUNDANCY_MODEL) && > (i_su->list_of_susi->state == SA_AMF_HA_ACTIVE)) { > diff --git a/osaf/services/saf/amf/amfd/sg_2n_fsm.cc > b/osaf/services/saf/amf/amfd/sg_2n_fsm.cc > --- a/osaf/services/saf/amf/amfd/sg_2n_fsm.cc > +++ b/osaf/services/saf/amf/amfd/sg_2n_fsm.cc > @@ -869,7 +869,6 @@ done: > > uint32_t SG_2N::su_fault_su_oper(AVD_SU *su) { > AVD_SU *a_su; > - bool flag; > AVD_AVND *su_node_ptr = NULL; > uint32_t rc = NCSCC_RC_FAILURE; > SaAmfHAStateT su_ha_state, a_su_ha_state; > @@ -905,8 +904,7 @@ uint32_t SG_2N::su_fault_su_oper(AVD_SU > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -2008,8 +2006,7 @@ uint32_t SG_2N::susi_success_su_oper(AVD > if ((su->saAmfSUAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) && > ((all_quiesced(su) || all_unassigned(su)))) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -2191,8 +2188,7 @@ uint32_t SG_2N::susi_success_su_oper(AVD > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } else if (su->su_switch == AVSV_SI_TOGGLE_SWITCH) { > @@ -2576,7 +2572,6 @@ uint32_t SG_2N::susi_failed(AVD_CL_CB *c > AVSV_SUSI_ACT act, SaAmfHAStateT state) { > AVD_SU_SI_REL *s_susi, *o_susi, *l_susi; > AVD_SU *a_su; > - bool flag; > AVD_AVND *su_node_ptr = NULL; > uint32_t rc = NCSCC_RC_FAILURE; > > @@ -2655,8 +2650,7 @@ uint32_t SG_2N::susi_failed(AVD_CL_CB *c > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -2867,7 +2861,6 @@ uint32_t SG_2N::realign(AVD_CL_CB *cb, A > void SG_2N::node_fail_su_oper(AVD_SU *su) { > AVD_SU_SI_REL *a_susi, *s_susi, *s_susi_temp; > AVD_SU *o_su; > - bool flag; > AVD_AVND *su_node_ptr = NULL; > AVD_CL_CB *cb = avd_cb; > > @@ -2928,8 +2921,7 @@ void SG_2N::node_fail_su_oper(AVD_SU *su > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } else { > @@ -2976,8 +2968,7 @@ void SG_2N::node_fail_su_oper(AVD_SU *su > avd_sg_su_oper_list_add(cb, a_susi->su, > false); > m_AVD_SET_SG_FSM(cb, (su->sg_of_su), > AVD_SG_FSM_SG_REALIGN); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == > true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > avd_sg_su_oper_list_add(cb, a_susi->su, > false); > diff --git a/osaf/services/saf/amf/amfd/sg_nored_fsm.cc > b/osaf/services/saf/amf/amfd/sg_nored_fsm.cc > --- a/osaf/services/saf/amf/amfd/sg_nored_fsm.cc > +++ b/osaf/services/saf/amf/amfd/sg_nored_fsm.cc > @@ -178,8 +178,7 @@ uint32_t SG_NORED::su_fault(AVD_CL_CB *c > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if > (su_node_ptr->saAmfNodeAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) { > - > m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() > == true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -217,8 +216,7 @@ uint32_t SG_NORED::su_fault(AVD_CL_CB *c > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == > true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -336,7 +334,6 @@ uint32_t SG_NORED::su_insvc(AVD_CL_CB *c > uint32_t SG_NORED::susi_success(AVD_CL_CB *cb, AVD_SU *su, AVD_SU_SI_REL > *susi, > AVSV_SUSI_ACT act, SaAmfHAStateT state) { > AVD_SI *l_si; > - bool flag; > AVD_AVND *su_node_ptr = NULL; > > TRACE_ENTER2("%u", su->sg_of_su->sg_fsm_state); > @@ -408,8 +405,7 @@ uint32_t SG_NORED::susi_success(AVD_CL_C > } else if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -492,8 +488,7 @@ uint32_t SG_NORED::susi_success(AVD_CL_C > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -616,7 +611,6 @@ uint32_t SG_NORED::susi_success(AVD_CL_C > > uint32_t SG_NORED::susi_failed(AVD_CL_CB *cb, AVD_SU *su, AVD_SU_SI_REL > *susi, > AVSV_SUSI_ACT act, SaAmfHAStateT state) { > - bool flag; > AVD_AVND *su_node_ptr = NULL; > > TRACE_ENTER2("%u", su->sg_of_su->sg_fsm_state); > @@ -652,8 +646,7 @@ uint32_t SG_NORED::susi_failed(AVD_CL_CB > su->list_of_susi->state = SA_AMF_HA_QUIESCED; > m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(cb, > (su->list_of_susi), AVSV_CKPT_AVD_SI_ASS); > avd_gen_su_ha_state_changed_ntf(cb, > su->list_of_susi); > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -685,8 +678,7 @@ uint32_t SG_NORED::susi_failed(AVD_CL_CB > su->list_of_susi->state = SA_AMF_HA_QUIESCED; > m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(cb, > (su->list_of_susi), AVSV_CKPT_AVD_SI_ASS); > avd_gen_su_ha_state_changed_ntf(cb, > su->list_of_susi); > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -785,7 +777,6 @@ uint32_t SG_NORED::realign(AVD_CL_CB *cb > > void SG_NORED::node_fail(AVD_CL_CB *cb, AVD_SU *su) { > > - bool flag; > AVD_SI *l_si; > SaAmfHAStateT old_state; > AVD_AVND *su_node_ptr = NULL; > @@ -844,8 +835,7 @@ void SG_NORED::node_fail(AVD_CL_CB *cb, > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if ((su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) && > (old_state == SA_AMF_HA_QUIESCING)) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -886,8 +876,7 @@ void SG_NORED::node_fail(AVD_CL_CB *cb, > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if ((su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) && > (old_state == SA_AMF_HA_QUIESCING)) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > diff --git a/osaf/services/saf/amf/amfd/sg_npm_fsm.cc > b/osaf/services/saf/amf/amfd/sg_npm_fsm.cc > --- a/osaf/services/saf/amf/amfd/sg_npm_fsm.cc > +++ b/osaf/services/saf/amf/amfd/sg_npm_fsm.cc > @@ -953,7 +953,6 @@ uint32_t avd_sg_npm_siswitch_func(AVD_CL > > static uint32_t avd_sg_npm_su_fault_su_oper(AVD_CL_CB *cb, AVD_SU *su) > { > - bool flag; > AVD_AVND *su_node_ptr = NULL; > > if (su->sg_of_su->su_oper_list.su == su) { > @@ -972,8 +971,7 @@ static uint32_t avd_sg_npm_su_fault_su_o > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -1228,7 +1226,7 @@ static uint32_t avd_sg_npm_su_fault_si_o > > static uint32_t avd_sg_npm_su_fault_sg_relgn(AVD_CL_CB *cb, AVD_SU *su) > { > - bool l_flag = false, flag = false; > + bool l_flag = false; > AVD_AVND *su_node_ptr = NULL; > > if (su->sg_of_su->admin_si != AVD_SI_NULL) { > @@ -1292,8 +1290,7 @@ static uint32_t avd_sg_npm_su_fault_sg_r > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == > true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -1661,8 +1658,7 @@ static uint32_t avd_sg_npm_susi_sucss_sg > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == > true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -2439,7 +2435,6 @@ static uint32_t avd_sg_npm_susi_sucss_su > AVD_SU_SI_REL *tmp_susi; > bool susi_assgn_failed = false; > > - bool flag; > AVD_AVND *su_node_ptr = NULL; > > TRACE_ENTER(); > @@ -2521,8 +2516,7 @@ static uint32_t avd_sg_npm_susi_sucss_su > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == > true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -2910,7 +2904,6 @@ uint32_t SG_NPM::susi_success(AVD_CL_CB > uint32_t SG_NPM::susi_failed(AVD_CL_CB *cb, AVD_SU *su, AVD_SU_SI_REL *susi, > AVSV_SUSI_ACT act, SaAmfHAStateT state) { > AVD_SU_SI_REL *o_susi; > - bool flag; > AVD_AVND *su_node_ptr = NULL; > > TRACE_ENTER2("%u", su->sg_of_su->sg_fsm_state); > @@ -2951,8 +2944,7 @@ uint32_t SG_NPM::susi_failed(AVD_CL_CB * > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -3181,7 +3173,6 @@ static void avd_sg_npm_node_fail_sg_relg > { > AVD_SU_SI_REL *l_susi, *o_susi, *ot_susi; > bool l_flag = false; > - bool flag; > AVD_AVND *su_node_ptr = NULL; > > if (su->sg_of_su->admin_si != AVD_SI_NULL) { > @@ -3543,8 +3534,7 @@ static void avd_sg_npm_node_fail_sg_relg > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == > true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -3634,7 +3624,6 @@ static void avd_sg_npm_node_fail_sg_relg > static void avd_sg_npm_node_fail_su_oper(AVD_CL_CB *cb, AVD_SU *su) > { > AVD_SU_SI_REL *o_susi; > - bool flag; > AVD_AVND *su_node_ptr = NULL; > > TRACE_ENTER2("'%s' ", su->name.value); > @@ -3684,8 +3673,7 @@ static void avd_sg_npm_node_fail_su_oper > if (su->saAmfSUAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > diff --git a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc > b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc > --- a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc > +++ b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc > @@ -1613,7 +1613,7 @@ uint32_t avd_sg_nway_su_fault_sg_realign > AVD_SU_SI_REL *curr_susi = 0; > AVD_SG *sg = su->sg_of_su; > AVD_SI *si = sg->admin_si; > - bool is_su_present, flag; > + bool is_su_present; > uint32_t rc = NCSCC_RC_SUCCESS; > AVD_AVND *su_node_ptr = NULL; > > @@ -1646,8 +1646,7 @@ uint32_t avd_sg_nway_su_fault_sg_realign > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > > su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == > true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -1784,7 +1783,7 @@ done: > uint32_t avd_sg_nway_su_fault_su_oper(AVD_CL_CB *cb, AVD_SU *su) > { > AVD_SU_SI_REL *curr_susi = 0; > - bool is_all_stdby = true, flag; > + bool is_all_stdby = true; > uint32_t rc = NCSCC_RC_SUCCESS; > AVD_AVND *su_node_ptr = NULL; > > @@ -1799,8 +1798,7 @@ uint32_t avd_sg_nway_su_fault_su_oper(AV > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -2190,7 +2188,7 @@ uint32_t avd_sg_nway_susi_succ_sg_realig > { > AVD_SU_SI_REL *curr_susi = 0, *curr_sisu = 0, tmp_susi; > AVD_SG *sg = su->sg_of_su; > - bool is_su_present, is_eng, flag; > + bool is_su_present, is_eng; > uint32_t rc = NCSCC_RC_SUCCESS; > AVD_AVND *su_node_ptr = NULL; > > @@ -2266,8 +2264,7 @@ uint32_t avd_sg_nway_susi_succ_sg_realig > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if > (su_node_ptr->saAmfNodeAdminState == > > SA_AMF_ADMIN_SHUTTING_DOWN) { > - > m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == > true) { > + if > (su_node_ptr->is_node_lock() == true) { > > node_admin_state_set(su_node_ptr, > > SA_AMF_ADMIN_LOCKED); > } > @@ -2357,8 +2354,7 @@ uint32_t avd_sg_nway_susi_succ_sg_realig > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if > (su_node_ptr->saAmfNodeAdminState == > > SA_AMF_ADMIN_SHUTTING_DOWN) { > - > m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if > (su_node_ptr->is_node_lock() == true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -2459,8 +2455,7 @@ uint32_t avd_sg_nway_susi_succ_sg_realig > if (su->saAmfSUAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -2547,7 +2542,7 @@ uint32_t avd_sg_nway_susi_succ_su_oper(A > { > AVD_SU_SI_REL *curr_susi = 0, *curr_sisu = 0; > AVD_SG *sg = su->sg_of_su; > - bool is_eng = false, flag; > + bool is_eng = false; > uint32_t rc = NCSCC_RC_SUCCESS; > AVD_AVND *su_node_ptr = NULL; > SaAmfHAStateT hastate = SA_AMF_HA_QUIESCED; > @@ -2607,8 +2602,7 @@ uint32_t avd_sg_nway_susi_succ_su_oper(A > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == > true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -2646,8 +2640,7 @@ uint32_t avd_sg_nway_susi_succ_su_oper(A > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -3087,7 +3080,7 @@ void avd_sg_nway_node_fail_su_oper(AVD_C > { > AVD_SU_SI_REL *curr_susi = 0, *curr_sisu = 0; > AVD_SG *sg = su->sg_of_su; > - bool is_su_present, flag; > + bool is_su_present; > uint32_t rc = NCSCC_RC_SUCCESS; > AVD_AVND *su_node_ptr = NULL; > > @@ -3102,8 +3095,7 @@ void avd_sg_nway_node_fail_su_oper(AVD_C > if (su->saAmfSUAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -3465,7 +3457,7 @@ void avd_sg_nway_node_fail_sg_admin(AVD_ > void avd_sg_nway_node_fail_sg_realign(AVD_CL_CB *cb, AVD_SU *su) > { > AVD_SG *sg = su->sg_of_su; > - bool is_su_present, flag; > + bool is_su_present; > AVD_AVND *su_node_ptr = NULL; > > TRACE_ENTER2("SU '%s'",su->name.value); > @@ -3484,8 +3476,7 @@ void avd_sg_nway_node_fail_sg_realign(AV > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > diff --git a/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc > b/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc > --- a/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc > +++ b/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc > @@ -363,8 +363,7 @@ uint32_t SG_NACV::su_fault(AVD_CL_CB *cb > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == > true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -395,8 +394,7 @@ uint32_t SG_NACV::su_fault(AVD_CL_CB *cb > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == > true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -677,8 +675,7 @@ uint32_t SG_NACV::susi_success(AVD_CL_CB > } else if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == > true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -871,8 +868,7 @@ uint32_t SG_NACV::susi_success(AVD_CL_CB > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if > (su_node_ptr->saAmfNodeAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) { > - > m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() > == true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -1008,7 +1004,6 @@ uint32_t SG_NACV::susi_success(AVD_CL_CB > > uint32_t SG_NACV::susi_failed(AVD_CL_CB *cb, AVD_SU *su, AVD_SU_SI_REL > *susi, > AVSV_SUSI_ACT act, SaAmfHAStateT state) { > - bool flag; > AVD_AVND *su_node_ptr = NULL; > > TRACE_ENTER2("%u", su->sg_of_su->sg_fsm_state); > @@ -1070,8 +1065,7 @@ uint32_t SG_NACV::susi_failed(AVD_CL_CB > } else if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == > true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -1141,8 +1135,7 @@ uint32_t SG_NACV::susi_failed(AVD_CL_CB > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if > (su_node_ptr->saAmfNodeAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) { > - > m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() > == true) { > > node_admin_state_set(su_node_ptr, SA_AMF_ADMIN_LOCKED); > } > } > @@ -1341,8 +1334,7 @@ void SG_NACV::node_fail(AVD_CL_CB *cb, A > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > @@ -1394,8 +1386,7 @@ void SG_NACV::node_fail(AVD_CL_CB *cb, A > if (su->saAmfSUAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > su->set_admin_state(SA_AMF_ADMIN_LOCKED); > } else if (su_node_ptr->saAmfNodeAdminState == > SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK((su_node_ptr), flag); > - if (flag == true) { > + if (su_node_ptr->is_node_lock() == true) { > node_admin_state_set(su_node_ptr, > SA_AMF_ADMIN_LOCKED); > } > } > diff --git a/osaf/services/saf/amf/amfd/sgproc.cc > b/osaf/services/saf/amf/amfd/sgproc.cc > --- a/osaf/services/saf/amf/amfd/sgproc.cc > +++ b/osaf/services/saf/amf/amfd/sgproc.cc > @@ -338,8 +338,7 @@ void process_su_si_response_for_ng(AVD_S > /* Node may be in SHUTTING_DOWN state because of shutdown operation > on nodegroup. Check if node can be transitioned to LOCKED sate.*/ > if (node->saAmfNodeAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) { > - m_AVD_IS_NODE_LOCK(node, flag); > - if (flag == true) > + if (node->is_node_lock() == true) > node_admin_state_set(node, SA_AMF_ADMIN_LOCKED); > } > /*In 2N model, if both active or standby SUs were part of nodegroup then > @@ -575,8 +574,7 @@ static void perform_nodeswitchover_recov > bool node_reboot = true; > TRACE_ENTER2("'%s'", node->name.value); > > - AVD_SU *su = node->list_of_su; > - for (;su != NULL; su = su->avnd_list_su_next) { > + for (const auto& su : node->list_of_su) { > su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE); > > if (su->list_of_susi == NULL) > @@ -623,7 +621,7 @@ void avd_su_oper_state_evh(AVD_CL_CB *cb > { > AVD_DND_MSG *n2d_msg = evt->info.avnd_msg; > AVD_AVND *node; > - AVD_SU *su, *i_su; > + AVD_SU *su; > SaAmfReadinessStateT old_state; > bool node_reboot_req = true; > > @@ -714,10 +712,8 @@ void avd_su_oper_state_evh(AVD_CL_CB *cb > */ > avd_node_oper_state_set(node, > SA_AMF_OPERATIONAL_DISABLED); > node->recvr_fail_sw = true; > - i_su = node->list_of_su; > - while (i_su != NULL) { Perhaps su below could be renamed to avoid confusion with the 'outer' variable of the same name. [HansN] yes, I'll rename the su name. > + for (const auto& su : node->list_of_su) { > > su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE); > - i_su = i_su->avnd_list_su_next; > } > } /* if > (n2d_msg->msg_info.n2d_opr_state.node_oper_state == > SA_AMF_OPERATIONAL_DISABLED) */ > } /* if(cb->init_state == AVD_INIT_DONE) */ > @@ -1413,12 +1409,10 @@ void avd_su_si_assign_evh(AVD_CL_CB *cb, > > /* We are checking only application components as on payload > all ncs comp are in no_red model. > We are doing the same thing for controller also. */ > - temp_su = node->list_of_su; > - while (temp_su) { > + for (const auto& temp_su : node->list_of_su) { > if (NULL != temp_su->list_of_susi) { > all_su_unassigned = false; > } > - temp_su = temp_su->avnd_list_su_next; > } > if (true == all_su_unassigned) { > /* All app su got unassigned, Safe to reboot the blade > now. */ > @@ -1457,8 +1451,6 @@ void avd_su_si_assign_evh(AVD_CL_CB *cb, > > void avd_sg_app_node_su_inst_func(AVD_CL_CB *cb, AVD_AVND *avnd) > { > - AVD_SU *i_su; > - > TRACE_ENTER2("'%s'", avnd->name.value); > > if (avnd->saAmfNodeAdminState == SA_AMF_ADMIN_LOCKED_INSTANTIATION) { > @@ -1467,8 +1459,8 @@ void avd_sg_app_node_su_inst_func(AVD_CL > } > > if (cb->init_state == AVD_INIT_DONE) { > - i_su = avnd->list_of_su; > - while (i_su != NULL) { > + for (const auto& i_su : avnd->list_of_su) { > + > if ((i_su->term_state == false) && > (i_su->saAmfSUPresenceState == > SA_AMF_PRESENCE_UNINSTANTIATED) && > (i_su->saAmfSUAdminState != > SA_AMF_ADMIN_LOCKED_INSTANTIATION) && > @@ -1494,20 +1486,17 @@ void avd_sg_app_node_su_inst_func(AVD_CL > } > } > > - i_su = i_su->avnd_list_su_next; > } > node_reset_su_try_inst_counter(avnd); > > } else if (cb->init_state == AVD_APP_STATE) { > - i_su = avnd->list_of_su; > - while (i_su != NULL) { > + for (const auto& i_su : avnd->list_of_su) { > if ((i_su->term_state == false) && > (i_su->saAmfSUPresenceState == > SA_AMF_PRESENCE_UNINSTANTIATED)) { > /* Look at the SG and do the instantiations. */ > avd_sg_app_su_inst_func(cb, i_su->sg_of_su); > } > > - i_su = i_su->avnd_list_su_next; > } > } > > @@ -1825,8 +1814,6 @@ done: > > void avd_node_down_mw_susi_failover(AVD_CL_CB *cb, AVD_AVND *avnd) > { > - AVD_SU *i_su; > - > TRACE_ENTER2("'%s'", avnd->name.value); > > /* run through all the MW SUs, make all of them O.O.S. Set > @@ -1835,9 +1822,9 @@ void avd_node_down_mw_susi_failover(AVD_ > * disable and uninstantiated. All the functionality for MW SUs is > done in > * one loop as more than one MW SU per SG in one node is not supported. > */ > - i_su = avnd->list_of_ncs_su; > - osafassert(i_su != 0); > - while (i_su != NULL) { > + osafassert(avnd->list_of_ncs_su.empty() != true); > + > + for (const auto& i_su : avnd->list_of_ncs_su) { > i_su->set_oper_state(SA_AMF_OPERATIONAL_DISABLED); > i_su->set_pres_state(SA_AMF_PRESENCE_UNINSTANTIATED); > i_su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE); > @@ -1864,9 +1851,7 @@ void avd_node_down_mw_susi_failover(AVD_ > /* Free all the SU SI assignments*/ > i_su->delete_all_susis(); > > - i_su = i_su->avnd_list_su_next; > - > - } /* while (i_su != AVD_SU_NULL) */ > + } /* for (const auto& i_su : avnd->list_of_su) */ > > /* send pending callback for this node if any */ > if (avnd->admin_node_pend_cbk.invocation != 0) { > @@ -1892,20 +1877,16 @@ void avd_node_down_mw_susi_failover(AVD_ > **/ > void avd_node_down_appl_susi_failover(AVD_CL_CB *cb, AVD_AVND *avnd) > { > - AVD_SU *i_su; > - > TRACE_ENTER2("'%s'", avnd->name.value); > > /* Run through the list of application SUs make all of them O.O.S. > */ > - i_su = avnd->list_of_su; > - while (i_su != NULL) { > + for (const auto& i_su : avnd->list_of_su) { > i_su->set_oper_state(SA_AMF_OPERATIONAL_DISABLED); > i_su->set_pres_state(SA_AMF_PRESENCE_UNINSTANTIATED); > i_su->set_readiness_state(SA_AMF_READINESS_OUT_OF_SERVICE); > i_su->complete_admin_op(SA_AIS_ERR_TIMEOUT); > i_su->disable_comps(SA_AIS_ERR_TIMEOUT); > - i_su = i_su->avnd_list_su_next; > } > > /* If the AvD is in AVD_APP_STATE run through all the application SUs > and > @@ -1913,8 +1894,7 @@ void avd_node_down_appl_susi_failover(AV > */ > > if (cb->init_state == AVD_APP_STATE) { > - i_su = avnd->list_of_su; > - while (i_su != NULL) { > + for (const auto& i_su : avnd->list_of_su) { > > /* Unlike active, quiesced and standby HA states, > assignment counters > in quiescing HA state are updated when AMFD receives > assignment > @@ -1963,17 +1943,15 @@ void avd_node_down_appl_susi_failover(AV > */ > avd_sg_app_su_inst_func(cb, i_su->sg_of_su); > > - i_su = i_su->avnd_list_su_next; > - > - } /* while (i_su != AVD_SU_NULL) */ > + } /* for (const auto& i_su : avnd->list_of_su) */ > > } > > /* If this node-failover/nodereboot occurs dueing nodegroup operation > then check > if this leads to completion of operation and try to reply to imm.*/ > - if ((avnd->list_of_su != NULL) && (avnd->admin_ng != NULL)) { > + if ((avnd->list_of_su.empty() != true) && (avnd->admin_ng != NULL)) { > avnd->su_cnt_admin_oper = 0; > - process_su_si_response_for_ng(avnd->list_of_su, SA_AIS_OK); > + process_su_si_response_for_ng(avnd->list_of_su.front(), > SA_AIS_OK); > } > TRACE_LEAVE(); > } > diff --git a/osaf/services/saf/amf/amfd/su.cc > b/osaf/services/saf/amf/amfd/su.cc > --- a/osaf/services/saf/amf/amfd/su.cc > +++ b/osaf/services/saf/amf/amfd/su.cc > @@ -56,7 +56,6 @@ void AVD_SU::initialize() { > list_of_susi = NULL; > list_of_comp = NULL; > sg_list_su_next = NULL; > - avnd_list_su_next = NULL; > su_type = NULL; > su_list_su_type_next = NULL; > name.length = 0; > @@ -518,14 +517,14 @@ static AVD_AVND *map_su_to_node(AVD_SU * > osafassert(node); > > if (su->sg_of_su->sg_ncs_spec == true) { > - for (su_temp = node->list_of_ncs_su; su_temp != NULL; > su_temp = su_temp->avnd_list_su_next) { > + for (const auto& su_temp : node->list_of_ncs_su) { > if (su_temp->sg_of_su == su->sg_of_su) > break; > } > } > > if (su->sg_of_su->sg_ncs_spec == false) { > - for (su_temp = node->list_of_su; su_temp != NULL; > su_temp = su_temp->avnd_list_su_next) { > + for (const auto& su_temp : node->list_of_su) { > if (su_temp->sg_of_su == su->sg_of_su) > break; > } > diff --git a/osaf/services/saf/amf/amfd/util.cc > b/osaf/services/saf/amf/amfd/util.cc > --- a/osaf/services/saf/amf/amfd/util.cc > +++ b/osaf/services/saf/amf/amfd/util.cc > @@ -516,11 +516,11 @@ uint32_t avd_snd_su_reg_msg(AVD_CL_CB *c > su_msg->msg_info.d2n_reg_su.msg_on_fover = fail_over; > > // Add osaf SUs > - for (su = avnd->list_of_ncs_su; su != NULL; su = su->avnd_list_su_next) > + for (const auto& su : avnd->list_of_ncs_su) > reg_su_msg_init_su_info(su_msg, su); > > // Add app SUs > - for (su = avnd->list_of_su; su != NULL; su = su->avnd_list_su_next) > + for (const auto& su : avnd->list_of_su) > reg_su_msg_init_su_info(su_msg, su); > > // Add external SUs but only if node belongs to ACT controller ------------------------------------------------------------------------------ _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel