Hi Mathi,

Some comments on your comments:

1)
This is a validation of user input and the oi error report is used to give 
feedback in case incorrect input is given.
I don't think this should be logged to the system log (use system log 
carefully)  even if there is a chance that the message is not received (not 
supported). Even if the user does not get a detailed error message the request 
will be rejected with a standard IMM error message.
However all of the TRACEs you mention should be removed since there is a TRACE 
directly after the validate function is called that will trace the same error 
string that is reported.
What do you think?

2)
See my comments below

3)
I agree that " highlimit is equal to low limit " shall be allowed

Thanks
Lennart

> -----Original Message-----
> From: Mathivanan Naickan Palanivelu [mailto:[email protected]]
> Sent: den 5 augusti 2014 15:17
> To: Lennart Lund
> Cc: [email protected]
> Subject: RE: [PATCH 1 of 3] log: Make limit settings in config object runtime
> configurable [#921]
> 
> Hi Lennart,
> 
> I played around with the patch and some comments below:
> 
> 1) For the below cases, if the OM is not yet supporting printing of error
> strings from OI, then On top of saImmOiCcbSetErrorString(), We may also
> want to print the error messages aditionally to syslog,
> 
> +             TRACE("logStreamSystemHighLimit validation Fail");
> +                     TRACE("logStreamSystemLowLimit validation Fail");
> +                     TRACE("logStreamAppHighLimit validation Fail");
> +                     TRACE("logStreamAppLowLimit validation Fail");
> +                     TRACE("Cannot change attributes. Not supported by
> standby");
> 
> 2) In, lgs_imm_rootpathconf_set()
> 
> we could avoid the error string "lgsv root path is changed to "
> i.e. when i try to change the root directory, then the following multiple 
> error
> strings are observed, we could avoid one of them:
> 
>Aug  5 18:19:12 SC-1 local0.err osaflogd[397]: ER Old log files could not be 
>renamed and closed, root-dir: /repl_opensaf/saflog
>Aug  5 18:19:12 SC-1 local0.err osaflogd[397]: ER Old log files could not be 
>renamed and closed, root-dir: /repl_opensaf/saflog
This is written once per stream where the current log file could not be renamed 
with a closing time stamp
in the old root directory. The message should be changed to give more relevant 
information.

>Aug  5 18:19:12 SC-1 local0.notice osaflogd[397]: NO lgsv root path is changed 
>to "/repl_opensaf/mathi"
>Aug  5 18:19:12 SC-1 local0.notice osaflogd[397]: NO Log root directory 
>changed to: /repl_opensaf/mathi
LOG_NO("Log root directory changed to:...") can be removed.


