Anastasia Klimchuk has uploaded this change for review.
layout: Change signature for prepare_layout_for_extraction
This function used to accept flash context as an argument, but
inside it is getting layout from context and then working with this
layout.
The patch changes the signature to accept layout instead of flash
context to align with other layout functions and to be able to
add prepare_layout_for_extraction to libflashrom API.
The reason for adding prepare_layout_for_extraction to libflashrom
API is that it allows using extract functionality from libflashrom.
At the moment there is a do_extract function in cli_classic. It
has two calls: prepare_layout_for_extraction and do_read. Read
operation is already available from libflashrom API, so one thing
remaining is prepare_layout_for_extraction.
Adding prepare_layout_for_extraction to libflashrom happens in the
next patch in this chain.
TEST ME ON DEVICE
BUG=b:222384032
Change-Id: I7d3874d1097bb0d7bb8d9fa8e639cc1e71407627
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
---
M cli_classic.c
M layout.c
M layout.h
3 files changed, 5 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/54/62554/1
diff --git a/cli_classic.c b/cli_classic.c
index 8c337eb..f044e87 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -183,7 +183,8 @@
static int do_extract(struct flashctx *const flash)
{
- prepare_layout_for_extraction(flash);
+ const struct flashrom_layout *const layout = get_layout(flash);
+ prepare_layout_for_extraction(layout);
return do_read(flash, NULL);
}
diff --git a/layout.c b/layout.c
index 05bee19..b4ccdaa 100644
--- a/layout.c
+++ b/layout.c
@@ -299,13 +299,12 @@
return ret;
}
-void prepare_layout_for_extraction(struct flashctx *flash)
+void prepare_layout_for_extraction(const struct flashrom_layout *const layout)
{
- const struct flashrom_layout *const l = get_layout(flash);
struct romentry *entry = NULL;
unsigned int i;
- while ((entry = mutable_layout_next(l, entry))) {
+ while ((entry = mutable_layout_next(layout, entry))) {
entry->included = true;
if (!entry->file)
diff --git a/layout.h b/layout.h
index abbdc22..ce8386a 100644
--- a/layout.h
+++ b/layout.h
@@ -63,7 +63,7 @@
const struct romentry *layout_next_included(const struct flashrom_layout *, const struct romentry *);
const struct romentry *layout_next(const struct flashrom_layout *, const struct romentry *);
int included_regions_overlap(const struct flashrom_layout *);
-void prepare_layout_for_extraction(struct flashrom_flashctx *);
+void prepare_layout_for_extraction(const struct flashrom_layout *const);
int layout_sanity_checks(const struct flashrom_flashctx *);
#endif /* !__LAYOUT_H__ */
To view, visit change 62554. To unsubscribe, or for help writing mail filters, visit settings.