Re: [devel] [PATCH 0 of 8] Review Request for CKPT: Support DNs longer than 255 bytes [#1574] v5

2016-08-21 Thread A V Mahesh
Hi Hoang,

ACK, Please Update README

Note : tested default functionality , LONG DN functionality not tested
in full fledged.

-AVM


On 8/18/2016 12:48 PM, Hoang Vo wrote:
> Summary: CKPT: Support DNs longer than 255 bytes {#1574}
> Review request for Trac Ticket(s): 1574
> Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
> Pull request to: mahesh.va...@oracle.com
> Affected branch(es): default
> Development branch: default
>
> 
> Impacted area   Impact y/n
> 
>   Docsn
>   Build systemn
>   RPM/packaging   n
>   Configuration files n
>   Startup scripts n
>   SAF servicesy
>   OpenSAF servicesn
>   Core libraries  n
>   Samples n
>   Tests   n
>   Other   n
>
>
> Comments (indicate scope for each "y" above):
> -
>
> changeset 05233bdae1fb000fea001964eba1c51ebf3bfd8e
> Author:   Hoang Vo 
> Date: Thu, 18 Aug 2016 13:51:56 +0700
>
>   cpd: Add support for extended SaNameT [#1574] v3
>
> changeset cecabec5b6be73e731e540fd439e1d0e3534809f
> Author:   Hoang Vo 
> Date: Thu, 18 Aug 2016 13:51:56 +0700
>
>   cpnd: Add support for extended SaNameT [#1574] v3
>
> changeset 940dc877c94a9539e3da06d89c6480ef7e0ceda0
> Author:   Hoang Vo 
> Date: Thu, 18 Aug 2016 13:51:56 +0700
>
>   cpa: Add support for extended SaNameT [#1574] v1
>
> changeset 1f74531a36163bdfecd6b27174443d51c11ecf61
> Author:   Hoang Vo 
> Date: Thu, 18 Aug 2016 13:51:56 +0700
>
>   cpsv: Add new message to support extended SaNameT [#1574] v3
>
> changeset 29df19302186b3275ad06db00dc62f275dea25e1
> Author:   Hoang Vo 
> Date: Thu, 18 Aug 2016 13:51:56 +0700
>
>   cpd: Add new mbcsv messages supporting extended SaNameT [#1574] v2
>
> changeset 3f72410a7c2bb077647bdd4e46869a31a832f1d8
> Author:   Hoang Vo 
> Date: Thu, 18 Aug 2016 13:51:56 +0700
>
>   cpsv: Apply new messages supporting extended SaNameT to CPD, CPND, and 
> CPA
>   [#1574] v4
>
> changeset f32a0b3ca1ebf6049d2103e68e91d98bf086c48e
> Author:   Hoang Vo 
> Date: Thu, 18 Aug 2016 13:51:56 +0700
>
>   ckpt: Add new test cases to verify long DN feature on CPSV [#1574] v1
>
> changeset 1aa38b707cf2cec14c416631cfc7e5518b25735f
> Author:   Hoang Vo 
> Date: Thu, 18 Aug 2016 13:51:56 +0700
>
>   cpnd: add support for shm recovery for in-service update without 
> restarting
>   node [#1574] v1
>
>
> Complete diffstat:
> --
>   osaf/libs/agents/saf/cpa/Makefile.am  |1 +
>   osaf/libs/agents/saf/cpa/cpa_api.c|   48 --
>   osaf/libs/agents/saf/cpa/cpa_db.c |2 +
>   osaf/libs/agents/saf/cpa/cpa_mds.c|4 +-
>   osaf/libs/agents/saf/cpa/cpa_proc.c   |2 +-
>   osaf/libs/common/cpsv/cpsv_evt.c  |  440 
> ++---
>   osaf/libs/common/cpsv/include/cpa.h   |1 +
>   osaf/libs/common/cpsv/include/cpa_cb.h|2 +-
>   osaf/libs/common/cpsv/include/cpa_proc.h  |2 +-
>   osaf/libs/common/cpsv/include/cpd.h   |1 +
>   osaf/libs/common/cpsv/include/cpd_cb.h|   17 +-
>   osaf/libs/common/cpsv/include/cpd_imm.h   |4 +-
>   osaf/libs/common/cpsv/include/cpd_mem.h   |   25 +++-
>   osaf/libs/common/cpsv/include/cpd_proc.h  |2 +-
>   osaf/libs/common/cpsv/include/cpnd.h  |1 +
>   osaf/libs/common/cpsv/include/cpnd_cb.h   |5 +-
>   osaf/libs/common/cpsv/include/cpnd_init.h |3 +-
>   osaf/libs/common/cpsv/include/cpsv_evt.h  |   10 +
>   osaf/libs/common/cpsv/include/cpsv_shm.h  |   24 +++-
>   osaf/services/saf/cpsv/cpd/Makefile.am|1 +
>   osaf/services/saf/cpsv/cpd/cpd_amf.c  |7 +-
>   osaf/services/saf/cpsv/cpd/cpd_db.c   |   95 +++---
>   osaf/services/saf/cpsv/cpd/cpd_evt.c  |  103 ++-
>   osaf/services/saf/cpsv/cpd/cpd_imm.c  |  268 
> ++
>   osaf/services/saf/cpsv/cpd/cpd_main.c |7 +
>   osaf/services/saf/cpsv/cpd/cpd_mbcsv.c|   31 -
>   osaf/services/saf/cpsv/cpd/cpd_mds.c  |   84 -
>   osaf/services/saf/cpsv/cpd/cpd_proc.c |  180 
> ++--
>   osaf/services/saf/cpsv/cpd/cpd_red.c  |6 +-
>   osaf/services/saf/cpsv/cpd/cpd_sbevt.c|   57 +++-
>   osaf/services/saf/cpsv/cpnd/Makefile.am   |1 +
>   osaf/services/saf/cpsv/cpnd/cpnd_db.c |6 +-
>   osaf/services/saf/cpsv/cpnd/cpnd_evt.c|   73 ---
>   osaf/services/saf/cpsv/cpnd/cpnd_main.c   |7 +
>   osaf/services/saf/cpsv/cpnd/cpnd_mds.c|   86 -
>   osaf/services/saf/cpsv/cpnd/cpnd_proc.c   |   84 +---
>   osaf/services/saf/cpsv/cpnd/cpnd_res.c|  823 
> +++

Re: [devel] [PATCH 7 of 8] ckpt: Add new test cases to verify long DN feature on CPSV [#1574] v1

2016-08-21 Thread A V Mahesh
ACK.

Not tested.

-AVM

On 8/18/2016 12:48 PM, Hoang Vo wrote:
>   tests/cpsv/Makefile.am  |1 +
>   tests/cpsv/test_cpa.c   |  180 
> +++-
>   tests/cpsv/test_cpa_util.c  |   16 +++-
>   tests/cpsv/test_cpsv.h  |6 +
>   tests/cpsv/test_cpsv_conf.h |3 +
>   5 files changed, 201 insertions(+), 5 deletions(-)
>
>
> diff --git a/tests/cpsv/Makefile.am b/tests/cpsv/Makefile.am
> --- a/tests/cpsv/Makefile.am
> +++ b/tests/cpsv/Makefile.am
> @@ -21,6 +21,7 @@ MAINTAINERCLEANFILES = Makefile.in
>   bin_PROGRAMS = ckpttest
>   
>   ckpttest_CPPFLAGS = \
> + -DSA_EXTENDED_NAME_SOURCE \
>   $(AM_CPPFLAGS) \
>   -I$(top_srcdir)/tests/unit_test_fw/inc \
>   -I$(top_srcdir)/osaf/libs/common/immsv/include \
> diff --git a/tests/cpsv/test_cpa.c b/tests/cpsv/test_cpa.c
> --- a/tests/cpsv/test_cpa.c
> +++ b/tests/cpsv/test_cpa.c
> @@ -1,6 +1,8 @@
>   #include 
>   #include 
>   
> +#include "saAis.h"
> +#include "osaf_extended_name.h"
>   #include "test_cpsv.h"
>   #include "test_cpsv_conf.h"
>   #include "ncs_main_papi.h"
> @@ -42,6 +44,10 @@ const char *saf_error_string[] = {
>   #define m_TEST_CPSV_PRINTF(...)
>   #endif
>   
> +#define VALID_EXTENDED_NAME_LENGTH 400
> +#define INVALID_EXTENDED_NAME_LENGTH 2049
> +
> +
>   extern int gl_prev_act;
>   
>   /** Ultility Functions /
> @@ -82,6 +88,18 @@ void printResult(int result)
>   
>   }
>   
> +bool is_extended_name_enable() {
> +
> +  char *extended_name_env = getenv("SA_ENABLE_EXTENDED_NAMES");
> +  if (extended_name_env == 0)
> +   return false;
> +
> +  if (strcmp(extended_name_env, "1") != 0)
> +   return false;
> +
> +  return true;
> +}
> +
>   void handleAssigner(SaInvocationT invocation, SaCkptCheckpointHandleT 
> checkpointHandle)
>   {
>  if (invocation == 1014)
> @@ -122,8 +140,7 @@ void fill_ckpt_attri(SaCkptCheckpointCre
>   
>   
> 
>   void fill_ckpt_name(SaNameT *name,char *string)
>   {
> -   strcpy((char *)name->value,string);
> -   name->length = strlen((char *)name->value);
> +   saAisNameLend(string, name);
>   }
>   
>   void fill_sec_attri(SaCkptSectionCreationAttributesT 
> *sec_cr_attr,SaCkptSectionIdT *sec,SaTimeT exp_time)
> @@ -279,6 +296,20 @@ void fill_testcase_data()
>  
> fill_ckpt_name(&tcd.weak_replica_ckpt_large,"safCkpt=weak_replica_large_ckpt,safApp=safCkptService");
>  
> fill_ckpt_name(&tcd.collocated_ckpt_large,"safCkpt=collocated_large_ckpt,safApp=safCkptService");
>   
> +   char *ckpt_name = malloc(VALID_EXTENDED_NAME_LENGTH);
> +   memset(ckpt_name, 0, VALID_EXTENDED_NAME_LENGTH);
> +   memset(ckpt_name, '.', VALID_EXTENDED_NAME_LENGTH - 1);
> +   int length = sprintf(ckpt_name, 
> "safCkpt=all_replicas_ckpt_with_valid_extended_name_length");
> +   *(ckpt_name + length) = '.';
> +   saAisNameLend(ckpt_name, 
> &tcd.all_replicas_ckpt_with_valid_extended_name_length);
> +
> +   ckpt_name = malloc(INVALID_EXTENDED_NAME_LENGTH);
> +   memset(ckpt_name, 0, INVALID_EXTENDED_NAME_LENGTH);
> +   memset(ckpt_name, '.', INVALID_EXTENDED_NAME_LENGTH - 1);
> +   length = sprintf(ckpt_name, 
> "safCkpt=all_replicas_ckpt_with_invalid_extended_name_length");
> +   *(ckpt_name + length) = '.';
> +   saAisNameLend(ckpt_name, 
> &tcd.all_replicas_ckpt_with_invalid_extended_name_length);
> +
>  /* Variables for sec create */
>  tcd.sec_id1 = (SaUint8T*)"11";
>  tcd.section1.idLen = 2;
> @@ -451,6 +482,9 @@ void test_ckpt_cleanup(CPSV_CLEANUP_CKPT
> error = test_ckptUnlink(CKPT_UNLINK_SUCCESS9_T,TEST_CONFIG_MODE);
> break;
>   
> + case CPSV_CLEAN_ASYNC_ALL_REPLICAS_CKPT_EXTENDED_NAME:
> +  error = 
> test_ckptUnlink(CKPT_UNLINK_ALL_REPLICAS_EXTENDED_NAME_SUCCESS_T,TEST_CONFIG_MODE);
> +  break;
> }
>   
> if(error != TEST_PASS)
> @@ -2278,6 +2312,122 @@ final1:
> test_validate(result, TEST_PASS);
>   }
>   
> +void cpsv_it_open_55()
> +{
> +  int result;
> +  printHead("To verify creating a ckpt with valid extended name length");
> +
> +  /* Skip the test if Extended Name is not enable */
> +  if (is_extended_name_enable() == false)
> +   return test_validate(TEST_PASS, TEST_PASS);
> +
> +  result = test_ckptInitialize(CKPT_INIT_SUCCESS_T,TEST_CONFIG_MODE);
> +  if(result != TEST_PASS)
> + goto final1;
> +
> +  result = 
> test_ckptOpen(CKPT_OPEN_ALL_CREATE_EXTENDED_NAME_SUCCESS_T,TEST_NONCONFIG_MODE);
> +
> +  test_cpsv_cleanup(CPSV_CLEAN_INIT_SUCCESS_T);
> +
> +final1:
> +  printResult(result);
> +  test_validate(result, TEST_PASS);
> +}
> +
> +void cpsv_it_open_56()
> +{
> +  int result;
> +  printHead("To verify creating a ckpt with invalid extended name length");
> +
> +  /* Skip the test if Extended Name is not enable */
> +  if (is_extended_name_enable() == false)
> +   return 

Re: [devel] [PATCH 1 of 1] amfa: fixed freeing notification buff [#1642]

2016-08-21 Thread minh chau
Hi Praveen,

The case you just mentioned is still in callback context, so Agent can 
help application to release the allocated notification. But still 
another case:

+SaAmfProtectionGroupNotificationBufferT buff;
+buff.notification = NULL;
+rc = saAmfProtectionGroupTrack_4(my_amf_hdl, &track_csi, 
SA_TRACK_CURRENT, &buff);
+if (rc != SA_AIS_OK) {
+syslog(LOG_ERR, "saAmfProtectionGroupTrack FAILED - %u", rc);
+goto done;
+}

In this case Agent has to allocate notification but it's not in Agent's 
context.
Application has to call API Free_4(buff.notification) to free up 
notification.
In order to iterate to free longDn(s) inside Free_4(), Agent has to 
memorize a list numberOfItems for every single call as above Track_4(), 
or Agent can add sentinel element to the allocated notification.

Thanks,
Minh

On 22/08/16 15:34, praveen malviya wrote:
> Hi,
> The callback looks like this:
> typedef void
> (*SaAmfProtectionGroupTrackCallbackT_4)(
> const SaNameT *csiName,
> SaAmfProtectionGroupNotificationBufferT_4 *notificationBuffer,
> SaUint32T numberOfMembers,
> SaAisErrorT error);
>
> Inside this callback, application is supposed to call 
> saAmfProtectionGroupNotificationFree_4(). So agent must be able to 
> deduce this information as SaAmfProtectionGroupNotificationBufferT_4 
> contains numberOfItems and also numberOfMembers is available from 
> callback.
> Since B.04.01 APIs are not fully implemented, agent copies from old 
> type of structure to new type in ava_cpy_protection_group_ntf().
>
>
> Thanks,
> Praveen
>
> On 22-Aug-16 10:51 AM, minh chau wrote:
>> Hi Praveen,
>>
>> The problem with B.04.01 is the API:
>> saAmfProtectionGroupNotificationFree_4(SaAmfHandleT hdl,
>> SaAmfProtectionGroupNotificationT_4 *notification) does not have
>> numberOfItems.
>> Agent does not know how many element in *notification, each of element
>> can hide a longDn inside it.
>>
>> Thanks,
>> Minh
>>
>>
>> On 22/08/16 15:04, praveen malviya wrote:
>>> Hi Minh,
>>>
>>> SaAmfProtectionGroupNotificationBufferT_4() contains numberOfItems to
>>> iterate over. In case of B.04.01, it should be simple as agent can
>>> call direclty osaf_extended_name_free() during iteration inside
>>> saAmfProtectionGroupNotificationFree_4(). So I think, only a for loop
>>> which will iterate over numberOfItems is required.
>>>
>>> Problem was in B.01.01 case, where application will have to iterate
>>> and free the memory. For this, Long has already suggested and that
>>> needs to be documented.
>>>
>>>
>>> Thanks,
>>> Praveen
>>>
>>>
>>> On 20-Aug-16 2:22 PM, minh chau wrote:
 Hi Long, Praveen,

 Regarding this TODO
 +  if(notification) {
 +// TODO (minhchau): memleak if notification is an array
 + osaf_extended_name_free(¬ification->member.compName);
  free(notification);
 +  }

 Client currently uses saAmfProtectionGroupNotificationFree_4(handle,
 buff->notification) to free the notification in buffer.
 If @buff->notification is a list of shortDn only, that should work as
 before, as agent will call this inside
 saAmfProtectionGroupNotificationFree_4

 /* free memory */
 if(notification)
 free(notification);

 It will cause memory leak if @buff->notification contains a list of
 longDN notifications.
 The leak is longDn of compName in each notification after the the 
 first
 one in the array @buff->notification.

 Agent can add a sentinel element when agent allocates
 @buff->notification, set this last element as NULL
 In Free() API, agent could iterate and free longDn in each element of
 array @buff->notification until agent reaches NULL element.

 Do you think it could work?
>>>

 Thanks,
 Minh

 On 19/08/16 21:13, Long Nguyen wrote:
> Hi Praveen,
>
> Please see my answers marked with [Long].
>
> Best regards,
> Long Nguyen.
>
> On 8/19/2016 6:01 PM, praveen malviya wrote:
>> Hi Long,
>>
>> I see one problem if B.01.01 application frees the memory in pg
>> tracking callback.
>> Please see inline.
>>
>> Thanks,
>> Praveen
>> On 19-Aug-16 12:00 PM, Long HB Nguyen wrote:
>>>  osaf/libs/agents/saf/amfa/amf_agent.cc | 1 +
>>>  osaf/libs/agents/saf/amfa/ava_hdl.cc   |  2 --
>>>  2 files changed, 1 insertions(+), 2 deletions(-)
>>>
>>>
>>> diff --git a/osaf/libs/agents/saf/amfa/amf_agent.cc
>>> b/osaf/libs/agents/saf/amfa/amf_agent.cc
>>> --- a/osaf/libs/agents/saf/amfa/amf_agent.cc
>>> +++ b/osaf/libs/agents/saf/amfa/amf_agent.cc
>>> @@ -2450,6 +2450,7 @@ SaAisErrorT AmfAgent::ProtectionGroupTra
>>> ava_cpy_protection_group_ntf(buf->notification,
>>> rsp_buf->notification,
>>> buf->numberOfItems,
>>> SA_AMF_HARS_READY_FOR_ASSIGNMENT);
>>>rc = SA_AIS_ERR_NO_SPACE;
>>> +  buf->numberOfIt

Re: [devel] [PATCH 6 of 8] cpsv: Apply new messages supporting extended SaNameT to CPD, CPND, and CPA [#1574] v4

2016-08-21 Thread A V Mahesh
Hi Hoang,

ACK for  [PATCH 6 of 8]  with following minor comment
I think CPND should return SA_AIS_ERR_TOO_BIG = 26 instead of
SA_AIS_ERR_INVALID_PARAM ( please sync-up with other service return 
values ).

Note : tested default functionality , LONG DN functionality not tested 
in full fledged

-AVM


On 8/18/2016 12:48 PM, Hoang Vo wrote:
>   osaf/libs/agents/saf/cpa/cpa_api.c  |  12 
>   osaf/libs/agents/saf/cpa/cpa_mds.c  |   2 +-
>   osaf/libs/common/cpsv/cpsv_evt.c|   1 +
>   osaf/services/saf/cpsv/cpd/cpd_proc.c   |   2 +-
>   osaf/services/saf/cpsv/cpnd/cpnd_evt.c  |   2 ++
>   osaf/services/saf/cpsv/cpnd/cpnd_proc.c |   2 +-
>   6 files changed, 18 insertions(+), 3 deletions(-)
>
>
> diff --git a/osaf/libs/agents/saf/cpa/cpa_api.c 
> b/osaf/libs/agents/saf/cpa/cpa_api.c
> --- a/osaf/libs/agents/saf/cpa/cpa_api.c
> +++ b/osaf/libs/agents/saf/cpa/cpa_api.c
> @@ -880,6 +880,10 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
>   }
>   
>   ckpt_name = osaf_extended_name_borrow(checkpointName);
> + if (strlen(ckpt_name) >= kOsafMaxDnLength) {
> + TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_INVALID_PARAM);
> + return SA_AIS_ERR_INVALID_PARAM;
> + }
>   
>   /* SA_AIS_ERR_INVALID_PARAM, bullet 4 in SAI-AIS-CKPT-B.02.02
>  Section 3.6.1 saCkptCheckpointOpen() and 
> saCkptCheckpointOpenAsync(), Return Values */
> @@ -1192,6 +1196,10 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa
>   }
>   
>   ckpt_name = osaf_extended_name_borrow(checkpointName);
> + if (strlen(ckpt_name) >= kOsafMaxDnLength) {
> + TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_INVALID_PARAM);
> + return SA_AIS_ERR_INVALID_PARAM;
> + }
>   
>   /* SA_AIS_ERR_INVALID_PARAM, bullet 4 in SAI-AIS-CKPT-B.02.02
>  Section 3.6.1 saCkptCheckpointOpen() and 
> saCkptCheckpointOpenAsync(), Return Values */
> @@ -1597,6 +1605,10 @@ SaAisErrorT saCkptCheckpointUnlink(SaCkp
>   }
>   
>   ckpt_name = osaf_extended_name_borrow(checkpointName);
> + if (strlen(ckpt_name) >= kOsafMaxDnLength) {
> + TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_INVALID_PARAM);
> + return SA_AIS_ERR_INVALID_PARAM;
> + }
>   
>   /* retrieve CPA CB */
>   m_CPA_RETRIEVE_CB(cb);
> diff --git a/osaf/libs/agents/saf/cpa/cpa_mds.c 
> b/osaf/libs/agents/saf/cpa/cpa_mds.c
> --- a/osaf/libs/agents/saf/cpa/cpa_mds.c
> +++ b/osaf/libs/agents/saf/cpa/cpa_mds.c
> @@ -515,9 +515,9 @@ static uint32_t cpa_mds_svc_evt(CPA_CB *
>  /* Populate & Send the Open Event to CPND */
>  memset(&evt, 0, sizeof(CPSV_EVT));
>  evt.type = CPSV_EVT_TYPE_CPND;
> -evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_LIST_UPDATE;
>  evt.info.cpnd.info.ckptListUpdate.client_hdl = 
> lc_node->cl_hdl;
>  osaf_extended_name_lend(lc_node->ckpt_name, 
> &evt.info.cpnd.info.ckptListUpdate.ckpt_name);
> +evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_LIST_UPDATE;
>   
>  proc_rc = cpa_mds_msg_send(cb->cpa_mds_hdl, 
> &cb->cpnd_mds_dest, &evt, NCSMDS_SVC_ID_CPND);
>   
> diff --git a/osaf/libs/common/cpsv/cpsv_evt.c 
> b/osaf/libs/common/cpsv/cpsv_evt.c
> --- a/osaf/libs/common/cpsv/cpsv_evt.c
> +++ b/osaf/libs/common/cpsv/cpsv_evt.c
> @@ -2378,6 +2378,7 @@ static uint32_t cpsv_encode_extended_nam
>   if(!osaf_is_an_extended_name(name))
>   return NCSCC_RC_SUCCESS;
>   
> + TRACE("length = %d", name->length);
>   SaConstStringT value = osaf_extended_name_borrow(name);
>   uint16_t length = osaf_extended_name_length(name);
>   
> diff --git a/osaf/services/saf/cpsv/cpd/cpd_proc.c 
> b/osaf/services/saf/cpsv/cpd/cpd_proc.c
> --- a/osaf/services/saf/cpsv/cpd/cpd_proc.c
> +++ b/osaf/services/saf/cpsv/cpd/cpd_proc.c
> @@ -61,9 +61,9 @@ uint32_t cpd_noncolloc_ckpt_rep_create(C
>   /* Send the Replica create info to CPND */
>   memset(&send_evt, 0, sizeof(CPSV_EVT));
>   send_evt.type = CPSV_EVT_TYPE_CPND;
> - send_evt.info.cpnd.type = CPND_EVT_D2ND_CKPT_CREATE;
>   
>   osaf_extended_name_lend(map_info->ckpt_name, 
> &send_evt.info.cpnd.info.ckpt_create.ckpt_name);
> + send_evt.info.cpnd.type = CPND_EVT_D2ND_CKPT_CREATE;
>   
>   d2nd_info = &send_evt.info.cpnd.info.ckpt_create.ckpt_info;
>   
> diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c 
> b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
> --- a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
> +++ b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
> @@ -4638,6 +4638,8 @@ uint32_t cpnd_evt_destroy(CPSV_EVT *evt)
>   if 
> (osaf_is_an_extended_name(&evt->info.cpnd.info.ckptListUpdate.ckpt_name))
>   free((void 
> *)osaf_extended_name_borrow(&evt->info.cpnd.info.ckptListUpdate.ckpt_name));
>   } else if (evt->info.cpnd.type == CPND_EVT_D2ND_CKPT_CREATE) {
> + if (evt->info.cpnd.info.ckpt_create

Re: [devel] [PATCH 5 of 8] cpd: Add new mbcsv messages supporting extended SaNameT [#1574] v2

2016-08-21 Thread A V Mahesh
Hi Hoang,

ACK for   [PATCH 5 of 8]

Note : tested default functionality , LONG DN functionality not tested
in full fledged

-AVM


On 8/18/2016 12:48 PM, Hoang Vo wrote:
>   osaf/services/saf/cpsv/cpd/cpd_mbcsv.c |  22 ++
>   1 files changed, 22 insertions(+), 0 deletions(-)
>
>
> diff --git a/osaf/services/saf/cpsv/cpd/cpd_mbcsv.c 
> b/osaf/services/saf/cpsv/cpd/cpd_mbcsv.c
> --- a/osaf/services/saf/cpsv/cpd/cpd_mbcsv.c
> +++ b/osaf/services/saf/cpsv/cpd/cpd_mbcsv.c
> @@ -23,6 +23,8 @@
>   
> **/
>   
>   #include "cpd.h"
> +extern uint32_t cpsv_encode_extended_name(NCS_UBAID *uba, SaNameT *name);
> +extern uint32_t cpsv_decode_extended_name(NCS_UBAID *uba, SaNameT *name);
>   
>   
> /**
>* Name   : cpd_mbcsv_async_update
> @@ -385,6 +387,9 @@ uint32_t cpd_mbcsv_enc_async_update(CPD_
>   TRACE_4("edu exec async create failed");
>   rc = NCSCC_RC_FAILURE;
>   }
> +
> + cpsv_encode_extended_name(&arg->info.encode.io_uba, 
> &cpd_msg->info.ckpt_create.ckpt_name);
> +
>   break;
>   
>   case CPD_A2S_MSG_CKPT_UNLINK:
> @@ -395,6 +400,9 @@ uint32_t cpd_mbcsv_enc_async_update(CPD_
>   TRACE_4("edu exec async unlink failed");
>   rc = NCSCC_RC_FAILURE;
>   }
> +
> + cpsv_encode_extended_name(&arg->info.encode.io_uba, 
> &cpd_msg->info.ckpt_ulink.ckpt_name);
> +
>   break;
>   
>   case CPD_A2S_MSG_CKPT_RDSET:
> @@ -573,6 +581,8 @@ uint32_t cpd_mbcsv_enc_msg_resp(CPD_CB *
>   TRACE_LEAVE();
>   return rc;
>   }
> + 
> + cpsv_encode_extended_name(&arg->info.encode.io_uba, 
> &ckpt_create.ckpt_name);
>   
>   if (ckpt_create.dest_list)
>   m_MMGR_FREE_CPSV_CPND_DEST_INFO(ckpt_create.dest_list);
> @@ -783,6 +793,9 @@ uint32_t cpd_mbcsv_dec_async_update(CPD_
>   rc = NCSCC_RC_FAILURE;
>   goto end;
>   }
> +
> + cpsv_decode_extended_name(&arg->info.decode.i_uba, 
> &ckpt_create->ckpt_name);
> +
>   cpd_msg->type = evt_type;
>   cpd_msg->info.ckpt_create = *ckpt_create;
>   rc = cpd_process_sb_msg(cb, cpd_msg);
> @@ -808,6 +821,9 @@ uint32_t cpd_mbcsv_dec_async_update(CPD_
>   rc = NCSCC_RC_FAILURE;
>   goto end;
>   }
> +
> + cpsv_decode_extended_name(&arg->info.decode.i_uba, 
> &ckpt_unlink->ckpt_name);
> +
>   cpd_msg->type = evt_type;
>   cpd_msg->info.ckpt_ulink = *ckpt_unlink;
>   rc = cpd_process_sb_msg(cb, cpd_msg);
> @@ -998,6 +1014,9 @@ uint32_t cpd_mbcsv_dec_sync_resp(CPD_CB
>   TRACE_LEAVE();
>   return rc;
>   }
> +
> + cpsv_decode_extended_name(&arg->info.decode.i_uba, 
> &ckpt_data->ckpt_name);
> +
>   mbcsv_msg.info.ckpt_create = *ckpt_data;
>   proc_rc = cpd_sb_proc_ckpt_create(cb, &mbcsv_msg);
>   if (proc_rc != NCSCC_RC_SUCCESS) {
> @@ -1007,6 +1026,9 @@ uint32_t cpd_mbcsv_dec_sync_resp(CPD_CB
>   if (ckpt_data->dest_list)
>   m_MMGR_FREE_CPSV_SYS_MEMORY(ckpt_data->dest_list);
>   
> + if (osaf_is_an_extended_name(&ckpt_data->ckpt_name))
> + free((void 
> *)osaf_extended_name_borrow(&ckpt_data->ckpt_name));
> +
>   memset(ckpt_data, 0, sizeof(CPD_A2S_CKPT_CREATE));
>   memset(&mbcsv_msg, 0, sizeof(CPD_MBCSV_MSG));
>   }


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


Re: [devel] [PATCH 4 of 8] cpsv: Add new message to support extended SaNameT [#1574] v3

2016-08-21 Thread A V Mahesh
Hi Hoang,

ACK for  [PATCH 4 of 8]   assuming unrequited comment code will be removed

Note : tested default functionality , LONG DN functionality not tested
in full fledged

-AVM


On 8/18/2016 12:48 PM, Hoang Vo wrote:
>   osaf/libs/common/cpsv/cpsv_evt.c |  439 
> +-
>   osaf/libs/common/cpsv/include/cpsv_evt.h |   10 +
>   osaf/services/saf/cpsv/cpd/cpd_mds.c |   84 +-
>   osaf/services/saf/cpsv/cpnd/cpnd_mds.c   |   86 +-
>   4 files changed, 581 insertions(+), 38 deletions(-)
>
>
> diff --git a/osaf/libs/common/cpsv/cpsv_evt.c 
> b/osaf/libs/common/cpsv/cpsv_evt.c
> --- a/osaf/libs/common/cpsv/cpsv_evt.c
> +++ b/osaf/libs/common/cpsv/cpsv_evt.c
> @@ -30,11 +30,14 @@
>   
>   #include "cpsv.h"
>   #include "cpa_tmr.h"
> +#include "osaf_extended_name.h"
>   
>   FUNC_DECLARATION(CPSV_CKPT_DATA);
>   static SaCkptSectionIdT *cpsv_evt_dec_sec_id(NCS_UBAID *i_ub, uint32_t 
> svc_id);
>   static uint32_t cpsv_evt_enc_sec_id(NCS_UBAID *o_ub, SaCkptSectionIdT 
> *sec_id);
>   static void cpsv_convert_sec_id_to_string(char *sec_id_str, 
> SaCkptSectionIdT *section_id);
> +static uint32_t cpsv_encode_extended_name_flat(NCS_UBAID *uba, SaNameT 
> *name);
> +static uint32_t cpsv_decode_extended_name_flat(NCS_UBAID *uba, SaNameT 
> *name);
>   
>   const char *cpa_evt_str[] = {
>   "STRING_0",
> @@ -254,8 +257,8 @@ char* cpsv_evt_str(CPSV_EVT *evt, char *
>   case CPND_EVT_A2ND_CKPT_OPEN:
>   {
>   CPSV_A2ND_OPEN_REQ *info = &evt->info.cpnd.info.openReq;
> - snprintf(o_evt_str, len, 
> "CPND_EVT_A2ND_CKPT_OPEN(hdl=%llu, %s)",
> - info->client_hdl, info->ckpt_name.value);
> + snprintf(o_evt_str, len, 
> "CPND_EVT_A2ND_CKPT_OPEN_2(hdl=%llu, %s)",
> + info->client_hdl, 
> osaf_extended_name_borrow(&info->ckpt_name));
>   break;
>   }
>   case CPND_EVT_A2ND_CKPT_CLOSE:
> @@ -268,7 +271,7 @@ char* cpsv_evt_str(CPSV_EVT *evt, char *
>   case CPND_EVT_A2ND_CKPT_UNLINK:
>   {
>   CPSV_A2ND_CKPT_UNLINK *info = 
> &evt->info.cpnd.info.ulinkReq;
> - snprintf(o_evt_str, len, 
> "CPND_EVT_A2ND_CKPT_UNLINK(%s)", info->ckpt_name.value);
> + snprintf(o_evt_str, len, 
> "CPND_EVT_A2ND_CKPT_UNLINK_2(%s)", 
> osaf_extended_name_borrow(&info->ckpt_name));
>   break;
>   }
>   case CPND_EVT_A2ND_CKPT_RDSET:
> @@ -513,12 +516,22 @@ char* cpsv_evt_str(CPSV_EVT *evt, char *
>   case CPND_EVT_D2ND_CKPT_CREATE:
>   {
>   CPSV_D2ND_CKPT_CREATE *info = 
> &evt->info.cpnd.info.ckpt_create;
> - snprintf(o_evt_str, len, "[%llu] 
> CPND_EVT_D2ND_CKPT_CREATE(%s, create_rep=%s, active=0x%X)",
> - info->ckpt_info.ckpt_id, info->ckpt_name.value,
> + snprintf(o_evt_str, len, "[%llu] 
> CPND_EVT_D2ND_CKPT_CREATE_2(%s, create_rep=%s, is_act=%s, active=0x%X, 
> dest_cnt=%d)",
> + info->ckpt_info.ckpt_id, 
> osaf_extended_name_borrow(&info->ckpt_name),
>   info->ckpt_info.ckpt_rep_create ? "true" : 
> "false",
> - 
> m_NCS_NODE_ID_FROM_MDS_DEST(info->ckpt_info.active_dest));
> + info->ckpt_info.is_active_exists ? "true" : 
> "false",
> + 
> m_NCS_NODE_ID_FROM_MDS_DEST(info->ckpt_info.active_dest),
> + info->ckpt_info.dest_cnt);
> +
> + SaCkptCheckpointCreationAttributesT *attr = 
> &info->ckpt_info.attributes;
> + TRACE("mSecS=%lld, flags=%d, mSec=%d, mSecIdS=%lld, 
> ret=%lld, ckptS=%lld", attr->maxSectionSize,
> + attr->creationFlags, attr->maxSections, 
> attr->maxSectionIdSize, attr->retentionDuration,
> + attr->checkpointSize);
> + for (int i = 0; i < info->ckpt_info.dest_cnt; i++)
> + TRACE("dest[%d] = 0x%" PRIX64 " ", i, 
> info->ckpt_info.dest_list[i].dest);
>   break;
>   }
> +
>   case CPND_EVT_D2ND_CKPT_DESTROY:
>   {
>   snprintf(o_evt_str, len, "[%llu] 
> CPND_EVT_D2ND_CKPT_DESTROY", evt->info.cpnd.info.ckpt_destroy.ckpt_id);
> @@ -608,8 +621,8 @@ char* cpsv_evt_str(CPSV_EVT *evt, char *
>   case CPND_EVT_A2ND_CKPT_LIST_UPDATE:
>   {
>   CPSV_A2ND_CKPT_LIST_UPDATE *info = 
> &evt->info.cpnd.info.ckptListUpdate;
> - snprintf(o_evt_str, len, 
> "CPND_EVT_A2ND_CKPT_LIST_UPDATE(hdl=%llu, %s)",
> - info->client_hdl, info->ckpt_name.value);
> + snprintf(o_evt_str, len, 
> "CPND_EVT_A2ND_CK

Re: [devel] [PATCH 3 of 8] cpa: Add support for extended SaNameT [#1574] v1

2016-08-21 Thread A V Mahesh
Hi Hoang,

ACK for  [PATCH 3 of 8]   with following minor comment
I think API should return SA_AIS_ERR_TOO_BIG = 26 instead of
SA_AIS_ERR_INVALID_PARAM ( please sync-up with other service return 
values ).

Note : tested default functionality , LONG DN functionality not tested 
in full fledged

-AVM

On 8/18/2016 12:48 PM, Hoang Vo wrote:
>   osaf/libs/agents/saf/cpa/Makefile.am |   1 +
>   osaf/libs/agents/saf/cpa/cpa_api.c   |  36 
> 
>   osaf/libs/agents/saf/cpa/cpa_db.c|   2 +
>   osaf/libs/agents/saf/cpa/cpa_mds.c   |   2 +-
>   osaf/libs/agents/saf/cpa/cpa_proc.c  |   2 +-
>   osaf/libs/common/cpsv/include/cpa.h  |   1 +
>   osaf/libs/common/cpsv/include/cpa_cb.h   |   2 +-
>   osaf/libs/common/cpsv/include/cpa_proc.h |   2 +-
>   8 files changed, 26 insertions(+), 22 deletions(-)
>
>
> diff --git a/osaf/libs/agents/saf/cpa/Makefile.am 
> b/osaf/libs/agents/saf/cpa/Makefile.am
> --- a/osaf/libs/agents/saf/cpa/Makefile.am
> +++ b/osaf/libs/agents/saf/cpa/Makefile.am
> @@ -22,6 +22,7 @@ noinst_LTLIBRARIES = libcpa.la
>   
>   libcpa_la_CPPFLAGS = \
>   -DNCS_CPA=1 \
> + -DSA_EXTENDED_NAME_SOURCE \
>   $(AM_CPPFLAGS) \
>   -I$(top_srcdir)/osaf/libs/common/cpsv/include
>   
> diff --git a/osaf/libs/agents/saf/cpa/cpa_api.c 
> b/osaf/libs/agents/saf/cpa/cpa_api.c
> --- a/osaf/libs/agents/saf/cpa/cpa_api.c
> +++ b/osaf/libs/agents/saf/cpa/cpa_api.c
> @@ -870,19 +870,20 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
>   bool locked = false;
>   uint32_t time_out=0;
>   CPA_GLOBAL_CKPT_NODE *gc_node = NULL;
> + SaConstStringT ckpt_name = NULL;
>   
>   TRACE_ENTER2("SaCkptCheckpointHandleT passed is %llx",ckptHandle);
> - if ((checkpointName == NULL) || (checkpointHandle == NULL) || 
> (checkpointName->length == 0)) {
> + if ((checkpointName == NULL) || (checkpointHandle == NULL) || 
> (osaf_extended_name_length(checkpointName) == 0)) {
>   TRACE_4("Cpa CkptOpen Api failed with return 
> value:%d,ckptHandle:%llx", SA_AIS_ERR_INVALID_PARAM, ckptHandle);
>   TRACE_LEAVE2("API return code = %u", rc);
>   return SA_AIS_ERR_INVALID_PARAM;
>   }
>   
> - m_CPSV_SET_SANAMET(checkpointName);
> + ckpt_name = osaf_extended_name_borrow(checkpointName);
>   
>   /* SA_AIS_ERR_INVALID_PARAM, bullet 4 in SAI-AIS-CKPT-B.02.02
>  Section 3.6.1 saCkptCheckpointOpen() and 
> saCkptCheckpointOpenAsync(), Return Values */
> -if (strncmp((const char *)checkpointName->value, "safCkpt=", 8) != 
> 0) {
> +if (strncmp(ckpt_name, "safCkpt=", 8) != 0) {
>   TRACE_4("Cpa CkptOpen:DN failed with return 
> value:%d,ckptHandle:%llx", SA_AIS_ERR_INVALID_PARAM, ckptHandle);
>   TRACE_LEAVE2("API return code = %u", rc);
>   return SA_AIS_ERR_INVALID_PARAM;
[AVM] I think this should return SA_AIS_ERR_TOO_BIG = 26 ( please 
sync-up with other service return values )
> @@ -909,7 +910,7 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
>   
>   
>   /* Draft Validations */
> - rc = cpa_open_attr_validate(checkpointCreationAttributes, 
> checkpointOpenFlags, checkpointName);
> + rc = cpa_open_attr_validate(checkpointCreationAttributes, 
> checkpointOpenFlags);
>   if (rc != SA_AIS_OK) {
>   /* No need to log, already logged inside the 
> cpa_open_attr_validate */
>   goto done;
> @@ -965,7 +966,7 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
>   lc_node->cl_hdl = ckptHandle;
>   lc_node->open_flags = checkpointOpenFlags;
>   
> - lc_node->ckpt_name = *checkpointName;
> + lc_node->ckpt_name = strdup(ckpt_name);
>   
>   /* Add CPA_LOCAL_CKPT_NODE to lcl_ckpt_hdl_tree */
>   proc_rc = cpa_lcl_ckpt_node_add(&cb->lcl_ckpt_tree, lc_node);
> @@ -984,7 +985,7 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
>   evt.info.cpnd.info.openReq.client_hdl = ckptHandle;
>   evt.info.cpnd.info.openReq.lcl_ckpt_hdl = lc_node->lcl_ckpt_hdl;
>   
> - evt.info.cpnd.info.openReq.ckpt_name = *checkpointName;
> + osaf_extended_name_lend(ckpt_name, 
> &evt.info.cpnd.info.openReq.ckpt_name);
>   
>   if (checkpointCreationAttributes) {
>   evt.info.cpnd.info.openReq.ckpt_attrib = 
> *checkpointCreationAttributes;
> @@ -1128,6 +1129,7 @@ gl_node_add_fail:
>   
>lc_node_add_fail:
>   if (lc_node != NULL) {
> + free((void *)lc_node->ckpt_name);
>   m_MMGR_FREE_CPA_LOCAL_CKPT_NODE(lc_node);
>   }
>   
> @@ -1179,6 +1181,7 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa
>   CPA_LOCAL_CKPT_NODE *lc_node = NULL;
>   CPA_CLIENT_NODE *cl_node = NULL;
>   uint32_t proc_rc = NCSCC_RC_SUCCESS;
> + SaConstStringT ckpt_name = NULL;
>   
>   TRACE_ENTER2("SaCkptCheckpointHandleT passed is %llx",ckptHandle);
>   
> @@ -1188,19 +1191,17 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa
>   return SA_AIS_E

Re: [devel] [PATCH 1 of 1] amfnd: remove used code in util.cc [#1642]

2016-08-21 Thread praveen malviya
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_csic

Re: [devel] [PATCH 1 of 1] amfa: fixed freeing notification buff [#1642]

2016-08-21 Thread praveen malviya
Hi,
The callback looks like this:
typedef void
(*SaAmfProtectionGroupTrackCallbackT_4)(
 const SaNameT *csiName,
 SaAmfProtectionGroupNotificationBufferT_4 *notificationBuffer,
 SaUint32T numberOfMembers,
 SaAisErrorT error);

Inside this callback, application is supposed to call 
saAmfProtectionGroupNotificationFree_4(). So agent must be able to 
deduce this information as SaAmfProtectionGroupNotificationBufferT_4 
contains numberOfItems and also numberOfMembers is available from callback.
Since B.04.01 APIs are not fully implemented, agent copies from old type 
of structure to new type in ava_cpy_protection_group_ntf().


Thanks,
Praveen

On 22-Aug-16 10:51 AM, minh chau wrote:
> Hi Praveen,
>
> The problem with B.04.01 is the API:
> saAmfProtectionGroupNotificationFree_4(SaAmfHandleT hdl,
> SaAmfProtectionGroupNotificationT_4 *notification) does not have
> numberOfItems.
> Agent does not know how many element in *notification, each of element
> can hide a longDn inside it.
>
> Thanks,
> Minh
>
>
> On 22/08/16 15:04, praveen malviya wrote:
>> Hi Minh,
>>
>> SaAmfProtectionGroupNotificationBufferT_4() contains numberOfItems to
>> iterate over. In case of B.04.01, it should be simple as agent can
>> call direclty osaf_extended_name_free() during iteration inside
>> saAmfProtectionGroupNotificationFree_4(). So I think, only a for loop
>> which will iterate over numberOfItems is required.
>>
>> Problem was in B.01.01 case, where application will have to iterate
>> and free the memory. For this, Long has already suggested and that
>> needs to be documented.
>>
>>
>> Thanks,
>> Praveen
>>
>>
>> On 20-Aug-16 2:22 PM, minh chau wrote:
>>> Hi Long, Praveen,
>>>
>>> Regarding this TODO
>>> +  if(notification) {
>>> +// TODO (minhchau): memleak if notification is an array
>>> + osaf_extended_name_free(¬ification->member.compName);
>>>  free(notification);
>>> +  }
>>>
>>> Client currently uses saAmfProtectionGroupNotificationFree_4(handle,
>>> buff->notification) to free the notification in buffer.
>>> If @buff->notification is a list of shortDn only, that should work as
>>> before, as agent will call this inside
>>> saAmfProtectionGroupNotificationFree_4
>>>
>>> /* free memory */
>>> if(notification)
>>> free(notification);
>>>
>>> It will cause memory leak if @buff->notification contains a list of
>>> longDN notifications.
>>> The leak is longDn of compName in each notification after the the first
>>> one in the array @buff->notification.
>>>
>>> Agent can add a sentinel element when agent allocates
>>> @buff->notification, set this last element as NULL
>>> In Free() API, agent could iterate and free longDn in each element of
>>> array @buff->notification until agent reaches NULL element.
>>>
>>> Do you think it could work?
>>
>>>
>>> Thanks,
>>> Minh
>>>
>>> On 19/08/16 21:13, Long Nguyen wrote:
 Hi Praveen,

 Please see my answers marked with [Long].

 Best regards,
 Long Nguyen.

 On 8/19/2016 6:01 PM, praveen malviya wrote:
> Hi Long,
>
> I see one problem if B.01.01 application frees the memory in pg
> tracking callback.
> Please see inline.
>
> Thanks,
> Praveen
> On 19-Aug-16 12:00 PM, Long HB Nguyen wrote:
>>  osaf/libs/agents/saf/amfa/amf_agent.cc | 1 +
>>  osaf/libs/agents/saf/amfa/ava_hdl.cc   |  2 --
>>  2 files changed, 1 insertions(+), 2 deletions(-)
>>
>>
>> diff --git a/osaf/libs/agents/saf/amfa/amf_agent.cc
>> b/osaf/libs/agents/saf/amfa/amf_agent.cc
>> --- a/osaf/libs/agents/saf/amfa/amf_agent.cc
>> +++ b/osaf/libs/agents/saf/amfa/amf_agent.cc
>> @@ -2450,6 +2450,7 @@ SaAisErrorT AmfAgent::ProtectionGroupTra
>> ava_cpy_protection_group_ntf(buf->notification,
>> rsp_buf->notification,
>> buf->numberOfItems,
>> SA_AMF_HARS_READY_FOR_ASSIGNMENT);
>>rc = SA_AIS_ERR_NO_SPACE;
>> +  buf->numberOfItems = rsp_buf->numberOfItems;
>>  }
>>} else {/* if(create_memory == false) */
>>
>> diff --git a/osaf/libs/agents/saf/amfa/ava_hdl.cc
>> b/osaf/libs/agents/saf/amfa/ava_hdl.cc
>> --- a/osaf/libs/agents/saf/amfa/ava_hdl.cc
>> +++ b/osaf/libs/agents/saf/amfa/ava_hdl.cc
>> @@ -697,7 +697,6 @@ uint32_t ava_hdl_cbk_rec_prc(AVSV_AMF_CB
>> ((SaAmfCallbacksT_4*)reg_cbk)->saAmfProtectionGroupTrackCallback(&pg_track->csi_name,
>>
>>
>> &buf,
>> pg_track->mem_num, pg_track->err);
>> -free(buf.notification);
>>  } else {
>>  pg_track->err = SA_AIS_ERR_NO_MEMORY;
>>  LOG_CR("Notification is NULL: Invoking
>> PGTrack Callback with error SA_AIS_ERR_NO_MEMORY");
>> @@ -740,7 +739,6 @@ uint32_t ava_hdl_cbk_rec_prc(AVSV_AMF_CB
>>  ((SaAmfCallbacksT
>> *)reg_cbk)->saAmfProtectionGroupTrackCallback(&pg_track->csi_name,
>>>

Re: [devel] [PATCH 1 of 1] amfa: fixed freeing notification buff [#1642]

2016-08-21 Thread minh chau
Hi Praveen,

The problem with B.04.01 is the API: 
saAmfProtectionGroupNotificationFree_4(SaAmfHandleT hdl, 
SaAmfProtectionGroupNotificationT_4 *notification) does not have 
numberOfItems.
Agent does not know how many element in *notification, each of element 
can hide a longDn inside it.

Thanks,
Minh


On 22/08/16 15:04, praveen malviya wrote:
> Hi Minh,
>
> SaAmfProtectionGroupNotificationBufferT_4() contains numberOfItems to 
> iterate over. In case of B.04.01, it should be simple as agent can 
> call direclty osaf_extended_name_free() during iteration inside 
> saAmfProtectionGroupNotificationFree_4(). So I think, only a for loop 
> which will iterate over numberOfItems is required.
>
> Problem was in B.01.01 case, where application will have to iterate 
> and free the memory. For this, Long has already suggested and that 
> needs to be documented.
>
>
> Thanks,
> Praveen
>
>
> On 20-Aug-16 2:22 PM, minh chau wrote:
>> Hi Long, Praveen,
>>
>> Regarding this TODO
>> +  if(notification) {
>> +// TODO (minhchau): memleak if notification is an array
>> + osaf_extended_name_free(¬ification->member.compName);
>>  free(notification);
>> +  }
>>
>> Client currently uses saAmfProtectionGroupNotificationFree_4(handle,
>> buff->notification) to free the notification in buffer.
>> If @buff->notification is a list of shortDn only, that should work as
>> before, as agent will call this inside
>> saAmfProtectionGroupNotificationFree_4
>>
>> /* free memory */
>> if(notification)
>> free(notification);
>>
>> It will cause memory leak if @buff->notification contains a list of
>> longDN notifications.
>> The leak is longDn of compName in each notification after the the first
>> one in the array @buff->notification.
>>
>> Agent can add a sentinel element when agent allocates
>> @buff->notification, set this last element as NULL
>> In Free() API, agent could iterate and free longDn in each element of
>> array @buff->notification until agent reaches NULL element.
>>
>> Do you think it could work?
>
>>
>> Thanks,
>> Minh
>>
>> On 19/08/16 21:13, Long Nguyen wrote:
>>> Hi Praveen,
>>>
>>> Please see my answers marked with [Long].
>>>
>>> Best regards,
>>> Long Nguyen.
>>>
>>> On 8/19/2016 6:01 PM, praveen malviya wrote:
 Hi Long,

 I see one problem if B.01.01 application frees the memory in pg
 tracking callback.
 Please see inline.

 Thanks,
 Praveen
 On 19-Aug-16 12:00 PM, Long HB Nguyen wrote:
>  osaf/libs/agents/saf/amfa/amf_agent.cc | 1 +
>  osaf/libs/agents/saf/amfa/ava_hdl.cc   |  2 --
>  2 files changed, 1 insertions(+), 2 deletions(-)
>
>
> diff --git a/osaf/libs/agents/saf/amfa/amf_agent.cc
> b/osaf/libs/agents/saf/amfa/amf_agent.cc
> --- a/osaf/libs/agents/saf/amfa/amf_agent.cc
> +++ b/osaf/libs/agents/saf/amfa/amf_agent.cc
> @@ -2450,6 +2450,7 @@ SaAisErrorT AmfAgent::ProtectionGroupTra
> ava_cpy_protection_group_ntf(buf->notification,
> rsp_buf->notification,
> buf->numberOfItems,
> SA_AMF_HARS_READY_FOR_ASSIGNMENT);
>rc = SA_AIS_ERR_NO_SPACE;
> +  buf->numberOfItems = rsp_buf->numberOfItems;
>  }
>} else {/* if(create_memory == false) */
>
> diff --git a/osaf/libs/agents/saf/amfa/ava_hdl.cc
> b/osaf/libs/agents/saf/amfa/ava_hdl.cc
> --- a/osaf/libs/agents/saf/amfa/ava_hdl.cc
> +++ b/osaf/libs/agents/saf/amfa/ava_hdl.cc
> @@ -697,7 +697,6 @@ uint32_t ava_hdl_cbk_rec_prc(AVSV_AMF_CB
> ((SaAmfCallbacksT_4*)reg_cbk)->saAmfProtectionGroupTrackCallback(&pg_track->csi_name,
>  
>
>
> &buf,
> pg_track->mem_num, pg_track->err);
> -free(buf.notification);
>  } else {
>  pg_track->err = SA_AIS_ERR_NO_MEMORY;
>  LOG_CR("Notification is NULL: Invoking
> PGTrack Callback with error SA_AIS_ERR_NO_MEMORY");
> @@ -740,7 +739,6 @@ uint32_t ava_hdl_cbk_rec_prc(AVSV_AMF_CB
>  ((SaAmfCallbacksT
> *)reg_cbk)->saAmfProtectionGroupTrackCallback(&pg_track->csi_name,
> &buf,
> pg_track->mem_num, pg_track->err);
> -free(buf.notification);
 For B.04.01 API, saAmfProtectionGroupNotificationFree_4() is taking
 care of freeing any extended name. For
 saAmfProtectionGroupNotificationFree(), it is the application's
 responsibility to free the memory. But how it will free any extended
 name.
 I think there is no API equivalent to osaf_extended_name_free() for
 application. Is there any way?
 [Long] I think we can do somethings like in applications:
 if (strlen(saAisNameBorrow(buff.notification[i].member.comp_name)) >
 SA_MAX_UNEXTENDED_NAME_LENGTH)
 free(saAisNameBorrow(buff.notification[i].member.comp_name));

 Otherwise we can document it that:
>

Re: [devel] [PATCH 1 of 1] amfa: fixed freeing notification buff [#1642]

2016-08-21 Thread praveen malviya
Hi Minh,

SaAmfProtectionGroupNotificationBufferT_4() contains numberOfItems to 
iterate over. In case of B.04.01, it should be simple as agent can call 
direclty osaf_extended_name_free() during iteration inside 
saAmfProtectionGroupNotificationFree_4(). So I think, only a for loop 
which will iterate over numberOfItems is required.

Problem was in B.01.01 case, where application will have to iterate and 
free the memory. For this, Long has already suggested and that needs to 
be documented.


Thanks,
Praveen


On 20-Aug-16 2:22 PM, minh chau wrote:
> Hi Long, Praveen,
>
> Regarding this TODO
> +  if(notification) {
> +// TODO (minhchau): memleak if notification is an array
> +osaf_extended_name_free(¬ification->member.compName);
>  free(notification);
> +  }
>
> Client currently uses saAmfProtectionGroupNotificationFree_4(handle,
> buff->notification) to free the notification in buffer.
> If @buff->notification is a list of shortDn only, that should work as
> before, as agent will call this inside
> saAmfProtectionGroupNotificationFree_4
>
> /* free memory */
> if(notification)
> free(notification);
>
> It will cause memory leak if @buff->notification contains a list of
> longDN notifications.
> The leak is longDn of compName in each notification after the the first
> one in the array @buff->notification.
>
> Agent can add a sentinel element when agent allocates
> @buff->notification, set this last element as NULL
> In Free() API, agent could iterate and free longDn in each element of
> array @buff->notification until agent reaches NULL element.
>
> Do you think it could work?

>
> Thanks,
> Minh
>
> On 19/08/16 21:13, Long Nguyen wrote:
>> Hi Praveen,
>>
>> Please see my answers marked with [Long].
>>
>> Best regards,
>> Long Nguyen.
>>
>> On 8/19/2016 6:01 PM, praveen malviya wrote:
>>> Hi Long,
>>>
>>> I see one problem if B.01.01 application frees the memory in pg
>>> tracking callback.
>>> Please see inline.
>>>
>>> Thanks,
>>> Praveen
>>> On 19-Aug-16 12:00 PM, Long HB Nguyen wrote:
  osaf/libs/agents/saf/amfa/amf_agent.cc | 1 +
  osaf/libs/agents/saf/amfa/ava_hdl.cc   |  2 --
  2 files changed, 1 insertions(+), 2 deletions(-)


 diff --git a/osaf/libs/agents/saf/amfa/amf_agent.cc
 b/osaf/libs/agents/saf/amfa/amf_agent.cc
 --- a/osaf/libs/agents/saf/amfa/amf_agent.cc
 +++ b/osaf/libs/agents/saf/amfa/amf_agent.cc
 @@ -2450,6 +2450,7 @@ SaAisErrorT AmfAgent::ProtectionGroupTra
ava_cpy_protection_group_ntf(buf->notification,
 rsp_buf->notification,
 buf->numberOfItems,
 SA_AMF_HARS_READY_FOR_ASSIGNMENT);
rc = SA_AIS_ERR_NO_SPACE;
 +  buf->numberOfItems = rsp_buf->numberOfItems;
  }
} else {/* if(create_memory == false) */

 diff --git a/osaf/libs/agents/saf/amfa/ava_hdl.cc
 b/osaf/libs/agents/saf/amfa/ava_hdl.cc
 --- a/osaf/libs/agents/saf/amfa/ava_hdl.cc
 +++ b/osaf/libs/agents/saf/amfa/ava_hdl.cc
 @@ -697,7 +697,6 @@ uint32_t ava_hdl_cbk_rec_prc(AVSV_AMF_CB
 ((SaAmfCallbacksT_4*)reg_cbk)->saAmfProtectionGroupTrackCallback(&pg_track->csi_name,

  &buf,
 pg_track->mem_num, pg_track->err);
 -free(buf.notification);
  } else {
  pg_track->err = SA_AIS_ERR_NO_MEMORY;
  LOG_CR("Notification is NULL: Invoking
 PGTrack Callback with error SA_AIS_ERR_NO_MEMORY");
 @@ -740,7 +739,6 @@ uint32_t ava_hdl_cbk_rec_prc(AVSV_AMF_CB
  ((SaAmfCallbacksT
 *)reg_cbk)->saAmfProtectionGroupTrackCallback(&pg_track->csi_name,
 &buf,
 pg_track->mem_num, pg_track->err);
 -free(buf.notification);
>>> For B.04.01 API, saAmfProtectionGroupNotificationFree_4() is taking
>>> care of freeing any extended name. For
>>> saAmfProtectionGroupNotificationFree(), it is the application's
>>> responsibility to free the memory. But how it will free any extended
>>> name.
>>> I think there is no API equivalent to osaf_extended_name_free() for
>>> application. Is there any way?
>>> [Long] I think we can do somethings like in applications:
>>> if (strlen(saAisNameBorrow(buff.notification[i].member.comp_name)) >
>>> SA_MAX_UNEXTENDED_NAME_LENGTH)
>>> free(saAisNameBorrow(buff.notification[i].member.comp_name));
>>>
>>> Otherwise we can document it that:
>>> -if compName is not long dn in the notification buffer, then
>>> application has to free the memory.This will provide backward
>>> compatibility and spec compliance.
>>>
>>>  -if compName is longdn in notification then application should not
>>> free the memory. Agent will free the memory after callback is
>>> completed. So any B.01.01 application adapting to long dn will take
>>> care

Re: [devel] [PATCH 1 of 1] cpa: remove multiple sync_send() calls in case of multiple vector write [#1849]

2016-08-21 Thread A V Mahesh
Hi Hoang,

This fix is a just rollback of problem introduced in change-set 7101
and will fixed in all  4.7.x to 5.0.x & default.

-AVM

On 8/22/2016 8:18 AM, Vo Minh Hoang wrote:
> Dear Mahesh,
>
> I would like to send my ideal about this.
> Please consider it.
>
> - I'm agree this modification will enhance writing performance.
> - I checked opensaf-4.7.x both newest changeset (7886) and tested changeset
> (7640) and found the same source code. So I think that this fixing will not
> solve the problem of performance degradation from 4.7.x to 5.0.x.
>
> Thank you and best regards,
> Hoang
>
> -Original Message-
> From: mahesh.va...@oracle.com [mailto:mahesh.va...@oracle.com]
> Sent: Thursday, August 18, 2016 4:10 PM
> To: nhat.p...@dektech.com.au; hoang.m...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 1] cpa: remove multiple sync_send() calls in case of
> multiple vector write [#1849]
>
>   osaf/libs/agents/saf/cpa/cpa_api.c |  17 -
>   1 files changed, 8 insertions(+), 9 deletions(-)
>
>
> Issue :
> In current saCkptCheckpointWrite() , in case of multiple ioVector  write
> case  ( > 1 ) multiple calls made for cpa_mds_msg_sync_send() , which is
> cause  performance issue .
>
> Fix :
> It is not required to call cpa_mds_msg_sync_send() multiple time , so fixed
> to call only once.
>
> diff --git a/osaf/libs/agents/saf/cpa/cpa_api.c
> b/osaf/libs/agents/saf/cpa/cpa_api.c
> --- a/osaf/libs/agents/saf/cpa/cpa_api.c
> +++ b/osaf/libs/agents/saf/cpa/cpa_api.c
> @@ -3523,17 +3523,16 @@ SaAisErrorT saCkptCheckpointWrite(SaCkpt
>   /* Unlock cpa_lock before calling mds api */
>   m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE);
>   
> - for (iter = 0; iter < numberOfElements; iter++) {
> + for (iter = 0; iter < numberOfElements; iter++)
>   all_ioVector_size += ioVector[iter].dataSize;
> - time_out = CPA_WAIT_TIME(all_ioVector_size);
> -
> - if (time_out < CPSV_WAIT_TIME) {
> - time_out = CPSV_WAIT_TIME;
> - }
> - proc_rc = cpa_mds_msg_sync_send(cb->cpa_mds_hdl,
> &(gc_node->active_mds_dest),
> + 
> + time_out = CPA_WAIT_TIME(all_ioVector_size);
> + if (time_out < CPSV_WAIT_TIME) {
> + time_out = CPSV_WAIT_TIME;
> + }
> + 
> + proc_rc = cpa_mds_msg_sync_send(cb->cpa_mds_hdl,
> +&(gc_node->active_mds_dest),
>   &evt, &out_evt, time_out);
> -
> - }
>   /* Generate rc from proc_rc */
>   switch (proc_rc)
>   {
>


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


Re: [devel] [PATCH 1 of 1] cpa: remove multiple sync_send() calls in case of multiple vector write [#1849]

2016-08-21 Thread Vo Minh Hoang
Dear Mahesh,

I would like to send my ideal about this.
Please consider it.

- I'm agree this modification will enhance writing performance.
- I checked opensaf-4.7.x both newest changeset (7886) and tested changeset
(7640) and found the same source code. So I think that this fixing will not
solve the problem of performance degradation from 4.7.x to 5.0.x.

Thank you and best regards,
Hoang

-Original Message-
From: mahesh.va...@oracle.com [mailto:mahesh.va...@oracle.com] 
Sent: Thursday, August 18, 2016 4:10 PM
To: nhat.p...@dektech.com.au; hoang.m...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] cpa: remove multiple sync_send() calls in case of
multiple vector write [#1849]

 osaf/libs/agents/saf/cpa/cpa_api.c |  17 -
 1 files changed, 8 insertions(+), 9 deletions(-)


Issue :
In current saCkptCheckpointWrite() , in case of multiple ioVector  write
case  ( > 1 ) multiple calls made for cpa_mds_msg_sync_send() , which is
cause  performance issue .

Fix :
It is not required to call cpa_mds_msg_sync_send() multiple time , so fixed
to call only once.

diff --git a/osaf/libs/agents/saf/cpa/cpa_api.c
b/osaf/libs/agents/saf/cpa/cpa_api.c
--- a/osaf/libs/agents/saf/cpa/cpa_api.c
+++ b/osaf/libs/agents/saf/cpa/cpa_api.c
@@ -3523,17 +3523,16 @@ SaAisErrorT saCkptCheckpointWrite(SaCkpt
/* Unlock cpa_lock before calling mds api */
m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE);
 
-   for (iter = 0; iter < numberOfElements; iter++) {
+   for (iter = 0; iter < numberOfElements; iter++)
all_ioVector_size += ioVector[iter].dataSize;
-   time_out = CPA_WAIT_TIME(all_ioVector_size);
- 
-   if (time_out < CPSV_WAIT_TIME) {
-   time_out = CPSV_WAIT_TIME;
-   }
-   proc_rc = cpa_mds_msg_sync_send(cb->cpa_mds_hdl,
&(gc_node->active_mds_dest),
+   
+   time_out = CPA_WAIT_TIME(all_ioVector_size);
+   if (time_out < CPSV_WAIT_TIME) {
+   time_out = CPSV_WAIT_TIME;
+   }
+   
+   proc_rc = cpa_mds_msg_sync_send(cb->cpa_mds_hdl, 
+&(gc_node->active_mds_dest),
&evt, &out_evt, time_out);
-
-   }
/* Generate rc from proc_rc */
switch (proc_rc)
{


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


Re: [devel] [PATCH 1 of 1] osaf: Fix name collision between OpenSAF CLC scripts and systemd scripts [#1921]

2016-08-21 Thread Mathivanan Naickan Palanivelu
Tested, Ack
Mathi.

> -Original Message-
> From: Anders Widell [mailto:anders.wid...@ericsson.com]
> Sent: Tuesday, July 19, 2016 7:33 PM
> To: Mathivanan Naickan Palanivelu
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 1] osaf: Fix name collision between OpenSAF CLC scripts
> and systemd scripts [#1921]
> 
>  osaf/services/infrastructure/dtms/scripts/osaf-dtm.in   |  28 
> +++---
>  osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor.in |  10 +-
>  osaf/services/infrastructure/dtms/scripts/osaf-transport.in |   4 +-
>  osaf/services/infrastructure/fm/fms/scripts/osaf-fmd.in |  18 
> ++--
>  osaf/services/infrastructure/nid/scripts/opensafd.in|  36 
> +-
>  osaf/services/infrastructure/rde/scripts/osaf-rded.in   |  20 
> ++--
>  osaf/services/saf/amf/amfd/scripts/osaf-amfd.in |  16 
> ++--
>  osaf/services/saf/amf/amfnd/scripts/osaf-amfnd.in   |  16 
> ++--
>  osaf/services/saf/amf/amfwdog/scripts/osaf-amfwd.in |  18 
> ++--
>  osaf/services/saf/clmsv/clms/scripts/osaf-clmd.in   |  18 
> ++--
>  osaf/services/saf/clmsv/nodeagent/scripts/osaf-clmna.in |  18 
> ++--
>  osaf/services/saf/cpsv/cpd/scripts/osaf-ckptd.in|  16 
> ++--
>  osaf/services/saf/cpsv/cpnd/scripts/osaf-ckptnd.in  |  18 
> ++--
>  osaf/services/saf/edsv/eds/scripts/osaf-evtd.in |  16 
> ++--
>  osaf/services/saf/glsv/gld/scripts/osaf-lckd.in |  16 
> ++--
>  osaf/services/saf/glsv/glnd/scripts/osaf-lcknd.in   |  18 
> ++--
>  osaf/services/saf/immsv/immd/scripts/osaf-immd.in   |  18 
> ++--
>  osaf/services/saf/immsv/immnd/scripts/osaf-immnd.in |  20 
> ++--
>  osaf/services/saf/logsv/lgs/scripts/osaf-logd.in|  18 
> ++--
>  osaf/services/saf/mqsv/mqd/scripts/osaf-msgd.in |  16 
> ++--
>  osaf/services/saf/mqsv/mqnd/scripts/osaf-msgnd.in   |  18 
> ++--
>  osaf/services/saf/ntfsv/ntfs/scripts/osaf-ntfd.in   |  18 
> ++--
>  osaf/services/saf/plmsv/plms/scripts/osaf-plmd.in   |  18 
> ++--
>  osaf/services/saf/smfsv/smfd/scripts/osaf-smfd.in   |  16 
> ++--
>  osaf/services/saf/smfsv/smfnd/scripts/osaf-smfnd.in |  18 
> ++--
>  25 files changed, 223 insertions(+), 223 deletions(-)
> 
> 
> Rename the shell environment variable "prog" to "osafprog" in the OpenSAF
> service CLC scripts, to avoid a name collition with a variable in the file
> /lib/lsb/init-functions.d/40-systemd which gets included when we source the
> file /lib/lsb/init-functions in Ubuntu 16.04
> 
> diff --git a/osaf/services/infrastructure/dtms/scripts/osaf-dtm.in
> b/osaf/services/infrastructure/dtms/scripts/osaf-dtm.in
> --- a/osaf/services/infrastructure/dtms/scripts/osaf-dtm.in
> +++ b/osaf/services/infrastructure/dtms/scripts/osaf-dtm.in
> @@ -13,7 +13,7 @@
>  ### END INIT INFO
> 
>  osafdirfile=@sysconfdir@/@PACKAGE_NAME@/osafdir.conf
> -prog="osafdtmd"
> +osafprog="osafdtmd"
>  initscript=`basename $0`
> 
>  # Source LSB functions library
> @@ -21,7 +21,7 @@ initscript=`basename $0`
> 
> 
>  if [ ! -r $osafdirfile ]; then
> - logger -s -t $prog "can't read $osafdirfile, exiting."
> + logger -s -t $osafprog "can't read $osafdirfile, exiting."
>   exit 6
>  else
>   . $osafdirfile
> @@ -29,8 +29,8 @@ else
>   . $pkgsysconfdir/nid.conf
>  fi
> 
> -binary=$pkglibdir/$prog
> -pidfile=$pkgpiddir/$prog.pid
> +binary=$pkglibdir/$osafprog
> +pidfile=$pkgpiddir/$osafprog.pid
>  lockfile=$lockdir/$initscript
> 
>  RETVAL=0
> @@ -41,7 +41,7 @@ start() {
>   return 5
>   fi
> 
> - echo -n "Starting $prog: "
> + echo -n "Starting $osafprog: "
>   start_daemon -p $pidfile $binary  $args
>   RETVAL=$?
>   if [ $RETVAL -eq 0 ]; then
> @@ -54,8 +54,8 @@ start() {
>  }
> 
>  stop() {
> - echo -n "Stopping $prog: "
> - killproc -p $pidfile $prog
> + echo -n "Stopping $osafprog: "
> + killproc -p $pidfile $osafprog
>   RETVAL=$?
>   if [ $RETVAL -eq 0 ] || [ $RETVAL -eq 7 ]; then
>   rm -f $lockfile
> @@ -78,9 +78,9 @@ tryrestart() {
>  }
> 
>  reload() {
> - echo -n "Reloading $prog: "
> + echo -n "Reloading $osafprog: "
>   log_warning_msg
> - logger -t $prog "reloading configuration is currently an
> unimplemented LSB feature"
> + logger -t $osafprog "reloading configuration is currently an
> unimplemented LSB feature"
>   return 3
>  }
> 
> @@ -94,16 +94,16 @@ status() {
>   pid=`pidofproc -p ${pidfile} ${binary}`
>   ret=$?
>   if [ $ret -eq 0 ]; then
> - log_success_msg "$prog is running"
> + log_success_msg "$osafprog is running"
>   return $ret
>   elif [ $ret -eq 1 ]; then
> - l

Re: [devel] [PATCH 1 of 1] amfnd: remove used code in util.cc [#1642]

2016-08-21 Thread Gary Lee
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;
> -}
> -
> -/*