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/04/08 23:24:58 UTC

[1/3] incubator-mynewt-core git commit: FCB; allow FCB to operate on areas with only one sector.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop f01bf32d7 -> 0030fa241


FCB; allow FCB to operate on areas with only one 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/861d74ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/861d74ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/861d74ce

Branch: refs/heads/develop
Commit: 861d74ce91f3281f40f0764bf279d9ab90054de5
Parents: f01bf32
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Apr 8 14:21:12 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Apr 8 14:21:12 2016 -0700

----------------------------------------------------------------------
 sys/fcb/src/test/fcb_test.c | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/861d74ce/sys/fcb/src/test/fcb_test.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/test/fcb_test.c b/sys/fcb/src/test/fcb_test.c
index fc40abf..b0de576 100644
--- a/sys/fcb/src/test/fcb_test.c
+++ b/sys/fcb/src/test/fcb_test.c
@@ -95,7 +95,6 @@ TEST_CASE(fcb_test_init)
     TEST_ASSERT(rc == FCB_ERR_ARGS);
 
     fcb->f_sectors = test_fcb_area;
-    fcb->f_sector_cnt = 1;
 
     rc = fcb_init(fcb);
     TEST_ASSERT(rc == FCB_ERR_ARGS);


[2/3] incubator-mynewt-core git commit: FCB; allow fcb to operate on flash areas with only sector.

Posted by ma...@apache.org.
FCB; allow fcb to operate on flash areas with only 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/5230ebd2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/5230ebd2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/5230ebd2

Branch: refs/heads/develop
Commit: 5230ebd28f01a63569e702bde0567d4fadf3fa77
Parents: 861d74c
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Apr 8 14:22:20 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Apr 8 14:22:20 2016 -0700

----------------------------------------------------------------------
 sys/fcb/src/fcb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5230ebd2/sys/fcb/src/fcb.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb.c b/sys/fcb/src/fcb.c
index 60aac43..161e829 100644
--- a/sys/fcb/src/fcb.c
+++ b/sys/fcb/src/fcb.c
@@ -34,7 +34,7 @@ fcb_init(struct fcb *fcb)
     struct flash_area *oldest_fap = NULL, *newest_fap = NULL;
     struct fcb_disk_area fda;
 
