Re: [devel] [PATCH 2 of 3] cpsv : update cpsv error handing based on leap changes [#2202]

2016-12-01 Thread A V Mahesh

Hi Ramesh,

- Most of the  your review comment are related to cpnd_ckpt_sec_write()
   in case of cpnd_ckpt_sec_write fail nothing to be rollback of any 
cktp/section recently/long back/just- created
   just need to report we are not able to write user data in to SHM, so 
that the user will re-write


   So No action required.

- Few of them addressed in #2207

- Other comment are addressed

Please find the attached updated patch for your reference .

-AVM

On 12/1/2016 12:08 PM, ramesh betham wrote:

Hi Mahesh,

Please find my review comments inline with [Ramesh].

Thanks,
Ramesh.

On 11/29/2016 4:07 PM, mahesh.va...@oracle.com wrote:

  osaf/libs/common/cpsv/include/cpnd_cb.h   |   4 +-
  osaf/libs/common/cpsv/include/cpnd_init.h |   8 +-
  osaf/libs/common/cpsv/include/cpnd_sec.h  |   2 +-
  osaf/libs/core/include/ncs_osprm.h|   2 +-
  osaf/services/saf/cpsv/cpnd/cpnd_db.c |  12 ++--
  osaf/services/saf/cpsv/cpnd/cpnd_evt.c|  82 +-
  osaf/services/saf/cpsv/cpnd/cpnd_proc.c   |  31 ++
  osaf/services/saf/cpsv/cpnd/cpnd_res.c|  24 +++--
  osaf/services/saf/cpsv/cpnd/cpnd_sec.cc   |  12 ++--
  9 files changed, 103 insertions(+), 74 deletions(-)


diff --git a/osaf/libs/common/cpsv/include/cpnd_cb.h 
b/osaf/libs/common/cpsv/include/cpnd_cb.h
--- a/osaf/libs/common/cpsv/include/cpnd_cb.h
+++ b/osaf/libs/common/cpsv/include/cpnd_cb.h
@@ -341,8 +341,8 @@ uint32_t cpnd_amf_register(CPND_CB *cpnd
  uint32_t cpnd_amf_deregister(CPND_CB *cpnd_cb);
  uint32_t cpnd_client_extract_bits(uint32_t bitmap_value, uint32_t 
*bit_position);
  uint32_t cpnd_res_ckpt_sec_del(CPND_CKPT_NODE *cp_node);
-uint32_t cpnd_ckpt_replica_create_res(NCS_OS_POSIX_SHM_REQ_INFO *open_req, 
char *buf, CPND_CKPT_NODE **cp_node,
-   uint32_t ref_cnt, CKPT_INFO 
*cp_info, bool shm_alloc_guaranteed);
+uint32_t cpnd_ckpt_replica_create_res(CPND_CB *cb, NCS_OS_POSIX_SHM_REQ_INFO 
*open_req, char *buf, CPND_CKPT_NODE **cp_node,
+   uint32_t ref_cnt, CKPT_INFO 
*cp_info);
  int32_t cpnd_find_free_loc(CPND_CB *cb, CPND_TYPE_INFO type);
  uint32_t cpnd_ckpt_write_header(CPND_CB *cb, uint32_t nckpts);
  uint32_t cpnd_cli_info_write_header(CPND_CB *cb, int32_t n_clients);
diff --git a/osaf/libs/common/cpsv/include/cpnd_init.h 
b/osaf/libs/common/cpsv/include/cpnd_init.h
--- a/osaf/libs/common/cpsv/include/cpnd_init.h
+++ b/osaf/libs/common/cpsv/include/cpnd_init.h
@@ -90,7 +90,7 @@ uint32_t cpnd_ckpt_replica_create(CPND_C
  uint32_t cpnd_ckpt_remote_cpnd_add(CPND_CKPT_NODE *cp_node, MDS_DEST 
mds_info);
  uint32_t cpnd_ckpt_remote_cpnd_del(CPND_CKPT_NODE *cp_node, MDS_DEST 
mds_info);
  int32_t cpnd_ckpt_get_lck_sec_id(CPND_CKPT_NODE *cp_node);
-uint32_t cpnd_ckpt_sec_write(CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO
+uint32_t cpnd_ckpt_sec_write(CPND_CB *cb, CPND_CKPT_NODE *cp_node, 
CPND_CKPT_SECTION_INFO
  *sec_info, const void *data, uint64_t size, uint64_t 
offset, uint32_t type);
  uint32_t cpnd_ckpt_sec_read(CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO
 *sec_info, void *data, uint64_t size, uint64_t offset);
@@ -164,7 +164,7 @@ void cpnd_evt_node_getnext(CPND_CB *cb,
  uint32_t cpnd_evt_node_add(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE 
*evt_node);
  uint32_t cpnd_evt_node_del(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE 
*evt_node);
  CPND_CKPT_NODE *cpnd_ckpt_node_find_by_name(CPND_CB *cpnd_cb, SaConstStringT 
ckpt_name);
-CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CKPT_NODE *cp_node, 
SaCkptSectionIdT *id, SaTimeT exp_time,
+CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CB *cb, CPND_CKPT_NODE 
*cp_node, SaCkptSectionIdT *id, SaTimeT exp_time,
  uint32_t gen_flag);
  void cpnd_evt_backup_queue_add(CPND_CKPT_NODE *cp_node, CPND_EVT *evt);
  uint32_t cpnd_ckpt_node_tree_init(CPND_CB *cb);
@@ -176,8 +176,8 @@ void cpnd_client_node_tree_cleanup(CPND_
  void cpnd_client_node_tree_destroy(CPND_CB *cb);
  void cpnd_allrepl_write_evt_node_tree_cleanup(CPND_CB *cb);
  void cpnd_allrepl_write_evt_node_tree_destroy(CPND_CB *cb);
-uint32_t cpnd_sec_hdr_update(CPND_CKPT_SECTION_INFO *pSecPtr, CPND_CKPT_NODE 
*cp_node);
-uint32_t cpnd_ckpt_hdr_update(CPND_CKPT_NODE *cp_node);
+uint32_t cpnd_sec_hdr_update(CPND_CB *cb, CPND_CKPT_SECTION_INFO *pSecPtr, 
CPND_CKPT_NODE *cp_node);
+uint32_t cpnd_ckpt_hdr_update(CPND_CB *cb, CPND_CKPT_NODE *cp_node);
  void cpnd_ckpt_node_destroy(CPND_CB *cb, CPND_CKPT_NODE *cp_node);
  uint32_t cpnd_get_slot_sub_slot_id_from_mds_dest(MDS_DEST dest);
  uint32_t cpnd_get_slot_sub_slot_id_from_node_id(NCS_NODE_ID i_node_id);
diff --git a/osaf/libs/common/cpsv/include/cpnd_sec.h 
b/osaf/libs/common/cpsv/include/cpnd_sec.h
--- a/osaf/libs/common/cpsv/include/cpnd_sec.h
+++ b/osaf/libs/common/cpsv/include/cpnd_sec.h
@@ -39,7 +39,7 @@ CPND_CKPT_SECTION_INFO *
  cpnd_ckpt_sec_get_create(const 

Re: [devel] [PATCH 2 of 3] cpsv : update cpsv error handing based on leap changes [#2202]

2016-11-30 Thread ramesh betham
Hi Mahesh,

Please find my review comments inline with [Ramesh].

Thanks,
Ramesh.

On 11/29/2016 4:07 PM, mahesh.va...@oracle.com wrote:
>   osaf/libs/common/cpsv/include/cpnd_cb.h   |   4 +-
>   osaf/libs/common/cpsv/include/cpnd_init.h |   8 +-
>   osaf/libs/common/cpsv/include/cpnd_sec.h  |   2 +-
>   osaf/libs/core/include/ncs_osprm.h|   2 +-
>   osaf/services/saf/cpsv/cpnd/cpnd_db.c |  12 ++--
>   osaf/services/saf/cpsv/cpnd/cpnd_evt.c|  82 
> +-
>   osaf/services/saf/cpsv/cpnd/cpnd_proc.c   |  31 ++
>   osaf/services/saf/cpsv/cpnd/cpnd_res.c|  24 +++--
>   osaf/services/saf/cpsv/cpnd/cpnd_sec.cc   |  12 ++--
>   9 files changed, 103 insertions(+), 74 deletions(-)
>
>
> diff --git a/osaf/libs/common/cpsv/include/cpnd_cb.h 
> b/osaf/libs/common/cpsv/include/cpnd_cb.h
> --- a/osaf/libs/common/cpsv/include/cpnd_cb.h
> +++ b/osaf/libs/common/cpsv/include/cpnd_cb.h
> @@ -341,8 +341,8 @@ uint32_t cpnd_amf_register(CPND_CB *cpnd
>   uint32_t cpnd_amf_deregister(CPND_CB *cpnd_cb);
>   uint32_t cpnd_client_extract_bits(uint32_t bitmap_value, uint32_t 
> *bit_position);
>   uint32_t cpnd_res_ckpt_sec_del(CPND_CKPT_NODE *cp_node);
> -uint32_t cpnd_ckpt_replica_create_res(NCS_OS_POSIX_SHM_REQ_INFO *open_req, 
> char *buf, CPND_CKPT_NODE **cp_node,
> - uint32_t ref_cnt, CKPT_INFO 
> *cp_info, bool shm_alloc_guaranteed);
> +uint32_t cpnd_ckpt_replica_create_res(CPND_CB *cb, NCS_OS_POSIX_SHM_REQ_INFO 
> *open_req, char *buf, CPND_CKPT_NODE **cp_node,
> + uint32_t ref_cnt, CKPT_INFO 
> *cp_info);
>   int32_t cpnd_find_free_loc(CPND_CB *cb, CPND_TYPE_INFO type);
>   uint32_t cpnd_ckpt_write_header(CPND_CB *cb, uint32_t nckpts);
>   uint32_t cpnd_cli_info_write_header(CPND_CB *cb, int32_t n_clients);
> diff --git a/osaf/libs/common/cpsv/include/cpnd_init.h 
> b/osaf/libs/common/cpsv/include/cpnd_init.h
> --- a/osaf/libs/common/cpsv/include/cpnd_init.h
> +++ b/osaf/libs/common/cpsv/include/cpnd_init.h
> @@ -90,7 +90,7 @@ uint32_t cpnd_ckpt_replica_create(CPND_C
>   uint32_t cpnd_ckpt_remote_cpnd_add(CPND_CKPT_NODE *cp_node, MDS_DEST 
> mds_info);
>   uint32_t cpnd_ckpt_remote_cpnd_del(CPND_CKPT_NODE *cp_node, MDS_DEST 
> mds_info);
>   int32_t cpnd_ckpt_get_lck_sec_id(CPND_CKPT_NODE *cp_node);
> -uint32_t cpnd_ckpt_sec_write(CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO
> +uint32_t cpnd_ckpt_sec_write(CPND_CB *cb, CPND_CKPT_NODE *cp_node, 
> CPND_CKPT_SECTION_INFO
> *sec_info, const void *data, uint64_t size, uint64_t 
> offset, uint32_t type);
>   uint32_t cpnd_ckpt_sec_read(CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO
>*sec_info, void *data, uint64_t size, uint64_t offset);
> @@ -164,7 +164,7 @@ void cpnd_evt_node_getnext(CPND_CB *cb,
>   uint32_t cpnd_evt_node_add(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE 
> *evt_node);
>   uint32_t cpnd_evt_node_del(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE 
> *evt_node);
>   CPND_CKPT_NODE *cpnd_ckpt_node_find_by_name(CPND_CB *cpnd_cb, 
> SaConstStringT ckpt_name);
> -CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CKPT_NODE *cp_node, 
> SaCkptSectionIdT *id, SaTimeT exp_time,
> +CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CB *cb, CPND_CKPT_NODE 
> *cp_node, SaCkptSectionIdT *id, SaTimeT exp_time,
> uint32_t gen_flag);
>   void cpnd_evt_backup_queue_add(CPND_CKPT_NODE *cp_node, CPND_EVT *evt);
>   uint32_t cpnd_ckpt_node_tree_init(CPND_CB *cb);
> @@ -176,8 +176,8 @@ void cpnd_client_node_tree_cleanup(CPND_
>   void cpnd_client_node_tree_destroy(CPND_CB *cb);
>   void cpnd_allrepl_write_evt_node_tree_cleanup(CPND_CB *cb);
>   void cpnd_allrepl_write_evt_node_tree_destroy(CPND_CB *cb);
> -uint32_t cpnd_sec_hdr_update(CPND_CKPT_SECTION_INFO *pSecPtr, CPND_CKPT_NODE 
> *cp_node);
> -uint32_t cpnd_ckpt_hdr_update(CPND_CKPT_NODE *cp_node);
> +uint32_t cpnd_sec_hdr_update(CPND_CB *cb, CPND_CKPT_SECTION_INFO *pSecPtr, 
> CPND_CKPT_NODE *cp_node);
> +uint32_t cpnd_ckpt_hdr_update(CPND_CB *cb, CPND_CKPT_NODE *cp_node);
>   void cpnd_ckpt_node_destroy(CPND_CB *cb, CPND_CKPT_NODE *cp_node);
>   uint32_t cpnd_get_slot_sub_slot_id_from_mds_dest(MDS_DEST dest);
>   uint32_t cpnd_get_slot_sub_slot_id_from_node_id(NCS_NODE_ID i_node_id);
> diff --git a/osaf/libs/common/cpsv/include/cpnd_sec.h 
> b/osaf/libs/common/cpsv/include/cpnd_sec.h
> --- a/osaf/libs/common/cpsv/include/cpnd_sec.h
> +++ b/osaf/libs/common/cpsv/include/cpnd_sec.h
> @@ -39,7 +39,7 @@ CPND_CKPT_SECTION_INFO *
>   cpnd_ckpt_sec_get_create(const CPND_CKPT_NODE *, const SaCkptSectionIdT *);
>   
>   CPND_CKPT_SECTION_INFO *
> -cpnd_ckpt_sec_del(CPND_CKPT_NODE *, SaCkptSectionIdT *);
> +cpnd_ckpt_sec_del(CPND_CB *cb, CPND_CKPT_NODE *, SaCkptSectionIdT *);
>   
>   CPND_CKPT_SECTION_INFO *
>   cpnd_get_sect_with_id(const CPND_CKPT_NODE *, uint32_t lcl_sec_id);
> diff --git 

Re: [devel] [PATCH 2 of 3] cpsv : update cpsv error handing based on leap changes [#2202]

2016-11-30 Thread A V Mahesh
Hi Hoang,

On 12/1/2016 9:15 AM, Vo Minh Hoang wrote:
> Dear Mahesh,
>
> I have one small concern about:
> Please consider get CB data by ncshm_take_hdl() or pass in ensures_space as
> parameter.
> When CB is global access, adding it to parameters of many API is a little
> bit inconvenient.
The `cb->shm_alloc_guaranteed = atoi(ptr);` only
update at the tim of cpnd_lib_init() by reading 
OSAF_CKPT_SHM_ALLOC_GUARANTEE env
and no further run-time update, so ideally you dont required lock.

Even the for CPSV API`s cb lock was taken and so the call shm will 
automatically under lock
do see any specific missing place in API code ?

-AVM
> And passing CB for just one ensures_space param might confuse the usage of
> function, maybe in future use.
>
> This is just my opinion, please consider about it.
>
> Thank you and best regards,
> Hoang
>
>
> -Original Message-
> From: mahesh.va...@oracle.com [mailto:mahesh.va...@oracle.com]
> Sent: Tuesday, November 29, 2016 5:37 PM
> To: hoang.m...@dektech.com.au; ramesh.bet...@oracle.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 2 of 3] cpsv : update cpsv error handing based on leap
> changes [#2202]
>
>   osaf/libs/common/cpsv/include/cpnd_cb.h   |   4 +-
>   osaf/libs/common/cpsv/include/cpnd_init.h |   8 +-
>   osaf/libs/common/cpsv/include/cpnd_sec.h  |   2 +-
>   osaf/libs/core/include/ncs_osprm.h|   2 +-
>   osaf/services/saf/cpsv/cpnd/cpnd_db.c |  12 ++--
>   osaf/services/saf/cpsv/cpnd/cpnd_evt.c|  82
> +-
>   osaf/services/saf/cpsv/cpnd/cpnd_proc.c   |  31 ++
>   osaf/services/saf/cpsv/cpnd/cpnd_res.c|  24 +++--
>   osaf/services/saf/cpsv/cpnd/cpnd_sec.cc   |  12 ++--
>   9 files changed, 103 insertions(+), 74 deletions(-)
>
>
> diff --git a/osaf/libs/common/cpsv/include/cpnd_cb.h
> b/osaf/libs/common/cpsv/include/cpnd_cb.h
> --- a/osaf/libs/common/cpsv/include/cpnd_cb.h
> +++ b/osaf/libs/common/cpsv/include/cpnd_cb.h
> @@ -341,8 +341,8 @@ uint32_t cpnd_amf_register(CPND_CB *cpnd  uint32_t
> cpnd_amf_deregister(CPND_CB *cpnd_cb);  uint32_t
> cpnd_client_extract_bits(uint32_t bitmap_value, uint32_t *bit_position);
> uint32_t cpnd_res_ckpt_sec_del(CPND_CKPT_NODE *cp_node); -uint32_t
> cpnd_ckpt_replica_create_res(NCS_OS_POSIX_SHM_REQ_INFO *open_req, char *buf,
> CPND_CKPT_NODE **cp_node,
> - uint32_t ref_cnt, CKPT_INFO
> *cp_info, bool shm_alloc_guaranteed);
> +uint32_t cpnd_ckpt_replica_create_res(CPND_CB *cb,
> NCS_OS_POSIX_SHM_REQ_INFO *open_req, char *buf, CPND_CKPT_NODE **cp_node,
> + uint32_t ref_cnt, CKPT_INFO
> *cp_info);
>   int32_t cpnd_find_free_loc(CPND_CB *cb, CPND_TYPE_INFO type);  uint32_t
> cpnd_ckpt_write_header(CPND_CB *cb, uint32_t nckpts);  uint32_t
> cpnd_cli_info_write_header(CPND_CB *cb, int32_t n_clients); diff --git
> a/osaf/libs/common/cpsv/include/cpnd_init.h
> b/osaf/libs/common/cpsv/include/cpnd_init.h
> --- a/osaf/libs/common/cpsv/include/cpnd_init.h
> +++ b/osaf/libs/common/cpsv/include/cpnd_init.h
> @@ -90,7 +90,7 @@ uint32_t cpnd_ckpt_replica_create(CPND_C  uint32_t
> cpnd_ckpt_remote_cpnd_add(CPND_CKPT_NODE *cp_node, MDS_DEST mds_info);
> uint32_t cpnd_ckpt_remote_cpnd_del(CPND_CKPT_NODE *cp_node, MDS_DEST
> mds_info);  int32_t cpnd_ckpt_get_lck_sec_id(CPND_CKPT_NODE *cp_node);
> -uint32_t cpnd_ckpt_sec_write(CPND_CKPT_NODE *cp_node,
> CPND_CKPT_SECTION_INFO
> +uint32_t cpnd_ckpt_sec_write(CPND_CB *cb, CPND_CKPT_NODE *cp_node,
> +CPND_CKPT_SECTION_INFO
> *sec_info, const void *data, uint64_t size,
> uint64_t offset, uint32_t type);  uint32_t cpnd_ckpt_sec_read(CPND_CKPT_NODE
> *cp_node, CPND_CKPT_SECTION_INFO
>*sec_info, void *data, uint64_t size, uint64_t
> offset); @@ -164,7 +164,7 @@ void cpnd_evt_node_getnext(CPND_CB *cb,
> uint32_t cpnd_evt_node_add(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE
> *evt_node);  uint32_t cpnd_evt_node_del(CPND_CB *cb,
> CPSV_CPND_ALL_REPL_EVT_NODE *evt_node);  CPND_CKPT_NODE
> *cpnd_ckpt_node_find_by_name(CPND_CB *cpnd_cb, SaConstStringT ckpt_name);
> -CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CKPT_NODE *cp_node,
> SaCkptSectionIdT *id, SaTimeT exp_time,
> +CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CB *cb, CPND_CKPT_NODE
> +*cp_node, SaCkptSectionIdT *id, SaTimeT exp_time,
> uint32_t gen_flag);
>   void cpnd_evt_backup_queue_add(CPND_CKPT_NODE *cp_node, CPND_EVT *evt);
> uint32_t cpnd_ckpt_node_tree_init(CPND_CB *cb); @@ -176,8 +176,8 @@ void
> cpnd_client_node_tree_cleanup(CPND_
>   void cpnd_client_node_tree_destroy(CPND_CB *cb);  void
> cpnd_allrepl_write_evt_node_tree_cleanup(CPND_CB *cb);  void
> cpnd_allrepl_write_evt_node_tree_destroy(CPND_CB *cb); -uint32_t
> cpnd_sec_hdr_update(CPND_CKPT_SECTION_INFO *pSecPtr, CPND_CKPT_NODE
> *cp_node); -uint32_t cpnd_ckpt_hdr_update(CPND_CKPT_NODE *cp_node);
> +uint32_t cpnd_sec_hdr_update(CPND_CB 

Re: [devel] [PATCH 2 of 3] cpsv : update cpsv error handing based on leap changes [#2202]

2016-11-30 Thread Vo Minh Hoang
Dear Mahesh,

I have one small concern about:
Please consider get CB data by ncshm_take_hdl() or pass in ensures_space as
parameter.
When CB is global access, adding it to parameters of many API is a little
bit inconvenient.
And passing CB for just one ensures_space param might confuse the usage of
function, maybe in future use.

This is just my opinion, please consider about it.

Thank you and best regards,
Hoang


-Original Message-
From: mahesh.va...@oracle.com [mailto:mahesh.va...@oracle.com] 
Sent: Tuesday, November 29, 2016 5:37 PM
To: hoang.m...@dektech.com.au; ramesh.bet...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 2 of 3] cpsv : update cpsv error handing based on leap
changes [#2202]

 osaf/libs/common/cpsv/include/cpnd_cb.h   |   4 +-
 osaf/libs/common/cpsv/include/cpnd_init.h |   8 +-
 osaf/libs/common/cpsv/include/cpnd_sec.h  |   2 +-
 osaf/libs/core/include/ncs_osprm.h|   2 +-
 osaf/services/saf/cpsv/cpnd/cpnd_db.c |  12 ++--
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c|  82
+-
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c   |  31 ++
 osaf/services/saf/cpsv/cpnd/cpnd_res.c|  24 +++--
 osaf/services/saf/cpsv/cpnd/cpnd_sec.cc   |  12 ++--
 9 files changed, 103 insertions(+), 74 deletions(-)


diff --git a/osaf/libs/common/cpsv/include/cpnd_cb.h
b/osaf/libs/common/cpsv/include/cpnd_cb.h
--- a/osaf/libs/common/cpsv/include/cpnd_cb.h
+++ b/osaf/libs/common/cpsv/include/cpnd_cb.h
@@ -341,8 +341,8 @@ uint32_t cpnd_amf_register(CPND_CB *cpnd  uint32_t
cpnd_amf_deregister(CPND_CB *cpnd_cb);  uint32_t
cpnd_client_extract_bits(uint32_t bitmap_value, uint32_t *bit_position);
uint32_t cpnd_res_ckpt_sec_del(CPND_CKPT_NODE *cp_node); -uint32_t
cpnd_ckpt_replica_create_res(NCS_OS_POSIX_SHM_REQ_INFO *open_req, char *buf,
CPND_CKPT_NODE **cp_node,
-   uint32_t ref_cnt, CKPT_INFO
*cp_info, bool shm_alloc_guaranteed);
+uint32_t cpnd_ckpt_replica_create_res(CPND_CB *cb,
NCS_OS_POSIX_SHM_REQ_INFO *open_req, char *buf, CPND_CKPT_NODE **cp_node,
+   uint32_t ref_cnt, CKPT_INFO
*cp_info);
 int32_t cpnd_find_free_loc(CPND_CB *cb, CPND_TYPE_INFO type);  uint32_t
cpnd_ckpt_write_header(CPND_CB *cb, uint32_t nckpts);  uint32_t
cpnd_cli_info_write_header(CPND_CB *cb, int32_t n_clients); diff --git
a/osaf/libs/common/cpsv/include/cpnd_init.h
b/osaf/libs/common/cpsv/include/cpnd_init.h
--- a/osaf/libs/common/cpsv/include/cpnd_init.h
+++ b/osaf/libs/common/cpsv/include/cpnd_init.h
@@ -90,7 +90,7 @@ uint32_t cpnd_ckpt_replica_create(CPND_C  uint32_t
cpnd_ckpt_remote_cpnd_add(CPND_CKPT_NODE *cp_node, MDS_DEST mds_info);
uint32_t cpnd_ckpt_remote_cpnd_del(CPND_CKPT_NODE *cp_node, MDS_DEST
mds_info);  int32_t cpnd_ckpt_get_lck_sec_id(CPND_CKPT_NODE *cp_node);
-uint32_t cpnd_ckpt_sec_write(CPND_CKPT_NODE *cp_node,
CPND_CKPT_SECTION_INFO
+uint32_t cpnd_ckpt_sec_write(CPND_CB *cb, CPND_CKPT_NODE *cp_node, 
+CPND_CKPT_SECTION_INFO
  *sec_info, const void *data, uint64_t size,
uint64_t offset, uint32_t type);  uint32_t cpnd_ckpt_sec_read(CPND_CKPT_NODE
*cp_node, CPND_CKPT_SECTION_INFO
 *sec_info, void *data, uint64_t size, uint64_t
offset); @@ -164,7 +164,7 @@ void cpnd_evt_node_getnext(CPND_CB *cb,
uint32_t cpnd_evt_node_add(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE
*evt_node);  uint32_t cpnd_evt_node_del(CPND_CB *cb,
CPSV_CPND_ALL_REPL_EVT_NODE *evt_node);  CPND_CKPT_NODE
*cpnd_ckpt_node_find_by_name(CPND_CB *cpnd_cb, SaConstStringT ckpt_name);
-CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CKPT_NODE *cp_node,
SaCkptSectionIdT *id, SaTimeT exp_time,
+CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CB *cb, CPND_CKPT_NODE 
+*cp_node, SaCkptSectionIdT *id, SaTimeT exp_time,
  uint32_t gen_flag);
 void cpnd_evt_backup_queue_add(CPND_CKPT_NODE *cp_node, CPND_EVT *evt);
uint32_t cpnd_ckpt_node_tree_init(CPND_CB *cb); @@ -176,8 +176,8 @@ void
cpnd_client_node_tree_cleanup(CPND_
 void cpnd_client_node_tree_destroy(CPND_CB *cb);  void
cpnd_allrepl_write_evt_node_tree_cleanup(CPND_CB *cb);  void
cpnd_allrepl_write_evt_node_tree_destroy(CPND_CB *cb); -uint32_t
cpnd_sec_hdr_update(CPND_CKPT_SECTION_INFO *pSecPtr, CPND_CKPT_NODE
*cp_node); -uint32_t cpnd_ckpt_hdr_update(CPND_CKPT_NODE *cp_node);
+uint32_t cpnd_sec_hdr_update(CPND_CB *cb, CPND_CKPT_SECTION_INFO 
+*pSecPtr, CPND_CKPT_NODE *cp_node); uint32_t 
+cpnd_ckpt_hdr_update(CPND_CB *cb, CPND_CKPT_NODE *cp_node);
 void cpnd_ckpt_node_destroy(CPND_CB *cb, CPND_CKPT_NODE *cp_node);
uint32_t cpnd_get_slot_sub_slot_id_from_mds_dest(MDS_DEST dest);  uint32_t
cpnd_get_slot_sub_slot_id_from_node_id(NCS_NODE_ID i_node_id); diff --git
a/osaf/libs/common/cpsv/include/cpnd_sec.h
b/osaf/libs/common/cpsv/include/cpnd_sec.h
--- a/osaf/libs/common/cpsv/include/cpnd_sec.h
+++ b/osaf/libs/common/cpsv/include/cpnd_sec.h
@@ -39,7 +39,7 @@ CPND_CKPT_SECTION_INFO *  

[devel] [PATCH 2 of 3] cpsv : update cpsv error handing based on leap changes [#2202]

2016-11-29 Thread mahesh . valla
 osaf/libs/common/cpsv/include/cpnd_cb.h   |   4 +-
 osaf/libs/common/cpsv/include/cpnd_init.h |   8 +-
 osaf/libs/common/cpsv/include/cpnd_sec.h  |   2 +-
 osaf/libs/core/include/ncs_osprm.h|   2 +-
 osaf/services/saf/cpsv/cpnd/cpnd_db.c |  12 ++--
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c|  82 +-
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c   |  31 ++
 osaf/services/saf/cpsv/cpnd/cpnd_res.c|  24 +++--
 osaf/services/saf/cpsv/cpnd/cpnd_sec.cc   |  12 ++--
 9 files changed, 103 insertions(+), 74 deletions(-)


diff --git a/osaf/libs/common/cpsv/include/cpnd_cb.h 
b/osaf/libs/common/cpsv/include/cpnd_cb.h
--- a/osaf/libs/common/cpsv/include/cpnd_cb.h
+++ b/osaf/libs/common/cpsv/include/cpnd_cb.h
@@ -341,8 +341,8 @@ uint32_t cpnd_amf_register(CPND_CB *cpnd
 uint32_t cpnd_amf_deregister(CPND_CB *cpnd_cb);
 uint32_t cpnd_client_extract_bits(uint32_t bitmap_value, uint32_t 
*bit_position);
 uint32_t cpnd_res_ckpt_sec_del(CPND_CKPT_NODE *cp_node);
-uint32_t cpnd_ckpt_replica_create_res(NCS_OS_POSIX_SHM_REQ_INFO *open_req, 
char *buf, CPND_CKPT_NODE **cp_node,
-   uint32_t ref_cnt, CKPT_INFO 
*cp_info, bool shm_alloc_guaranteed);
+uint32_t cpnd_ckpt_replica_create_res(CPND_CB *cb, NCS_OS_POSIX_SHM_REQ_INFO 
*open_req, char *buf, CPND_CKPT_NODE **cp_node,
+   uint32_t ref_cnt, CKPT_INFO 
*cp_info);
 int32_t cpnd_find_free_loc(CPND_CB *cb, CPND_TYPE_INFO type);
 uint32_t cpnd_ckpt_write_header(CPND_CB *cb, uint32_t nckpts);
 uint32_t cpnd_cli_info_write_header(CPND_CB *cb, int32_t n_clients);
diff --git a/osaf/libs/common/cpsv/include/cpnd_init.h 
b/osaf/libs/common/cpsv/include/cpnd_init.h
--- a/osaf/libs/common/cpsv/include/cpnd_init.h
+++ b/osaf/libs/common/cpsv/include/cpnd_init.h
@@ -90,7 +90,7 @@ uint32_t cpnd_ckpt_replica_create(CPND_C
 uint32_t cpnd_ckpt_remote_cpnd_add(CPND_CKPT_NODE *cp_node, MDS_DEST mds_info);
 uint32_t cpnd_ckpt_remote_cpnd_del(CPND_CKPT_NODE *cp_node, MDS_DEST mds_info);
 int32_t cpnd_ckpt_get_lck_sec_id(CPND_CKPT_NODE *cp_node);
-uint32_t cpnd_ckpt_sec_write(CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO
+uint32_t cpnd_ckpt_sec_write(CPND_CB *cb, CPND_CKPT_NODE *cp_node, 
CPND_CKPT_SECTION_INFO
  *sec_info, const void *data, uint64_t size, uint64_t 
offset, uint32_t type);
 uint32_t cpnd_ckpt_sec_read(CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO
 *sec_info, void *data, uint64_t size, uint64_t offset);
@@ -164,7 +164,7 @@ void cpnd_evt_node_getnext(CPND_CB *cb, 
 uint32_t cpnd_evt_node_add(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE *evt_node);
 uint32_t cpnd_evt_node_del(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE *evt_node);
 CPND_CKPT_NODE *cpnd_ckpt_node_find_by_name(CPND_CB *cpnd_cb, SaConstStringT 
ckpt_name);
-CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CKPT_NODE *cp_node, 
SaCkptSectionIdT *id, SaTimeT exp_time,
+CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CB *cb, CPND_CKPT_NODE 
*cp_node, SaCkptSectionIdT *id, SaTimeT exp_time,
  uint32_t gen_flag);
 void cpnd_evt_backup_queue_add(CPND_CKPT_NODE *cp_node, CPND_EVT *evt);
 uint32_t cpnd_ckpt_node_tree_init(CPND_CB *cb);
@@ -176,8 +176,8 @@ void cpnd_client_node_tree_cleanup(CPND_
 void cpnd_client_node_tree_destroy(CPND_CB *cb);
 void cpnd_allrepl_write_evt_node_tree_cleanup(CPND_CB *cb);
 void cpnd_allrepl_write_evt_node_tree_destroy(CPND_CB *cb);
-uint32_t cpnd_sec_hdr_update(CPND_CKPT_SECTION_INFO *pSecPtr, CPND_CKPT_NODE 
*cp_node);
-uint32_t cpnd_ckpt_hdr_update(CPND_CKPT_NODE *cp_node);
+uint32_t cpnd_sec_hdr_update(CPND_CB *cb, CPND_CKPT_SECTION_INFO *pSecPtr, 
CPND_CKPT_NODE *cp_node);
+uint32_t cpnd_ckpt_hdr_update(CPND_CB *cb, CPND_CKPT_NODE *cp_node);
 void cpnd_ckpt_node_destroy(CPND_CB *cb, CPND_CKPT_NODE *cp_node);
 uint32_t cpnd_get_slot_sub_slot_id_from_mds_dest(MDS_DEST dest);
 uint32_t cpnd_get_slot_sub_slot_id_from_node_id(NCS_NODE_ID i_node_id);
diff --git a/osaf/libs/common/cpsv/include/cpnd_sec.h 
b/osaf/libs/common/cpsv/include/cpnd_sec.h
--- a/osaf/libs/common/cpsv/include/cpnd_sec.h
+++ b/osaf/libs/common/cpsv/include/cpnd_sec.h
@@ -39,7 +39,7 @@ CPND_CKPT_SECTION_INFO *
 cpnd_ckpt_sec_get_create(const CPND_CKPT_NODE *, const SaCkptSectionIdT *);
 
 CPND_CKPT_SECTION_INFO *
-cpnd_ckpt_sec_del(CPND_CKPT_NODE *, SaCkptSectionIdT *);
+cpnd_ckpt_sec_del(CPND_CB *cb, CPND_CKPT_NODE *, SaCkptSectionIdT *);
 
 CPND_CKPT_SECTION_INFO *
 cpnd_get_sect_with_id(const CPND_CKPT_NODE *, uint32_t lcl_sec_id);
diff --git a/osaf/libs/core/include/ncs_osprm.h 
b/osaf/libs/core/include/ncs_osprm.h
--- a/osaf/libs/core/include/ncs_osprm.h
+++ b/osaf/libs/core/include/ncs_osprm.h
@@ -564,7 +564,6 @@ typedef struct ncs_os_posix_shm_req_open
   uint32_t i_flags;
   uint32_t i_map_flags;
   uint64_t i_size;
-  bool ensures_space;
   uint64_t i_offset;
   void *o_addr;
   int32_t o_fd;
@@ -600,6 +599,7