You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/07/27 20:17:31 UTC

[1/2] incubator-mynewt-core git commit: fcb; calling fcb_rotate() when there is only one flash sector in FCB was not wiping out the contents of that sector.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 140c373a6 -> a0810f7eb


fcb; calling fcb_rotate() when there is only one flash sector in FCB
was not wiping out the contents of that sector.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/4240de7e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/4240de7e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/4240de7e

Branch: refs/heads/develop
Commit: 4240de7eabe00822cb3c5cf679b7131c1d9670c9
Parents: 140c373
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Jul 27 13:15:09 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Jul 27 13:15:09 2016 -0700

----------------------------------------------------------------------
 sys/fcb/src/fcb_rotate.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4240de7e/sys/fcb/src/fcb_rotate.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb_rotate.c b/sys/fcb/src/fcb_rotate.c
index 73724a9..7b6df58 100644
--- a/sys/fcb/src/fcb_rotate.c
+++ b/sys/fcb/src/fcb_rotate.c
@@ -31,6 +31,11 @@ fcb_rotate(struct fcb *fcb)
         return FCB_ERR_ARGS;
     }
 
+    rc = flash_area_erase(fcb->f_oldest, 0, fcb->f_oldest->fa_size);
+    if (rc) {
+        rc = FCB_ERR_FLASH;
+        goto out;
+    }
     if (fcb->f_oldest == fcb->f_active.fe_area) {
         /*
          * Need to create a new active area, as we're wiping the current.
@@ -44,11 +49,6 @@ fcb_rotate(struct fcb *fcb)
         fcb->f_active.fe_elem_off = sizeof(struct fcb_disk_area);
         fcb->f_active_id++;
     }
-    rc = flash_area_erase(fcb->f_oldest, 0, fcb->f_oldest->fa_size);
-    if (rc) {
-        rc = FCB_ERR_FLASH;
-        goto out;
-    }
     fcb->f_oldest = fcb_getnext_area(fcb, fcb->f_oldest);
 out:
     os_mutex_release(&fcb->f_mtx);


[2/2] incubator-mynewt-core git commit: log; fix the use of image scratch when rotating logs. Need to erase the area before trying to use it.

Posted by ma...@apache.org.
log; fix the use of image scratch when rotating logs. Need to erase
the area before trying to use it.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/a0810f7e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/a0810f7e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/a0810f7e

Branch: refs/heads/develop
Commit: a0810f7ebca6d3d02296dff9a9557d85d2f8d3fa
Parents: 4240de7
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Jul 27 13:16:15 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Jul 27 13:16:15 2016 -0700

----------------------------------------------------------------------
 sys/log/src/log_fcb.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a0810f7e/sys/log/src/log_fcb.c
----------------------------------------------------------------------
diff --git a/sys/log/src/log_fcb.c b/sys/log/src/log_fcb.c
index 2384c83..3bfde04 100644
--- a/sys/log/src/log_fcb.c
+++ b/sys/log/src/log_fcb.c
@@ -245,16 +245,12 @@ log_fcb_rtr_erase(struct log *log, void *arg)
     fcb_scratch.f_magic = 0x7EADBADF;
     fcb_scratch.f_version = 0;
 
+    flash_area_erase(&sector, 0, sector.fa_size);
     rc = fcb_init(&fcb_scratch);
     if (rc) {
         goto err;
     }
 
-    rc = fcb_clear(&fcb_scratch);
-    if (rc) {
-        goto err;
-    }
-
     /* Calculate offset of n-th last entry */
     rc = fcb_offset_last_n(fcb, fcb_log->fl_entries, &offset);
     if (rc) {