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 2019/10/21 09:30:43 UTC
[mynewt-core] 22/23: Using fcb->f_scratch_cnt as opposed to
checking for past newest sector.
This is an automated email from the ASF dual-hosted git repository.
marko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit dd2a0180066357a50032a65c63c96a1f794ba0f7
Author: Nolan Lau <no...@juul.com>
AuthorDate: Fri Oct 18 14:30:36 2019 -0700
Using fcb->f_scratch_cnt as opposed to checking for past newest sector.
---
fs/fcb/src/fcb_append.c | 23 +----------------------
sys/log/full/src/log_fcb.c | 1 +
2 files changed, 2 insertions(+), 22 deletions(-)
diff --git a/fs/fcb/src/fcb_append.c b/fs/fcb/src/fcb_append.c
index 59beafa..6d1bc86 100644
--- a/fs/fcb/src/fcb_append.c
+++ b/fs/fcb/src/fcb_append.c
@@ -21,27 +21,6 @@
#include "fcb/fcb.h"
#include "fcb_priv.h"
-/**
- * Check to see if area is at the newest point
- *
- * @param fcb
- *
- * @return fap area
- */
-struct flash_area *
-fcb_area_past_newest(struct fcb *fcb)
-{
- struct flash_area *fap;
-
- fap = fcb->f_active.fe_area;
- fap++;
- if (fap >= &fcb->f_sectors[fcb->f_sector_cnt]) {
- return &fcb->f_sectors[0];
- } else {
- return fap;
- }
-}
-
static struct flash_area *
fcb_new_area(struct fcb *fcb, int cnt)
{
@@ -57,7 +36,7 @@ fcb_new_area(struct fcb *fcb, int cnt)
if (!rfa) {
rfa = fa;
}
- if (fcb->f_oldest == fcb_area_past_newest(fcb)) {
+ if (fa == fcb->f_oldest) {
return NULL;
}
} while (i++ < cnt);
diff --git a/sys/log/full/src/log_fcb.c b/sys/log/full/src/log_fcb.c
index 40b0be2..7c3205e 100644
--- a/sys/log/full/src/log_fcb.c
+++ b/sys/log/full/src/log_fcb.c
@@ -161,6 +161,7 @@ log_fcb_start_append(struct log *log, int len, struct fcb_entry *loc)
/* Notify upper layer that a rotation is about to occur */
if (log->l_rotate_notify_cb != NULL) {
+ fcb_append_to_scratch(fcb);
log->l_rotate_notify_cb(log);
}