summaryrefslogtreecommitdiffstats
path: root/layout.c
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2019-06-15 22:29:08 +0200
committerNico Huber <nico.h@gmx.de>2019-06-17 08:33:09 +0000
commit5ca5523fd8f6800c32cbc8f3724b393e791cebd6 (patch)
treef68209e48c9c54006a5af5c09e6d0b5d4ad1c9d9 /layout.c
parent70461a9524fc84ec5c095f11927cffa0429a6267 (diff)
downloadflashrom-5ca5523fd8f6800c32cbc8f3724b393e791cebd6.tar.gz
flashrom-5ca5523fd8f6800c32cbc8f3724b393e791cebd6.tar.bz2
flashrom-5ca5523fd8f6800c32cbc8f3724b393e791cebd6.zip
layout: Introduce layout_next_included()
Change-Id: Ib01c8af06c3f84eafbd585760e74c3c287b9fa7d Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/33518 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'layout.c')
-rw-r--r--layout.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/layout.c b/layout.c
index 52aa3882e..e49189eb4 100644
--- a/layout.c
+++ b/layout.c
@@ -252,6 +252,24 @@ const struct romentry *layout_next_included_region(
return lowest;
}
+const struct romentry *layout_next_included(
+ const struct flashrom_layout *const layout, const struct romentry *iterator)
+{
+ const struct romentry *const end = layout->entries + layout->num_entries;
+
+ if (iterator)
+ ++iterator;
+ else
+ iterator = &layout->entries[0];
+
+ for (; iterator < end; ++iterator) {
+ if (!iterator->included)
+ continue;
+ return iterator;
+ }
+ return NULL;
+}
+
/**
* @addtogroup flashrom-layout
* @{