You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2025/03/12 19:19:23 UTC
(mynewt-core) 01/01: fs/fcb: Address review comments
This is an automated email from the ASF dual-hosted git repository.
vipulrahane pushed a commit to branch vipul/async_fcb_fixes
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit e85824281e1b75eee63d19cea95c83b401abe224
Author: Vipul Rahane <vi...@juul.com>
AuthorDate: Wed Mar 12 12:18:46 2025 -0700
fs/fcb: Address review comments
---
fs/fcb/include/fcb/fcb.h | 8 ++++++++
fs/fcb/src/fcb.c | 4 ++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/fs/fcb/include/fcb/fcb.h b/fs/fcb/include/fcb/fcb.h
index 7f97b9ee1..4e674d362 100644
--- a/fs/fcb/include/fcb/fcb.h
+++ b/fs/fcb/include/fcb/fcb.h
@@ -194,11 +194,19 @@ int fcb_append_to_scratch(struct fcb *);
/**
* How many sectors are unused.
+ *
+ * @param fcb - fcb to check
+ * @return number of free sectors if successful,
+ * negative value on error
*/
int fcb_free_sector_cnt(struct fcb *fcb);
/**
* Whether FCB has any data.
+ *
+ * @param fcb - fcb to check
+ * @return 1 if FCB is empty, 0 if FCB has data,
+ * negative value on error
*/
int fcb_is_empty(struct fcb *fcb);
diff --git a/fs/fcb/src/fcb.c b/fs/fcb/src/fcb.c
index 31227fd3c..8ed9847e9 100644
--- a/fs/fcb/src/fcb.c
+++ b/fs/fcb/src/fcb.c
@@ -262,13 +262,13 @@ fcb_offset_last_n(struct fcb *fcb, uint8_t entries,
i = 0;
memset(&loc, 0, sizeof(loc));
- while (!fcb_getnext(fcb, &loc)) {
+ while (!fcb_getnext_nolock(fcb, &loc)) {
if (i == 0) {
/* Start from the beginning of fcb entries */
*last_n_entry = loc;
} else if (i > (entries - 1)) {
/* Update last_n_entry after n entries and keep updating */
- fcb_getnext(fcb, last_n_entry);
+ fcb_getnext_nolock(fcb, last_n_entry);
}
i++;
}