vrahane commented on code in PR #3168: URL: https://github.com/apache/mynewt-core/pull/3168#discussion_r1671188463
########## sys/log/full/src/log_fcb.c: ########## @@ -346,23 +350,80 @@ log_fcb_append_body(struct log *log, const struct log_entry_hdr *hdr, if (hdr->ue_flags & LOG_FLAGS_IMG_HASH) { memcpy(buf + LOG_BASE_ENTRY_HDR_SIZE, hdr->ue_imghash, LOG_IMG_HASHLEN); } + memcpy(buf + hdr_len, u8p, hdr_alignment); rc = flash_area_write(loc.fe_area, loc.fe_data_off, buf, chunk_sz); if (rc != 0) { return rc; } + loc.fe_data_off += chunk_sz; + /* Append the remainder of the message body. */ u8p += hdr_alignment; body_len -= hdr_alignment; - if (body_len > 0) { - rc = flash_area_write(loc.fe_area, loc.fe_data_off + chunk_sz, u8p, - body_len); - if (rc != 0) { - return rc; + if (hdr->ue_flags & LOG_FLAGS_TLV_SUPPORT) { + memset(buf, 0, sizeof(buf)); + /* Calculate trailer alignment */ + trailer_alignment = log_fcb_hdr_trailer_bytes(fcb->f_align, chunk_sz + body_len); + if (trailer_alignment > trailer_len) { + chunk_sz = trailer_len; + } else { + chunk_sz = trailer_alignment; + } Review Comment: This is not needed as trailer comes at the end after the body and the padding takes care of alignment issues, so the trailer can be read on its own. -- 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: commits-unsubscr...@mynewt.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org