Nico Huber has posted comments on this change. ( https://review.coreboot.org/23353 )
Change subject: WIP: Add romentry flags and function to append a single layout entry ......................................................................
Patch Set 1:
(2 comments)
This has the potential to obsolete the file arguments to do_read/write/ verify, and save us some code, great! ;)
https://review.coreboot.org/#/c/23353/1/layout.c File layout.c:
https://review.coreboot.org/#/c/23353/1/layout.c@63 PS1, Line 63: entry->name, sizeof(layout.entries[layout.num_entries].name)); Missing '\0' termination in case entry->name is too long.
Anyway, can't you just copy the whole struct?
layout.entries[layout.num_entries] = *entry;
https://review.coreboot.org/#/c/23353/1/layout.c@271 PS1, Line 271: (l->entries[j].flags & ROMENTRY_FLAG_IGNORE_OVERLAP)) How about a grouping of the entries instead, e.g.
if (l->entries[i].group != l->entries[j].group) continue;
In any case, I'd move the check above the range checks.