1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-11-04 15:10:39 +01:00

libflashrom: Add new layout_compare() function with test

Add a new layout_compare() function which will be used in a subsequent
patch to test equality between two layouts. Add a test function for
layout_compare(). Fix a small bug in compare_region_with_dump() which
was introduced in commit 74a1a54892 ("libflashrom: Fix comparison of
layout romentry regions"), which was discovered with the new test.

Change-Id: Ib37556bb83d4e1c26545a90b49128f1f78ffe2c6
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/89629
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Matt DeVillier
2025-10-18 10:04:39 -05:00
committed by Anastasia Klimchuk
parent 8e0bfee62f
commit b0b975d0ea
6 changed files with 113 additions and 1 deletions

View File

@@ -550,6 +550,21 @@ int flashrom_layout_get_region_range(struct flashrom_layout *layout, const char
* @param layout Layout to free.
*/
void flashrom_layout_release(struct flashrom_layout *layout);
/**
* @brief Compare two flashrom layouts for equality.
*
* Compares all regions in both layouts. Two layouts are considered equal if they
* contain the same number of regions, in the same order, with identical start/end
* addresses and names.
*
* @param layout1 First layout to compare.
* @param layout2 Second layout to compare.
*
* @return 0 if layouts are identical,
* 1 if they differ or if either layout is NULL.
*/
int flashrom_layout_compare(const struct flashrom_layout *layout1,
const struct flashrom_layout *layout2);
/**
* @brief Set the active layout for a flash context.
*