summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2019-06-15 17:33:49 +0200
committerNico Huber <nico.h@gmx.de>2019-06-17 08:31:18 +0000
commit4f213285d78974c4b8915b311aff88449279f554 (patch)
tree6927f36d10acff0bee42054d881072354dff192c
parent2b94cdb5cb2a33958b2b0165e02bec17a58a8494 (diff)
downloadflashrom-4f213285d78974c4b8915b311aff88449279f554.tar.gz
flashrom-4f213285d78974c4b8915b311aff88449279f554.tar.bz2
flashrom-4f213285d78974c4b8915b311aff88449279f554.zip
layout: Move generic layout functions into `layout.c`
Change-Id: If1edde70fc51e88e6e1c560d79a0d51941b9627c Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/33514 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
-rw-r--r--Doxyfile3
-rw-r--r--layout.c41
-rw-r--r--libflashrom.c34
3 files changed, 43 insertions, 35 deletions
diff --git a/Doxyfile b/Doxyfile
index d2a769541..6906cc82c 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -782,7 +782,8 @@ WARN_LOGFILE =
INPUT = libflashrom.c \
libflashrom.h \
- flashrom.c
+ flashrom.c \
+ layout.c \
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
diff --git a/layout.c b/layout.c
index 6e348144b..6963e61a1 100644
--- a/layout.c
+++ b/layout.c
@@ -244,3 +244,44 @@ const struct romentry *layout_next_included_region(
return lowest;
}
+
+/**
+ * @addtogroup flashrom-layout
+ * @{
+ */
+
+/**
+ * @brief Mark given region as included.
+ *
+ * @param layout The layout to alter.
+ * @param name The name of the region to include.
+ *
+ * @return 0 on success,
+ * 1 if the given name can't be found.
+ */
+int flashrom_layout_include_region(struct flashrom_layout *const layout, const char *name)
+{
+ size_t i;
+ for (i = 0; i < layout->num_entries; ++i) {
+ if (!strcmp(layout->entries[i].name, name)) {
+ layout->entries[i].included = true;
+ return 0;
+ }
+ }
+ return 1;
+}
+
+/**
+ * @brief Free a layout.
+ *
+ * @param layout Layout to free.
+ */
+void flashrom_layout_release(struct flashrom_layout *const layout)
+{
+ if (layout == get_global_layout())
+ return;
+
+ free(layout);
+}
+
+/** @} */ /* end flashrom-layout */
diff --git a/libflashrom.c b/libflashrom.c
index fee60ffd1..721a11cfc 100644
--- a/libflashrom.c
+++ b/libflashrom.c
@@ -283,27 +283,6 @@ bool flashrom_flag_get(const struct flashrom_flashctx *const flashctx, const enu
*/
/**
- * @brief Mark given region as included.
- *
- * @param layout The layout to alter.
- * @param name The name of the region to include.
- *
- * @return 0 on success,
- * 1 if the given name can't be found.
- */
-int flashrom_layout_include_region(struct flashrom_layout *const layout, const char *name)
-{
- size_t i;
- for (i = 0; i < layout->num_entries; ++i) {
- if (!strcmp(layout->entries[i].name, name)) {
- layout->entries[i].included = true;
- return 0;
- }
- }
- return 1;
-}
-
-/**
* @brief Read a layout from the Intel ICH descriptor in the flash.
*
* Optionally verify that the layout matches the one in the given
@@ -507,19 +486,6 @@ _ret:
}
/**
- * @brief Free a layout.
- *
- * @param layout Layout to free.
- */
-void flashrom_layout_release(struct flashrom_layout *const layout)
-{
- if (layout == get_global_layout())
- return;
-
- free(layout);
-}
-
-/**
* @brief Set the active layout for a flash context.
*
* Note: This just sets a pointer. The caller must not release the layout