> 
> 3) In the case when highlimit is equal to low limit, should we really consider
> that as an error?
> 
>  error - saImmOmCcbApply FAILED: SA_AIS_ERR_FAILED_OPERATION (21) OI
> reports: HIGH limit <= LOW limit
> 
> 
> Thanks,
> Mathi.
> 
> >-----Original Message-----
> >From: Lennart Lund [mailto:[email protected]]
> >Sent: Thursday, June 26, 2014 5:34 PM
> >To: Mathivanan Naickan Palanivelu
> >Cc: [email protected]
> >Subject: [PATCH 1 of 3] log: Make limit settings in config object
> >runtime configurable [#921]
> >
> > osaf/services/saf/logsv/lgs/lgs.h      |    3 +
> > osaf/services/saf/logsv/lgs/lgs_imm.c  |  223
> >+++++++++++++++++++++++++++++---
> > osaf/services/saf/logsv/lgs/lgs_main.c |   39 ++++-
> > osaf/services/saf/logsv/lgs/lgs_mds.c  |   21 ++-
> > 4 files changed, 249 insertions(+), 37 deletions(-)
> >
> >
> >Make the high and low limit settings i the configuration object
> >possible to change in runtime.
> >- Validate and accept changes
> >- Apply changes (on active only)
> >
> >diff --git a/osaf/services/saf/logsv/lgs/lgs.h
> >b/osaf/services/saf/logsv/lgs/lgs.h
> >--- a/osaf/services/saf/logsv/lgs/lgs.h
> >+++ b/osaf/services/saf/logsv/lgs/lgs.h
> >@@ -113,6 +113,9 @@ extern uint32_t mbox_high[NCS_IPC_PRIORI
> extern
> >uint32_t mbox_msgs[NCS_IPC_PRIORITY_MAX];  extern bool
> >mbox_full[NCS_IPC_PRIORITY_MAX];  extern uint32_t
> >mbox_low[NCS_IPC_PRIORITY_MAX];
> >+extern pthread_mutex_t lgs_mbox_init_mutex;
> >+
> >+extern uint32_t lgs_configure_mailbox(void);
> >
> > extern uint32_t lgs_amf_init(lgs_cb_t *);  extern uint32_t
> >lgs_mds_init(lgs_cb_t *cb); diff --git
> >a/osaf/services/saf/logsv/lgs/lgs_imm.c
> >b/osaf/services/saf/logsv/lgs/lgs_imm.c
> >--- a/osaf/services/saf/logsv/lgs/lgs_imm.c
> >+++ b/osaf/services/saf/logsv/lgs/lgs_imm.c
> >@@ -149,6 +149,8 @@ static void report_oi_error(SaImmOiHandl  static
> >void report_om_error(SaImmOiHandleT immOiHandle, SaInvocationT
> >invocation,
> >             const char *format, ...) __attribute__ ((format(printf, 3, 4)));
> >
> >+static SaAisErrorT read_logsv_config_obj(const char *dn, lgs_conf_t
> >*lgsConf);
> >+
> > /**
> >  * To be used in OI callbacks to report errors by setting an error
> >string
> >  * Also writes the same error string using TRACE @@ -618,6 +620,140 @@
> >static SaAisErrorT config_ccb_completed_
> >     return rc;
> > }
> >
> >+/* =================================================
> >+ * config_ccb_completed_modify() with help functions
> >+ * =================================================
> >+ */
> >+struct vattr_t {
> >+    /* true if any of the attributes has been changed */
> >+    bool validate_flag;
> >+    SaUint32T logStreamSystemHighLimit;
> >+    /* true if this attribute has been changed */
> >+    bool logStreamSystemHighLimit_changed;
> >+    SaUint32T logStreamSystemLowLimit;
> >+    bool logStreamSystemLowLimit_changed;
> >+    SaUint32T logStreamAppHighLimit;
> >+    bool logStreamAppHighLimit_changed;
> >+    SaUint32T logStreamAppLowLimit;
> >+    bool logStreamAppLowLimit_changed;
> >+};
> >+
> >+/**
> >+ * Compare high and low and return true if:
> >+ *  - high > low
> >+ *  - high = low = 0
> >+ * else return false
> >+ *
> >+ * @param low
> >+ * @param high
> >+ * @return true if valid
> >+ */
> >+static bool valid_limits(SaUint32T low, SaUint32T high) {
> >+    bool rc = true;
> >+    if ( !((low == 0) && (high == 0)) ) {
> >+            /* Allow both values to be 0 */
> >+            if (low >= high) {
> >+                    rc = false;
> >+            }
> >+    }
> >+
> >+    return rc;
> >+}
> >+
> >+/**
> >+ * Validate attributes:
> >+ * Must be done after all attributes has been read in order to check
> >+against
> >+ * the correct value.
> >+ * Check that no low limit >= corresponding high limit
> >+ * Both high and low limit can be 0
> >+ * If corresponding limit is not changed, check against current
> >+setting
> >+ *
> >+ * @param vattr [i] struct with attributes to validate
> >+ * @param err_str [out] char vector of 256 bytes to return a string.
> >+ * @return error code
> >+ */
> >+static SaAisErrorT validate_config_ccb_completed_modify(struct vattr_t
> >vattr, char *err_str)
> >+{
> >+    SaUint32T value32_high = 0;
> >+    SaUint32T value32_low = 0;
> >+    SaAisErrorT rc = SA_AIS_OK;
> >+
> >+    TRACE_ENTER();
> >+
> >+    if (vattr.logStreamSystemHighLimit_changed) {
> >+            value32_high = vattr.logStreamSystemHighLimit;
> >+            if (vattr.logStreamSystemLowLimit_changed) {
> >+                    value32_low = vattr.logStreamSystemLowLimit;
> >+            } else {
> >+                    value32_low = *(SaUint32T *) lgs_imm_logconf_get(
> >+
> >     LGS_IMM_LOG_STREAM_SYSTEM_LOW_LIMIT, NULL);
> >+            }
> >+
> >+            if (!valid_limits(value32_low, value32_high)) {
> >+                    rc = SA_AIS_ERR_BAD_OPERATION;
> >+                    snprintf(err_str, 256, "HIGH limit <= LOW limit");
> >+                    TRACE("logStreamSystemHighLimit validation Fail");
> >+                    goto done;
> >+            }
> >+    }
> >+
> >+    if (vattr.logStreamSystemLowLimit_changed) {
> >+            value32_low = vattr.logStreamSystemLowLimit;
> >+            if (vattr.logStreamSystemHighLimit_changed) {
> >+                    value32_high = vattr.logStreamSystemHighLimit;
> >+            } else {
> >+                    value32_high = *(SaUint32T *) lgs_imm_logconf_get(
> >+
> >     LGS_IMM_LOG_STREAM_SYSTEM_HIGH_LIMIT, NULL);
> >+            }
> >+
> >+            if (!valid_limits(value32_low, value32_high)) {
> >+                    rc = SA_AIS_ERR_BAD_OPERATION;
> >+                    snprintf(err_str, 256, "HIGH limit <= LOW limit");
> >+                    TRACE("logStreamSystemLowLimit validation Fail");
> >+                    goto done;
> >+            }
> >+    }
> >+
> >+    if (vattr.logStreamAppHighLimit_changed) {
> >+            value32_high = vattr.logStreamAppHighLimit;
> >+            if (vattr.logStreamAppLowLimit_changed) {
> >+                    value32_low = vattr.logStreamAppLowLimit;
> >+            } else {
> >+                    value32_low = *(SaUint32T *) lgs_imm_logconf_get(
> >+
> >     LGS_IMM_LOG_STREAM_APP_LOW_LIMIT, NULL);
> >+            }
> >+
> >+            if (!valid_limits(value32_low, value32_high)) {
> >+                    rc = SA_AIS_ERR_BAD_OPERATION;
> >+                    snprintf(err_str, 256, "HIGH limit <= LOW limit");
> >+                    TRACE("logStreamAppHighLimit validation Fail");
> >+                    goto done;
> >+            }
> >+    }
> >+
> >+    if (vattr.logStreamAppLowLimit_changed) {
> >+            value32_low = vattr.logStreamAppLowLimit;
> >+            if (vattr.logStreamAppHighLimit_changed) {
> >+                    value32_high = vattr.logStreamAppHighLimit;
> >+            } else {
> >+                    value32_high = *(SaUint32T *) lgs_imm_logconf_get(
> >+
> >     LGS_IMM_LOG_STREAM_APP_HIGH_LIMIT, NULL);
> >+            }
> >+
> >+            if (!valid_limits(value32_low, value32_high)) {
> >+                    rc = SA_AIS_ERR_BAD_OPERATION;
> >+                    snprintf(err_str, 256, "HIGH limit <= LOW limit");
> >+                    TRACE("logStreamAppLowLimit validation Fail");
> >+                    goto done;
> >+            }
> >+    }
> >+
> >+    done:
> >+    TRACE_LEAVE2("rc = %d", rc);
> >+    return rc;
> >+}
> >+
> > /**
> >  * Modification of attributes in log service configuration object.
> >  * Only logRootDirectory can be modified @@ -632,6 +768,20 @@ static
> >SaAisErrorT config_ccb_completed_
> >     const SaImmAttrModificationT_2 *attrMod;
> >     SaAisErrorT rc = SA_AIS_OK;
> >     int i = 0;
> >+
> >+    struct vattr_t vattr = {
> >+            .validate_flag = false,
> >+            .logStreamSystemHighLimit = 0,
> >+            .logStreamSystemHighLimit_changed = false,
> >+            .logStreamSystemLowLimit = 0,
> >+            .logStreamSystemLowLimit_changed = false,
> >+            .logStreamAppHighLimit = 0,
> >+            .logStreamAppHighLimit_changed = false,
> >+            .logStreamAppLowLimit = 0,
> >+            .logStreamAppLowLimit_changed = false,
> >+    };
> >+
> >+    char oi_err_str[256];
> >
> >     TRACE_ENTER2("CCB ID %llu, '%s'", opdata->ccbId, opdata-
> >>objectName.value);
> >
> >@@ -667,25 +817,25 @@ static SaAisErrorT config_ccb_completed_
> >                     rc = SA_AIS_ERR_FAILED_OPERATION;
> >                     goto done;
> >             } else if (!strcmp(attribute->attrName,
> >"logStreamSystemHighLimit")) {
> >-                    report_oi_error(immOiHandle, opdata->ccbId,
> >-                                    "%s cannot be changed", attribute-
> >>attrName);
> >-                    rc = SA_AIS_ERR_FAILED_OPERATION;
> >-                    goto done;
> >+                    vattr.logStreamSystemHighLimit = *((SaUint32T
> >*)value);
> >+                    vattr.logStreamSystemHighLimit_changed = true;
> >+                    TRACE("%s %s = %d",__FUNCTION__, attribute-
> >>attrName,
> >+                                    vattr.logStreamSystemHighLimit);
> >             } else if (!strcmp(attribute->attrName,
> >"logStreamSystemLowLimit")) {
> >-                    report_oi_error(immOiHandle, opdata->ccbId,
> >-                                    "%s cannot be changed", attribute-
> >>attrName);
> >-                    rc = SA_AIS_ERR_FAILED_OPERATION;
> >-                    goto done;
> >+                    vattr.logStreamSystemLowLimit = *((SaUint32T
> >*)value);
> >+                    vattr.logStreamSystemLowLimit_changed = true;
> >+                    TRACE("%s %s = %d",__FUNCTION__, attribute-
> >>attrName,
> >+                                    vattr.logStreamSystemHighLimit);
> >             } else if (!strcmp(attribute->attrName,
> >"logStreamAppHighLimit")) {
> >-                    report_oi_error(immOiHandle, opdata->ccbId,
> >-                                    "%s cannot be changed", attribute-
> >>attrName);
> >-                    rc = SA_AIS_ERR_FAILED_OPERATION;
> >-                    goto done;
> >+                    vattr.logStreamAppHighLimit = *((SaUint32T
> *)value);
> >+                    vattr.logStreamAppHighLimit_changed = true;
> >+                    TRACE("%s %s = %d",__FUNCTION__, attribute-
> >>attrName,
> >+                                    vattr.logStreamSystemHighLimit);
> >             } else if (!strcmp(attribute->attrName,
> >"logStreamAppLowLimit")) {
> >-                    report_oi_error(immOiHandle, opdata->ccbId,
> >-                                    "%s cannot be changed", attribute-
> >>attrName);
> >-                    rc = SA_AIS_ERR_FAILED_OPERATION;
> >-                    goto done;
> >+                    vattr.logStreamAppLowLimit = *((SaUint32T *)value);
> >+                    vattr.logStreamAppLowLimit_changed = true;
> >+                    TRACE("%s %s = %d",__FUNCTION__, attribute-
> >>attrName,
> >+                                    vattr.logStreamSystemHighLimit);
> >             } else if (!strcmp(attribute->attrName,
> >"logMaxApplicationStreams")) {
> >                     report_oi_error(immOiHandle, opdata->ccbId,
> >                                     "%s cannot be changed", attribute-
> >>attrName);
> >@@ -710,7 +860,13 @@ static SaAisErrorT config_ccb_completed_
> >
> >             attrMod = opdata->param.modify.attrMods[i++];
> >     }
> >-
> >+
> >+    rc = validate_config_ccb_completed_modify(vattr, oi_err_str);
> >+    if (rc != SA_AIS_OK) {
> >+            TRACE("Reporting oi error \"%s\"", oi_err_str);
> >+            report_oi_error(immOiHandle, opdata->ccbId, "%s",
> >oi_err_str);
> >+    }
> >+
> > done:
> >     TRACE_LEAVE2("rc=%u", rc);
> >     return rc;
> >@@ -1176,6 +1332,9 @@ static void config_ccb_apply_modify(cons  {
> >     const SaImmAttrModificationT_2 *attrMod;
> >     int i = 0;
> >+    bool checkpoint_flag = false;
> >+    bool mbox_cfg_flag = false;
> >+    lgs_conf_t *lgs_conf_p = (lgs_conf_t *) lgs_conf;
> >
> >     TRACE_ENTER2("CCB ID %llu, '%s'", opdata->ccbId, opdata-
> >>objectName.value);
> >
> >@@ -1202,16 +1361,34 @@ static void config_ccb_apply_modify(cons
> >                     lgs_conf->chkp_file_close_time = cur_time;
> >
> >                     LOG_NO("Log root directory changed to: %s", lgs_cb-
> >>logsv_root_dir);
> >-            } else {
> >-                    // validation should not allow any other change
> >-                    osafassert(0);
> >+                    checkpoint_flag = true;
> >+            } else if (!strcmp(attribute->attrName,
> >"logStreamSystemHighLimit")) {
> >+                    mbox_cfg_flag = true;
> >+            } else if (!strcmp(attribute->attrName,
> >"logStreamSystemLowLimit")) {
> >+                    mbox_cfg_flag = true;
> >+            } else if (!strcmp(attribute->attrName,
> >"logStreamAppHighLimit")) {
> >+                    mbox_cfg_flag = true;
> >+            } else if (!strcmp(attribute->attrName,
> >"logStreamAppLowLimit")) {
> >+                    mbox_cfg_flag = true;
> >             }
> >-
> >+
> >             attrMod = opdata->param.modify.attrMods[i++];
> >     }
> >+
> >+    if (mbox_cfg_flag == true) {
> >+            /* If any mailbox queue limits has changed the new
> >configuration has to
> >+             * be read and the mailbox reconfigured.
> >+             * Standby has to be notified.
> >+             */
> >+            TRACE("%s - Update mailbox", __FUNCTION__);
> >+            (void)
> >read_logsv_config_obj(LGS_IMM_LOG_CONFIGURATION, lgs_conf_p);
> >+            (void) lgs_configure_mailbox();
> >+    }
> >
> >-    /* Check pointing lgs configuration change */
> >-    ckpt_lgs_cfg(lgs_conf);
> >+    if (checkpoint_flag == true) {
> >+            /* Check pointing lgs configuration change */
> >+            ckpt_lgs_cfg(lgs_conf);
> >+    }
> >
> >     TRACE_LEAVE();
> > }
> >diff --git a/osaf/services/saf/logsv/lgs/lgs_main.c
> >b/osaf/services/saf/logsv/lgs/lgs_main.c
> >--- a/osaf/services/saf/logsv/lgs/lgs_main.c
> >+++ b/osaf/services/saf/logsv/lgs/lgs_main.c
> >@@ -38,6 +38,7 @@
> > #include "lgs.h"
> > #include "lgs_util.h"
> > #include "lgs_file.h"
> >+#include "osaf_utility.h"
> >
> > /*
> >=========================================================
> ==
> >=============
> >  *   DEFINITIONS
> >@@ -80,6 +81,12 @@ bool mbox_full[NCS_IPC_PRIORITY_MAX];
> > /* Lower limit which determines when to leave FULL state */  uint32_t
> >mbox_low[NCS_IPC_PRIORITY_MAX];
> >
> >+/* The mailbox and mailbox handling variables (limits) may be
> >+reinitialized
> >+ * in runtime. This happen in the main thread. The mailbox and
> >+variables are
> >+ * used in the mds thread.
> >+ */
> >+pthread_mutex_t lgs_mbox_init_mutex = PTHREAD_MUTEX_INITIALIZER;
> >+
> > static struct pollfd fds[5];
> > static nfds_t nfds = 5;
> > static NCS_SEL_OBJ usr1_sel_obj;
> >@@ -135,21 +142,29 @@ static void sigusr1_handler(int sig)  }
> >
> > /**
> >- * Configure mailbox properties from environment variables
> >+ * Configure mailbox properties from configuration variables
> >  * Low limit is by default configured as a percentage of the
> >  * high limit (if not configured explicitly).
> >  *
> >  * @return uint32_t
> >  */
> >-static uint32_t configure_mailbox(void)
> >+uint32_t lgs_configure_mailbox(void)
> > {
> >     uint32_t limit = 0;
> >     bool errorflag;
> >+    uint32_t rc = NCSCC_RC_SUCCESS;
> >
> >+    TRACE_ENTER();
> >+    /* Do not initialize if the mailbox is being used in the mds thread.
> Wait
> >+     * until done.
> >+     */
> >+    osaf_mutex_lock_ordie(&lgs_mbox_init_mutex);
> >+
> >     limit = *(uint32_t*)
> >lgs_imm_logconf_get(LGS_IMM_LOG_STREAM_SYSTEM_HIGH_LIMIT,
> >&errorflag);
> >     if (errorflag != false) {
> >             LOG_ER("Illegal value for
> LOG_STREAM_SYSTEM_HIGH_LIMIT
> >- %s", strerror(errno));
> >-            return NCSCC_RC_FAILURE;
> >+            rc = NCSCC_RC_FAILURE;
> >+            goto done;
> >     }
> >
> >     mbox_high[LGS_IPC_PRIO_SYS_STREAM] = limit; @@ -164,7 +179,8
> @@
> >static uint32_t configure_mailbox(void)
> >             limit = *(uint32_t*)
> >lgs_imm_logconf_get(LGS_IMM_LOG_STREAM_SYSTEM_LOW_LIMIT,
> >&errorflag);
> >             if (errorflag != false) {
> >                     LOG_ER("Illegal value for
> >LOG_STREAM_SYSTEM_LOW_LIMIT - %s", strerror(errno));
> >-                    return NCSCC_RC_FAILURE;
> >+                    rc = NCSCC_RC_FAILURE;
> >+                    goto done;
> >             }
> >
> >             mbox_low[LGS_IPC_PRIO_SYS_STREAM] = limit; @@ -173,7
> +189,8 @@
> >static uint32_t configure_mailbox(void)
> >     limit = *(uint32_t*)
> >lgs_imm_logconf_get(LGS_IMM_LOG_STREAM_APP_HIGH_LIMIT,
> >&errorflag);
> >     if (errorflag != false) {
> >             LOG_ER("Illegal value for LOG_STREAM_APP_HIGH_LIMIT -
> %s",
> >strerror(errno));
> >-            return NCSCC_RC_FAILURE;
> >+            rc = NCSCC_RC_FAILURE;
> >+            goto done;
> >     }
> >
> >     mbox_high[LGS_IPC_PRIO_APP_STREAM] = limit; @@ -188,7 +205,8
> @@
> >static uint32_t configure_mailbox(void)
> >             limit = *(uint32_t*)
> >lgs_imm_logconf_get(LGS_IMM_LOG_STREAM_APP_HIGH_LIMIT,
> >&errorflag);
> >             if (errorflag != false) {
> >                     LOG_ER("Illegal value for
> >LOG_STREAM_APP_LOW_LIMIT - %s", strerror(errno));
> >-                    return NCSCC_RC_FAILURE;
> >+                    rc = NCSCC_RC_FAILURE;
> >+                    goto done;
> >             }
> >
> >             mbox_low[LGS_IPC_PRIO_APP_STREAM] = limit; @@ -197,7
> +215,12 @@
> >static uint32_t configure_mailbox(void)
> >     TRACE("sys low:%u, high:%u",
> >mbox_low[LGS_IPC_PRIO_SYS_STREAM],
> >mbox_high[LGS_IPC_PRIO_SYS_STREAM]);
> >     TRACE("app low:%u, high:%u",
> >mbox_low[LGS_IPC_PRIO_APP_STREAM],
> >mbox_high[LGS_IPC_PRIO_APP_STREAM]);
> >
> >-    return NCSCC_RC_SUCCESS;
> >+    osaf_mutex_unlock_ordie(&lgs_mbox_init_mutex);
> >+
> >+    done:
> >+
> >+    TRACE_LEAVE2("rc = %d", rc);
> >+    return rc;
> > }
> >
> > /**
> >@@ -274,7 +297,7 @@ static uint32_t log_initialize(void)
> >             goto done;
> >     }
> >
> >-    if (configure_mailbox() != NCSCC_RC_SUCCESS) {
> >+    if (lgs_configure_mailbox() != NCSCC_RC_SUCCESS) {
> >             LOG_ER("configure_mailbox FAILED");
> >             goto done;
> >     }
> >diff --git a/osaf/services/saf/logsv/lgs/lgs_mds.c
> >b/osaf/services/saf/logsv/lgs/lgs_mds.c
> >--- a/osaf/services/saf/logsv/lgs/lgs_mds.c
> >+++ b/osaf/services/saf/logsv/lgs/lgs_mds.c
> >@@ -18,6 +18,7 @@
> > #include <ncsencdec_pub.h>
> > #include "lgs.h"
> > #include "osaf_time.h"
> >+#include "osaf_utility.h"
> >
> > #define LGS_SVC_PVT_SUBPART_VERSION 1
> > #define LGS_WRT_LGA_SUBPART_VER_AT_MIN_MSG_FMT 1 @@ -879,9
> +880,13 @@
> >static uint32_t mds_rcv(struct ncsmds_ca
> >     const lgsv_api_info_t *api_info = &evt->info.msg.info.api_info;
> >     lgsv_api_msg_type_t type = api_info->type;
> >     NCS_IPC_PRIORITY prio = NCS_IPC_PRIORITY_LOW;
> >-    uint32_t rc;
> >+    uint32_t rc = NCSCC_RC_SUCCESS;
> >     static unsigned long silently_discarded[NCS_IPC_PRIORITY_MAX];
> >-
> >+
> >+    /* Wait if the mailbox is being reinitialized in the main thread.
> >+     */
> >+    osaf_mutex_lock_ordie(&lgs_mbox_init_mutex);
> >+
> >     evt->evt_type = LGSV_LGS_LGSV_MSG;
> >     evt->cb_hdl = (uint32_t)mds_info->i_yr_svc_hdl;
> >     evt->fr_node_id = mds_info->info.receive.i_node_id; @@ -894,7
> +899,7
> >@@ static uint32_t mds_rcv(struct ncsmds_ca
> >             osaf_clock_gettime(CLOCK_MONOTONIC, &evt-
> >>entered_at);
> >             rc = m_NCS_IPC_SEND(&lgs_mbx, evt,
> >LGS_IPC_PRIO_CTRL_MSGS);
> >             osafassert(rc == NCSCC_RC_SUCCESS);
> >-            return NCSCC_RC_SUCCESS;
> >+            goto done;
> >     }
> >
> >     prio = getmboxprio(api_info);
> >@@ -907,7 +912,7 @@ static uint32_t mds_rcv(struct ncsmds_ca
> >                     rc = m_NCS_IPC_SEND(&lgs_mbx, evt,
> >LGS_IPC_PRIO_CTRL_MSGS);
> >                     osafassert(rc == NCSCC_RC_SUCCESS);
> >             }
> >-            return NCSCC_RC_SUCCESS;
> >+            goto done;
> >     }
> >
> >     /* Can we leave the mbox FULL state? */ @@ -936,7 +941,7 @@
> static
> >uint32_t mds_rcv(struct ncsmds_ca
> >     osafassert(api_info->type == LGSV_WRITE_LOG_ASYNC_REQ);
> >
> >     if (m_NCS_IPC_SEND(&lgs_mbx, evt, prio) == NCSCC_RC_SUCCESS) {
> >-            return NCSCC_RC_SUCCESS;
> >+            goto done;
> >     } else {
> >             mbox_full[prio] = true;
> >             TRACE("FULL, msgs: %u, low: %u, high: %u",
> mbox_msgs[prio], @@
> >-955,7 +960,11 @@ static uint32_t mds_rcv(struct ncsmds_ca
> > donefree:
> >     lgs_free_write_log(&api_info->param.write_log_async);
> >     free(evt);
> >-    return NCSCC_RC_SUCCESS;
> >+
> >+done:
> >+    osaf_mutex_unlock_ordie(&lgs_mbox_init_mutex);
> >+
> >+    return rc;
> > }
> >
> >
> >/*********************************************************
> *
> >******************

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to