Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38421 )
Change subject: commonlib/bsd: Add new CBFS core implementation ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38421/8/src/commonlib/bsd/include/c... File src/commonlib/bsd/include/commonlib/bsd/cbfs_serialized.h:
https://review.coreboot.org/c/coreboot/+/38421/8/src/commonlib/bsd/include/c... PS8, Line 127: /* Actual size in CBFS may be larger/smaller than struct size! */
Silly question: what does this mean?
The size of the attribute on flash is variable, and it always has been (it's 12 + <size of the hash>). Previously, hash_data was a zero-length array so sizeof(struct cbfs_file_attr_hash) could be used to conveniently get the size of the attribute header (12) and then you only had to add the size of the hash to that. With this change, that no longer works because the size of struct vb2_hash is larger (however, it is not necessarily equal to the full size of the attribute either). So, basically, you shouldn't use sizeof(struct cbfs_file_attr_hash) for anything, that's why I put that comment there.
This attribute is currently only read by cbfstool which has its own copy of the definition. When I update that to use this file, I'll make sure I deal with this issue appropriately.