You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/07/31 16:58:33 UTC

[GitHub] [mynewt-core] ccollins476ad commented on a change in pull request #1932: log: Add configurability to watermark storage

ccollins476ad commented on a change in pull request #1932: log: Add configurability to watermark storage
URL: https://github.com/apache/mynewt-core/pull/1932#discussion_r309329218
 
 

 ##########
 File path: sys/log/full/src/log_fcb.c
 ##########
 @@ -532,19 +532,30 @@ log_fcb_registered(struct log *log)
 {
 #if MYNEWT_VAL(LOG_STORAGE_WATERMARK)
     struct fcb_log *fl;
+#if !MYNEWT_VAL(LOG_REBOOT_INIT_WATERMARK_UNK)
     struct fcb *fcb;
     struct fcb_entry loc;
+#endif
 
     fl = (struct fcb_log *)log->l_arg;
+
+#if !MYNEWT_VAL(LOG_REBOOT_INIT_WATERMARK_UNK)
     fcb = &fl->fl_fcb;
 
     /* Set watermark to first element */
     memset(&loc, 0, sizeof(loc));
+#endif
+
+#if MYNEWT_VAL(LOG_REBOOT_INIT_WATERMARK_UNK)
+    /* Initialize watermark to designated unknown value*/
+    fl->fl_watermark_off = (uint32_t)MYNEWT_VAL(LOG_INIT_WATERMARK_VAL);
+#else
     if (fcb_getnext(fcb, &loc)) {
         fl->fl_watermark_off = loc.fe_area->fa_off + loc.fe_elem_off;
     } else {
         fl->fl_watermark_off = fcb->f_oldest->fa_off;
     }
+#endif
 #endif
     return 0;
 
 Review comment:
   This function (`log_fcb_registered()`) is starting to get a bit confusing with all the `#if` / `#endif` directives.  Can you combine the bottom half into a single `#if` / `#else`?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services