This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 57b7439  sys/log: fix reboot log entries
     new 32e4770  Merge pull request #2065 from vrahane/reboot_log_fcb_fix
57b7439 is described below

commit 57b74395048668898743deaf8c1630dd1b7aff06
Author: Vipul Rahane <[email protected]>
AuthorDate: Tue Oct 22 17:08:46 2019 -0700

    sys/log: fix reboot log entries
    
    - reboot log entries were getting truncated on an fcb_rotate since
      by default we try to restore 10 entries. this change manifested after
      the reboot_log entry length increased greater than 128 which happened
      recently as part of the reboot_log transition to CBOR encoded one form a
      string log.
---
 sys/log/full/src/log_fcb.c | 4 ++--
 sys/log/full/syscfg.yml    | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/sys/log/full/src/log_fcb.c b/sys/log/full/src/log_fcb.c
index 7c3205e..1a50db5 100644
--- a/sys/log/full/src/log_fcb.c
+++ b/sys/log/full/src/log_fcb.c
@@ -755,7 +755,7 @@ log_fcb_copy_entry(struct log *log, struct fcb_entry *entry,
                    struct fcb *dst_fcb)
 {
     struct log_entry_hdr ueh;
-    char data[LOG_PRINTF_MAX_ENTRY_LEN + LOG_BASE_ENTRY_HDR_SIZE +
+    char data[MYNEWT_VAL(LOG_FCB_COPY_MAX_ENTRY_LEN) + LOG_BASE_ENTRY_HDR_SIZE 
+
               LOG_IMG_HASHLEN];
     uint16_t hdr_len;
     int dlen;
@@ -770,7 +770,7 @@ log_fcb_copy_entry(struct log *log, struct fcb_entry *entry,
 
     hdr_len = log_hdr_len(&ueh);
 
-    dlen = min(entry->fe_data_len, LOG_PRINTF_MAX_ENTRY_LEN +
+    dlen = min(entry->fe_data_len, MYNEWT_VAL(LOG_FCB_COPY_MAX_ENTRY_LEN) +
                hdr_len);
 
     rc = log_fcb_read(log, entry, data, 0, dlen);
diff --git a/sys/log/full/syscfg.yml b/sys/log/full/syscfg.yml
index b8ee6f8..117d223 100644
--- a/sys/log/full/syscfg.yml
+++ b/sys/log/full/syscfg.yml
@@ -140,5 +140,10 @@ syscfg.defs:
             Primary sysinit stage for logging functionality.
         value: 100
 
+    LOG_FCB_COPY_MAX_ENTRY_LEN:
+        description: >
+            Max entry length that can be copied from one fcb log to another.
+        value: 256
+
 syscfg.vals.LOG_NEWTMGR:
     LOG_MGMT: MYNEWT_VAL(LOG_MGMT)

Reply via email to