brolan-juul commented on a change in pull request #2052: FCB Rotate Notification
URL: https://github.com/apache/mynewt-core/pull/2052#discussion_r336213462
##########
File path: fs/fcb/src/fcb_getnext.c
##########
@@ -110,6 +110,48 @@ fcb_getnext_nolock(struct fcb *fcb, struct fcb_entry *loc)
return 0;
}
+int
+fcb_getnext_nolock_sector(struct fcb *fcb, struct fcb_entry *loc)
+{
+ int rc;
+
+ if (loc->fe_area == NULL) {
+ /*
+ * Find the first one we have in flash.
+ */
+ loc->fe_area = fcb->f_oldest;
+ }
+ if (loc->fe_elem_off == 0) {
+ /*
+ * If offset is zero, we serve the first entry from the area.
+ */
+ loc->fe_elem_off = sizeof(struct fcb_disk_area);
+ rc = fcb_elem_info(fcb, loc);
+ } else {
+ rc = fcb_getnext_in_area(fcb, loc);
+ }
+ switch (rc) {
+ case 0:
+ return 0;
+ case FCB_ERR_CRC:
+ break;
+ default:
+ return FCB_ERR_NEXT_SECT;
+ }
+ while (rc == FCB_ERR_CRC) {
+ rc = fcb_getnext_in_area(fcb, loc);
+ if (rc == 0) {
+ return 0;
+ }
+
+ if (rc != FCB_ERR_CRC) {
Review comment:
Done.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services