-    if (!fcb->f_sectors || fcb->f_sector_cnt - fcb->f_scratch_cnt < 2) {
+    if (!fcb->f_sectors || fcb->f_sector_cnt - fcb->f_scratch_cnt < 1) {
         return FCB_ERR_ARGS;
     }
 


[3/3] incubator-mynewt-core git commit: FCB; was not freeing mutex on certain errors in fcb_append. Check for return code from os_mutex_pend() was broken.

Posted by ma...@apache.org.
FCB; was not freeing mutex on certain errors in fcb_append.
Check for return code from os_mutex_pend() was broken.


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

Branch: refs/heads/develop
Commit: 0030fa2411b4bdf7defc6454caadf42c43f6fa06
Parents: 5230ebd
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Apr 8 14:23:09 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Apr 8 14:23:09 2016 -0700

----------------------------------------------------------------------
 sys/fcb/src/fcb_append.c  | 14 +++++++++-----
 sys/fcb/src/fcb_getnext.c |  2 +-
 sys/fcb/src/fcb_rotate.c  |  2 +-
 sys/fcb/src/fcb_walk.c    |  2 +-
 4 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0030fa24/sys/fcb/src/fcb_append.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb_append.c b/sys/fcb/src/fcb_append.c
index fc4e0db..c7f5ddc 100644
--- a/sys/fcb/src/fcb_append.c
+++ b/sys/fcb/src/fcb_append.c
@@ -83,7 +83,7 @@ fcb_append(struct fcb *fcb, uint16_t len, struct fcb_entry *append_loc)
     len = fcb_len_in_flash(fcb, len) + fcb_len_in_flash(fcb, FCB_CRC_SZ);
 
     rc = os_mutex_pend(&fcb->f_mtx, OS_WAIT_FOREVER);
-    if (rc != OS_NOT_STARTED) {
+    if (rc && rc != OS_NOT_STARTED) {
         return FCB_ERR_ARGS;
     }
     active = &fcb->f_active;
@@ -91,11 +91,12 @@ fcb_append(struct fcb *fcb, uint16_t len, struct fcb_entry *append_loc)
         fa = fcb_new_area(fcb, fcb->f_scratch_cnt);
         if (!fa || (fa->fa_size <
             sizeof(struct fcb_disk_area) + len + cnt)) {
-            return FCB_ERR_NOSPACE;
+            rc = FCB_ERR_NOSPACE;
+            goto err;
         }
         rc = fcb_sector_hdr_init(fcb, fa, fcb->f_active_id + 1);
         if (rc) {
-            return rc;
+            goto err;
         }
         fcb->f_active.fe_area = fa;
         fcb->f_active.fe_elem_off = sizeof(struct fcb_disk_area);
@@ -104,8 +105,8 @@ fcb_append(struct fcb *fcb, uint16_t len, struct fcb_entry *append_loc)
 
     rc = flash_area_write(active->fe_area, active->fe_elem_off, tmp_str, cnt);
     if (rc) {
-        os_mutex_release(&fcb->f_mtx);
-        return FCB_ERR_FLASH;
+        rc = FCB_ERR_FLASH;
+        goto err;
     }
     append_loc->fe_area = active->fe_area;
     append_loc->fe_elem_off = active->fe_elem_off;
@@ -116,6 +117,9 @@ fcb_append(struct fcb *fcb, uint16_t len, struct fcb_entry *append_loc)
     os_mutex_release(&fcb->f_mtx);
 
     return FCB_OK;
+err:
+    os_mutex_release(&fcb->f_mtx);
+    return rc;
 }
 
 int

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0030fa24/sys/fcb/src/fcb_getnext.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb_getnext.c b/sys/fcb/src/fcb_getnext.c
index 7cd903b..be92979 100644
--- a/sys/fcb/src/fcb_getnext.c
+++ b/sys/fcb/src/fcb_getnext.c
@@ -122,7 +122,7 @@ fcb_getnext(struct fcb *fcb, struct fcb_entry *loc)
     int rc;
 
     rc = os_mutex_pend(&fcb->f_mtx, OS_WAIT_FOREVER);
-    if (rc != OS_NOT_STARTED) {
+    if (rc && rc != OS_NOT_STARTED) {
         return FCB_ERR_ARGS;
     }
     rc = fcb_getnext_nolock(fcb, loc);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0030fa24/sys/fcb/src/fcb_rotate.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb_rotate.c b/sys/fcb/src/fcb_rotate.c
index 77af31d..73724a9 100644
--- a/sys/fcb/src/fcb_rotate.c
+++ b/sys/fcb/src/fcb_rotate.c
@@ -27,7 +27,7 @@ fcb_rotate(struct fcb *fcb)
     int rc = 0;
 
     rc = os_mutex_pend(&fcb->f_mtx, OS_WAIT_FOREVER);
-    if (rc != OS_NOT_STARTED) {
+    if (rc && rc != OS_NOT_STARTED) {
         return FCB_ERR_ARGS;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0030fa24/sys/fcb/src/fcb_walk.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb_walk.c b/sys/fcb/src/fcb_walk.c
index a4e7320..e557262 100644
--- a/sys/fcb/src/fcb_walk.c
+++ b/sys/fcb/src/fcb_walk.c
@@ -34,7 +34,7 @@ fcb_walk(struct fcb *fcb, struct flash_area *fap, fcb_walk_cb cb, void *cb_arg)
     loc.fe_elem_off = 0;
 
     rc = os_mutex_pend(&fcb->f_mtx, OS_WAIT_FOREVER);
-    if (rc != OS_NOT_STARTED) {
+    if (rc && rc != OS_NOT_STARTED) {
         return FCB_ERR_ARGS;
     }
     while ((rc = fcb_getnext_nolock(fcb, &loc)) != FCB_ERR_NOVAR) {