summaryrefslogtreecommitdiffstats
path: root/cli_classic.c
diff options
context:
space:
mode:
authorNikolai Artemiev <nartemiev@google.com>2022-12-07 11:16:06 +1100
committerEdward O'Callaghan <quasisec@chromium.org>2022-12-15 23:55:03 +0000
commit66655b74236eb01ac0fd21ee11b5082ea720ed6b (patch)
treef411e9667c3686b35993b6492e246d1c59c83328 /cli_classic.c
parent77fe2663073b8006e7b3d20a1debc080831345ab (diff)
downloadflashrom-66655b74236eb01ac0fd21ee11b5082ea720ed6b.tar.gz
flashrom-66655b74236eb01ac0fd21ee11b5082ea720ed6b.tar.bz2
flashrom-66655b74236eb01ac0fd21ee11b5082ea720ed6b.zip
layout: Factor out flash_region structure from romentry
The romentry structure is the container ADT with some annotated meta-data such as 'included' or 'file' however the substantive substructure is a 'flash_region'. Therefore factor this out. That is to say, the link list node 'romentry' is obscured by the implementation details of its use-case of 'flash_region' that we clear up here. BUG=b:260440773 BRANCH=none TEST=flashrom_tester Change-Id: I768742b73db901df5b5208fcbcb8a324a06014c2 CoAuthored-by: Nikolai Artemiev <nartemiev@google.com> Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69196 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'cli_classic.c')
-rw-r--r--cli_classic.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/cli_classic.c b/cli_classic.c
index 0b0944f30..c72836fc7 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -388,8 +388,9 @@ static int read_buf_from_include_args(const struct flashrom_layout *const layout
while ((entry = layout_next_included(layout, entry))) {
if (!entry->file)
continue;
- if (read_buf_from_file(buf + entry->start,
- entry->end - entry->start + 1, entry->file))
+ const struct flash_region *region = &entry->region;
+ if (read_buf_from_file(buf + region->start,
+ region->end - region->start + 1, entry->file))
return 1;
}
return 0;
@@ -414,8 +415,9 @@ static int write_buf_to_include_args(const struct flashrom_layout *const layout,
while ((entry = layout_next_included(layout, entry))) {
if (!entry->file)
continue;
- if (write_buf_to_file(buf + entry->start,
- entry->end - entry->start + 1, entry->file))
+ const struct flash_region *region = &entry->region;
+ if (write_buf_to_file(buf + region->start,
+ region->end - region->start + 1, entry->file))
return 1;
}