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/06/09 21:38:53 UTC

[8/9] incubator-mynewt-core git commit: Fix reboot cnt

Fix reboot cnt

- Fix reboot count
- Cleanup


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/e0ed9a2d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/e0ed9a2d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/e0ed9a2d

Branch: refs/heads/develop
Commit: e0ed9a2ddd90e97c69bffc469ffd9f2360c85f2b
Parents: ceeb405
Author: Vipul Rahane <vi...@runtime.io>
Authored: Wed May 25 19:15:35 2016 -0700
Committer: Vipul Rahane <vi...@runtime.io>
Committed: Thu Jun 9 12:31:59 2016 -0700

----------------------------------------------------------------------
 sys/fcb/include/fcb/fcb.h   |  1 -
 sys/reboot/src/log_reboot.c | 26 +++++++++++++-------------
 2 files changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e0ed9a2d/sys/fcb/include/fcb/fcb.h
----------------------------------------------------------------------
diff --git a/sys/fcb/include/fcb/fcb.h b/sys/fcb/include/fcb/fcb.h
index e247009..3661114 100644
--- a/sys/fcb/include/fcb/fcb.h
+++ b/sys/fcb/include/fcb/fcb.h
@@ -56,7 +56,6 @@ struct fcb {
     struct fcb_entry f_active;
     uint16_t f_active_id;
     uint8_t f_align;		/* writes to flash have to aligned to this */
-    void *f_arg;
 };
 
 /*

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e0ed9a2d/sys/reboot/src/log_reboot.c
----------------------------------------------------------------------
diff --git a/sys/reboot/src/log_reboot.c b/sys/reboot/src/log_reboot.c
index ecbf49e..8a6f3dd 100644
--- a/sys/reboot/src/log_reboot.c
+++ b/sys/reboot/src/log_reboot.c
@@ -119,16 +119,6 @@ log_reboot(int reason)
 
     reboot_tmp_cnt = reboot_cnt;
 
-    /* If the reboot count is equal to soft_reboot */
-    if (soft_reboot == reboot_cnt) {
-        reboot_tmp_cnt = reboot_cnt + 1;
-        /* Save the reboot cnt */
-        rc = conf_save_one(&reboot_conf_handler, "reboot_cnt",
-                           conf_str_from_value(CONF_INT16, &reboot_tmp_cnt,
-                                               str, sizeof(str)));
-        goto err;
-    }
-
     if (reason == SOFT_REBOOT) {
         /*
          * Save reboot count as soft reboot cnt if the reason is
@@ -141,11 +131,19 @@ log_reboot(int reason)
         if (rc) {
             goto err;
         }
+    } else if (reason == HARD_REBOOT) {
+        rc = conf_save_one(&reboot_conf_handler, "soft_reboot", "0");
+        if (rc) {
+            goto err;
+        }
+        if (soft_reboot) {
+            goto err;
+        } else {
+            reboot_cnt++;
+            reboot_tmp_cnt = reboot_cnt;
+        }
     }
 
-
-    imgr_my_version(&ver);
-
     /* Save the reboot cnt */
     rc = conf_save_one(&reboot_conf_handler, "reboot_cnt",
                        conf_str_from_value(CONF_INT16, &reboot_tmp_cnt,
@@ -154,6 +152,8 @@ log_reboot(int reason)
         goto err;
     }
 
+    imgr_my_version(&ver);
+
     /* Log a reboot */
     LOG_CRITICAL(&reboot_log, LOG_MODULE_REBOOT, "rsn:%s, cnt:%u,"
                  " img:%u.%u.%u.%u", REBOOT_REASON_STR(reason), reboot_tmp_cnt,