vrahane commented on code in PR #3365:
URL: https://github.com/apache/mynewt-core/pull/3365#discussion_r1956656963


##########
sys/log/full/src/log_fcb_bmark.c:
##########
@@ -22,17 +22,68 @@
 #include "os/mynewt.h"
 
 #if MYNEWT_VAL(LOG_FCB_BOOKMARKS)
-
+#include "log/log.h"
 #include "log/log_fcb.h"
 
-void
+#if MYNEWT_VAL(LOG_FCB_SECTOR_BOOKMARKS)
+static int
+log_fcb_init_sector_bmarks(struct fcb_log *fcb_log)
+{
+    int rc = 0;
+    int i = 0;
+    struct fcb_entry loc = {0};
+    struct log_entry_hdr ueh = {0};
+    struct flash_area *fa = NULL;
+
+    rc = fcb_getnext(&fcb_log->fl_fcb, &loc);
+    if (rc) {
+        return -1;
+    }
+
+    for (i = 0; i < fcb_log->fl_fcb.f_sector_cnt; i++) {

Review Comment:
   Yeah, I wanted to keep the API as much backwards compatible as possible 
without adding more complexity. But if needed I could add a separate 
`log_fcb_init_sect_bmarks()` API, then the user would have to utilize both APIs 
instead of having just one. Do you have any other suggestions how to make this 
better ? I could also have return codes indicating sector bookmarks did not 
fit. Asserting is also an option, better than an array overrun I guess.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to