Hi Gary, Long,

Ack for all the patches.
Please update Readme and AMF Pr doc.

Thanks,
Praveen

On 22-Aug-16 6:23 AM, Gary Lee wrote:
> Hi Long
>
> ack (review only)
>
>
> On 19/08/2016 4:33 PM, Long HB Nguyen wrote:
>>   osaf/services/saf/amf/amfnd/util.cc |  546
>> ------------------------------------
>>   1 files changed, 0 insertions(+), 546 deletions(-)
>>
>>
>> diff --git a/osaf/services/saf/amf/amfnd/util.cc
>> b/osaf/services/saf/amf/amfnd/util.cc
>> --- a/osaf/services/saf/amf/amfnd/util.cc
>> +++ b/osaf/services/saf/amf/amfnd/util.cc
>> @@ -249,552 +249,6 @@ const char *avnd_failed_state_file_locat
>>       return failed_state_file_name;
>>   }
>>
>> -/*****************************************************************************
>>
>> - * Function: free_d2n_su_msg_info
>> - *
>> - * Purpose:  This function frees the d2n SU message contents.
>> - *
>> - * Input: su_msg - Pointer to the SU message contents to be freed.
>> - *
>> - * Returns: None
>> - *
>> - * NOTES: none.
>> - *
>> - *
>> -
>> **************************************************************************/
>>
>> -
>> -static void free_d2n_su_msg_info(AVSV_DND_MSG *su_msg)
>> -{
>> -    AVSV_SU_INFO_MSG *su_info;
>> -
>> -    while (su_msg->msg_info.d2n_reg_su.su_list != nullptr) {
>> -        su_info = su_msg->msg_info.d2n_reg_su.su_list;
>> -        su_msg->msg_info.d2n_reg_su.su_list = su_info->next;
>> -        delete su_info;
>> -    }
>> -}
>> -
>> -
>> -/*****************************************************************************
>>
>> - * Function: free_d2n_susi_msg_info
>> - *
>> - * Purpose:  This function frees the d2n SU SI message contents.
>> - *
>> - * Input: susi_msg - Pointer to the SUSI message contents to be freed.
>> - *
>> - * Returns: none
>> - *
>> - * NOTES: It also frees the array of attributes, which are sperately
>> - * allocated and pointed to by AVSV_SUSI_ASGN structure.
>> - *
>> - *
>> -
>> **************************************************************************/
>>
>> -
>> -static void free_d2n_susi_msg_info(AVSV_DND_MSG *susi_msg)
>> -{
>> -    AVSV_SUSI_ASGN *compcsi_info;
>> -
>> -    while (susi_msg->msg_info.d2n_su_si_assign.list != nullptr) {
>> -        compcsi_info = susi_msg->msg_info.d2n_su_si_assign.list;
>> -        susi_msg->msg_info.d2n_su_si_assign.list = compcsi_info->next;
>> -        if (compcsi_info->attrs.list != nullptr) {
>> -            // AVSV_ATTR_NAME_VAL variables
>> -            // are malloc'ed, use free()
>> -            free(compcsi_info->attrs.list);
>> -            compcsi_info->attrs.list = nullptr;
>> -        }
>> -        delete compcsi_info;
>> -    }
>> -}
>> -
>> -/*****************************************************************************
>>
>> - * Function: free_d2n_pg_msg_info
>> - *
>> - * Purpose:  This function frees the d2n PG track response message
>> contents.
>> - *
>> - * Input: pg_msg - Pointer to the PG message contents to be freed.
>> - *
>> - * Returns: None
>> - *
>> - * NOTES: None
>> - *
>> - *
>> -
>> **************************************************************************/
>>
>> -
>> -static void free_d2n_pg_msg_info(AVSV_DND_MSG *pg_msg)
>> -{
>> -    AVSV_D2N_PG_TRACK_ACT_RSP_MSG_INFO *info =
>> &pg_msg->msg_info.d2n_pg_track_act_rsp;
>> -
>> -    if (info->mem_list.numberOfItems > 0)
>> -        delete [] info->mem_list.notification;
>> -
>> -    info->mem_list.notification = 0;
>> -    info->mem_list.numberOfItems = 0;
>> -}
>> -
>> -/****************************************************************************
>>
>> -  Name          : dnd_msg_free
>> -
>> -  Description   : This routine frees the Message structures used for
>> -                  communication between AvD and AvND.
>> -
>> -  Arguments     : msg - ptr to the DND message that needs to be freed.
>> -
>> -  Return Values : None
>> -
>> -  Notes         : For : AVSV_D2N_REG_SU_MSG,
>> AVSV_D2N_INFO_SU_SI_ASSIGN_MSG
>> -                  and AVSV_D2N_PG_TRACK_ACT_RSP_MSG, this procedure
>> calls the
>> -                  corresponding information free function to free the
>> -                  list information in them before freeing the message.
>> -******************************************************************************/
>>
>> -void dnd_msg_free(AVSV_DND_MSG *msg)
>> -{
>> -    if (msg == nullptr)
>> -        return;
>> -
>> -    /* these messages have information list in them free them
>> -     * first by calling the corresponding free routine.
>> -     */
>> -    switch (msg->msg_type) {
>> -    case AVSV_D2N_REG_SU_MSG:
>> -        free_d2n_su_msg_info(msg);
>> -        break;
>> -    case AVSV_D2N_INFO_SU_SI_ASSIGN_MSG:
>> -        free_d2n_susi_msg_info(msg);
>> -        break;
>> -    case AVSV_D2N_PG_TRACK_ACT_RSP_MSG:
>> -        free_d2n_pg_msg_info(msg);
>> -        break;
>> -    case AVSV_N2D_ND_SISU_STATE_INFO_MSG:
>> -        free_n2d_nd_sisu_state_info(msg);
>> -        break;
>> -    case AVSV_N2D_ND_CSICOMP_STATE_INFO_MSG:
>> -        free_n2d_nd_csicomp_state_info(msg);
>> -        break;
>> -    default:
>> -        break;
>> -    }
>> -
>> -    /* free the message */
>> -    delete msg;
>> -}
>> -
>> -/****************************************************************************
>>
>> -  Name          : nda_ava_msg_free
>> -
>> -  Description   : This routine frees the AvA message.
>> -
>> -  Arguments     : msg - ptr to the AvA msg
>> -
>> -  Return Values : None
>> -
>> -  Notes         : None.
>> -******************************************************************************/
>>
>> -void nda_ava_msg_free(AVSV_NDA_AVA_MSG *msg)
>> -{
>> -    if (!msg)
>> -        return;
>> -
>> -    /* free the message content */
>> -    nda_ava_msg_content_free(msg);
>> -
>> -    /* free the message */
>> -    delete msg;
>> -
>> -    return;
>> -}
>> -
>> -/****************************************************************************
>>
>> -  Name          : nda_ava_msg_content_free
>> -
>> -  Description   : This routine frees the content of the AvA message.
>> -
>> -  Arguments     : msg - ptr to the AvA msg
>> -
>> -  Return Values : None.
>> -
>> -  Notes         : This routine is used by AvA as it does not alloc nda
>> -                  message while decoding from mds.
>> -******************************************************************************/
>>
>> -void nda_ava_msg_content_free(AVSV_NDA_AVA_MSG *msg)
>> -{
>> -    if (!msg)
>> -        return;
>> -
>> -    switch (msg->type) {
>> -    case AVSV_AVA_API_MSG:
>> -    case AVSV_AVND_AMF_API_RESP_MSG:
>> -        break;
>> -
>> -    case AVSV_AVND_AMF_CBK_MSG:
>> -        if (msg->info.cbk_info) {
>> -            amf_cbk_free(msg->info.cbk_info);
>> -            msg->info.cbk_info = 0;
>> -        }
>> -        break;
>> -
>> -    default:
>> -        break;
>> -    }
>> -
>> -    return;
>> -}
>> -
>> -/****************************************************************************
>>
>> -  Name          : amf_csi_attr_list_copy
>> -
>> -  Description   : This routine copies the csi attribute list.
>> -
>> -  Arguments     : dattr - ptr to the destination csi-attr list
>> -                  sattr - ptr to the src csi-attr list
>> -
>> -  Return Values : NCSCC_RC_SUCCESS / NCSCC_RC_FAILURE
>> -
>> -  Notes         : None.
>> -******************************************************************************/
>>
>> -void amf_csi_attr_list_copy(SaAmfCSIAttributeListT *dattr,
>> -    const SaAmfCSIAttributeListT *sattr)
>> -{
>> -    uint32_t cnt;
>> -
>> -    if (dattr == nullptr || sattr == nullptr)
>> -        goto done;
>> -
>> -    dattr->attr = new SaAmfCSIAttributeT[sattr->number];
>> -
>> -    for (cnt = 0; cnt < sattr->number; cnt++) {
>> -        /* alloc memory for attr name & value */
>> -        size_t attrNameSize =
>> strlen((char*)sattr->attr[cnt].attrName) + 1;
>> -        dattr->attr[cnt].attrName = new SaUint8T[attrNameSize];
>> -
>> -        size_t attrValueSize =
>> strlen((char*)sattr->attr[cnt].attrValue) + 1;
>> -        dattr->attr[cnt].attrValue = new SaUint8T[attrNameSize];
>> -
>> -        /* copy the attr name & value */
>> -        strncpy((char*)dattr->attr[cnt].attrName,
>> -            (char*)sattr->attr[cnt].attrName, attrNameSize);
>> -        strncpy((char*)dattr->attr[cnt].attrValue,
>> -            (char*)sattr->attr[cnt].attrValue, attrValueSize);
>> -
>> -        /* increment the attr name-val pair cnt that is copied */
>> -        dattr->number++;
>> -    }
>> -
>> -done:
>> -    return;
>> -}
>> -
>> -/****************************************************************************
>>
>> -  Name          : amf_csi_attr_list_free
>> -
>> -  Description   : This routine frees the csi attribute list.
>> -
>> -  Arguments     : attr - ptr to the csi-attr list
>> -
>> -  Return Values : None.
>> -
>> -  Notes         : None.
>> -******************************************************************************/
>>
>> -void amf_csi_attr_list_free(SaAmfCSIAttributeListT *attrs)
>> -{
>> -    uint32_t cnt;
>> -
>> -    if (attrs == nullptr)
>> -        return;
>> -
>> -    /* free the attr name-val pair */
>> -    for (cnt = 0; cnt < attrs->number; cnt++) {
>> -        delete [] attrs->attr[cnt].attrName;
>> -        delete [] attrs->attr[cnt].attrValue;
>> -    }            /* for */
>> -
>> -    /* finally free the attr list ptr */
>> -    delete [] attrs->attr;
>> -
>> -    return;
>> -}
>> -
>> -/****************************************************************************
>>
>> -  Name          : amf_cbk_copy
>> -
>> -  Description   : This routine copies the AMF callback info message.
>> -
>> -  Arguments     : o_dcbk - double ptr to the dest cbk-info (o/p)
>> -                  scbk   - ptr to the source cbk-info
>> -
>> -  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.
>> -
>> -  Notes         : None
>> -******************************************************************************/
>>
>> -uint32_t amf_cbk_copy(AVSV_AMF_CBK_INFO **o_dcbk, const
>> AVSV_AMF_CBK_INFO *scbk)
>> -{
>> -    uint32_t rc = NCSCC_RC_SUCCESS;
>> -
>> -    if (o_dcbk == nullptr || scbk == nullptr)
>> -        return NCSCC_RC_FAILURE;
>> -
>> -    /* allocate the dest cbk-info */
>> -    *o_dcbk = new AVSV_AMF_CBK_INFO();
>> -
>> -    /* copy the common fields */
>> -    memcpy(*o_dcbk, scbk, sizeof(AVSV_AMF_CBK_INFO));
>> -
>> -    switch (scbk->type) {
>> -    case AVSV_AMF_HC:
>> -    case AVSV_AMF_COMP_TERM:
>> -    case AVSV_AMF_CSI_REM:
>> -    case AVSV_AMF_PXIED_COMP_INST:
>> -    case AVSV_AMF_PXIED_COMP_CLEAN:
>> -        break;
>> -
>> -    case AVSV_AMF_PG_TRACK:
>> -        /* memset notify buffer */
>> -        memset(&(*o_dcbk)->param.pg_track.buf, 0,
>> sizeof(SaAmfProtectionGroupNotificationBufferT));
>> -
>> -        /* copy the notify buffer, if any */
>> -        if (scbk->param.pg_track.buf.numberOfItems > 0) {
>> -            (*o_dcbk)->param.pg_track.buf.notification =
>> -                new
>> SaAmfProtectionGroupNotificationT[scbk->param.pg_track.buf.numberOfItems];
>>
>> -
>> -            for (SaUint32T i = 0; i <
>> scbk->param.pg_track.buf.numberOfItems; ++i) {
>> -                (*o_dcbk)->param.pg_track.buf.notification[i] =
>> -                    scbk->param.pg_track.buf.notification[i];
>> -            }
>> -            (*o_dcbk)->param.pg_track.buf.numberOfItems =
>> scbk->param.pg_track.buf.numberOfItems;
>> -        }
>> -        break;
>> -
>> -    case AVSV_AMF_CSI_SET:
>> -        /* memset avsv & amf csi attr lists */
>> -        memset(&(*o_dcbk)->param.csi_set.attrs, 0,
>> sizeof(AVSV_CSI_ATTRS));
>> -        memset(&(*o_dcbk)->param.csi_set.csi_desc.csiAttr, 0,
>> sizeof(SaAmfCSIAttributeListT));
>> -
>> -        /* copy the avsv csi attr list */
>> -        if (scbk->param.csi_set.attrs.number > 0) {
>> -            (*o_dcbk)->param.csi_set.attrs.list =
>> static_cast<AVSV_ATTR_NAME_VAL*>
>> -                (calloc(scbk->param.csi_set.attrs.number,
>> sizeof(AVSV_ATTR_NAME_VAL)));
>> -            osafassert((*o_dcbk)->param.csi_set.attrs.list != nullptr);
>> -
>> -            for (uint32_t i = 0; i <
>> scbk->param.csi_set.attrs.number; ++i) {
>> -                (*o_dcbk)->param.csi_set.attrs.list[i] =
>> -                    scbk->param.csi_set.attrs.list[i];
>> -            }
>> -            (*o_dcbk)->param.csi_set.attrs.number =
>> scbk->param.csi_set.attrs.number;
>> -        }
>> -
>> -        /* copy the amf csi attr list */
>> -        if (scbk->param.csi_set.csi_desc.csiAttr.number > 0) {
>> -
>> amf_csi_attr_list_copy(&(*o_dcbk)->param.csi_set.csi_desc.csiAttr,
>> -                &scbk->param.csi_set.csi_desc.csiAttr);
>> -        }
>> -        break;
>> -
>> -    default:
>> -        osafassert(0);
>> -    }
>> -
>> -    return rc;
>> -}
>> -
>> -/****************************************************************************
>>
>> -  Name          : amf_cbk_free
>> -
>> -  Description   : This routine frees callback information.
>> -
>> -  Arguments     : cbk_info - ptr to the callback info
>> -
>> -  Return Values : None.
>> -
>> -  Notes         : None.
>> -******************************************************************************/
>>
>> -void amf_cbk_free(AVSV_AMF_CBK_INFO *cbk_info)
>> -{
>> -    if (cbk_info == nullptr)
>> -        return;
>> -
>> -    switch (cbk_info->type) {
>> -    case AVSV_AMF_HC:
>> -    case AVSV_AMF_COMP_TERM:
>> -    case AVSV_AMF_CSI_REM:
>> -    case AVSV_AMF_PXIED_COMP_INST:
>> -    case AVSV_AMF_PXIED_COMP_CLEAN:
>> -        break;
>> -
>> -    case AVSV_AMF_PG_TRACK:
>> -        /* free the notify buffer */
>> -        if (cbk_info->param.pg_track.buf.numberOfItems > 0)
>> -            delete [] cbk_info->param.pg_track.buf.notification;
>> -        break;
>> -
>> -    case AVSV_AMF_CSI_SET:
>> -        /* free the avsv csi attr list */
>> -        if (cbk_info->param.csi_set.attrs.number > 0) {
>> -            // AVSV_ATTR_NAME_VAL variables
>> -            // are malloc'ed, use free()
>> -            free(cbk_info->param.csi_set.attrs.list);
>> -        }
>> -
>> -        /* free the amf csi attr list */
>> -
>> amf_csi_attr_list_free(&cbk_info->param.csi_set.csi_desc.csiAttr);
>> -        break;
>> -
>> -    default:
>> -        break;
>> -    }
>> -
>> -    /* free the cbk-info ptr */
>> -    delete cbk_info;
>> -    cbk_info = nullptr;
>> -
>> -    return;
>> -}
>> -
>> -/****************************************************************************
>>
>> -  Name          : nd2nd_avnd_msg_free
>> -
>> -  Description   : This routine frees the AvND message.
>> -
>> -  Arguments     : msg - ptr to the AvA msg
>> -
>> -  Return Values : None
>> -
>> -  Notes         : None.
>> -******************************************************************************/
>>
>> -void nd2nd_avnd_msg_free(AVSV_ND2ND_AVND_MSG *msg)
>> -{
>> -    if (!msg)
>> -        return;
>> -
>> -    if (AVND_AVND_AVA_MSG == msg->type) {
>> -        /* free the message content after all these are AvA content. */
>> -        nda_ava_msg_free(msg->info.msg);
>> -    }
>> -    /* free the message */
>> -    delete msg;
>> -
>> -    return;
>> -}
>> -
>> -/****************************************************************************
>>
>> -  Name          : free_n2d_nd_csicomp_state_info
>> -
>> -  Description   : This routine frees csicomp_state message.
>> -
>> -  Arguments     : msg - ptr to the msg
>> -
>> -  Return Values : None
>> -
>> -  Notes         : None.
>> -******************************************************************************/
>>
>> -void free_n2d_nd_csicomp_state_info(AVSV_DND_MSG *msg)
>> -{
>> -    TRACE_ENTER();
>> -
>> -    AVSV_N2D_ND_CSICOMP_STATE_MSG_INFO *info = nullptr;
>> -    AVSV_CSICOMP_STATE_MSG *ptr = nullptr;
>> -    AVSV_CSICOMP_STATE_MSG *next_ptr = nullptr;
>> -
>> -    AVSV_COMP_STATE_MSG *comp_ptr = nullptr;
>> -    AVSV_COMP_STATE_MSG *comp_next_ptr = nullptr;
>> -
>> -    if (msg == nullptr)
>> -        goto done;
>> -
>> -    osafassert(msg->msg_type == AVSV_N2D_ND_CSICOMP_STATE_INFO_MSG);
>> -
>> -    info = &msg->msg_info.n2d_nd_csicomp_state_info;
>> -    osafassert(info);
>> -
>> -    ptr = info->csicomp_list;
>> -
>> -    TRACE("%u csicomp records to free", info->num_csicomp);
>> -
>> -    while (ptr != nullptr) {
>> -        TRACE("freeing %s:%s",
>> osaf_extended_name_borrow(&ptr->safCSI),
>> osaf_extended_name_borrow(&ptr->safComp));
>> -        next_ptr = ptr->next;
>> -        delete ptr;
>> -        ptr = next_ptr;
>> -    }
>> -
>> -    comp_ptr = info->comp_list;
>> -
>> -    TRACE("%u comp records to free", info->num_comp);
>> -
>> -    while (comp_ptr != nullptr) {
>> -        comp_next_ptr = comp_ptr->next;
>> -        delete comp_ptr;
>> -        comp_ptr = comp_next_ptr;
>> -    }
>> -
>> -    info->num_csicomp = 0;
>> -    info->csicomp_list = nullptr;
>> -    info->num_comp = 0;
>> -    info->comp_list = nullptr;
>> -
>> -done:
>> -    TRACE_LEAVE();
>> -}
>> -
>> -/****************************************************************************
>>
>> -  Name          : free_n2d_nd_sisu_state_info
>> -
>> -  Description   : This routine frees sisu_state message.
>> -
>> -  Arguments     : msg - ptr to the msg
>> -
>> -  Return Values : None
>> -
>> -  Notes         : None.
>> -******************************************************************************/
>>
>> -void free_n2d_nd_sisu_state_info(AVSV_DND_MSG *msg)
>> -{
>> -    TRACE_ENTER();
>> -
>> -    AVSV_N2D_ND_SISU_STATE_MSG_INFO *info =
>> &msg->msg_info.n2d_nd_sisu_state_info;
>> -    AVSV_SISU_STATE_MSG *ptr = info->sisu_list;
>> -    AVSV_SISU_STATE_MSG *next_ptr = nullptr;
>> -    AVSV_SU_STATE_MSG *su_ptr = info->su_list;
>> -    AVSV_SU_STATE_MSG *su_next_ptr = nullptr;
>> -
>> -    if (msg == nullptr)
>> -        goto done;
>> -
>> -    osafassert(msg->msg_type == AVSV_N2D_ND_SISU_STATE_INFO_MSG);
>> -
>> -    info = &msg->msg_info.n2d_nd_sisu_state_info;
>> -    osafassert(info);
>> -
>> -    ptr = info->sisu_list;
>> -
>> -    TRACE("%u sisu records to free", info->num_sisu);
>> -
>> -    while (ptr != nullptr) {
>> -        TRACE("freeing %s:%s",
>> osaf_extended_name_borrow(&ptr->safSI),
>> osaf_extended_name_borrow(&ptr->safSU));
>> -        next_ptr = ptr->next;
>> -        delete ptr;
>> -        ptr = next_ptr;
>> -    }
>> -
>> -    su_ptr = info->su_list;
>> -
>> -    TRACE("%u su records to free", info->num_su);
>> -
>> -    while (su_ptr != nullptr) {
>> -        su_next_ptr = su_ptr->next;
>> -        delete su_ptr;
>> -        su_ptr = su_next_ptr;
>> -    }
>> -
>> -
>> -    info->num_sisu = 0;
>> -    info->sisu_list = nullptr;
>> -    info->num_su = 0;
>> -    info->su_list = nullptr;
>> -
>> -done:
>> -    TRACE_LEAVE();
>> -}
>> -
>>
>> /****************************************************************************
>>
>>     Name          : saImmOmInitialize_cond
>>
>

------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to