summaryrefslogtreecommitdiffstats
path: root/util/cbfstool/common.h
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2021-06-25 23:55:51 -0700
committerFurquan Shaikh <furquan@google.com>2021-10-18 21:15:41 +0000
commit2bfef8d856f9f5cc0fcadefd1fd92c249ac6bfd8 (patch)
treec41890d955ee59596a63b014b8d40a57bf12e93d /util/cbfstool/common.h
parent967730f5656e433094d97e65ce6927734d7112c7 (diff)
downloadcoreboot-2bfef8d856f9f5cc0fcadefd1fd92c249ac6bfd8.tar.gz
coreboot-2bfef8d856f9f5cc0fcadefd1fd92c249ac6bfd8.tar.bz2
coreboot-2bfef8d856f9f5cc0fcadefd1fd92c249ac6bfd8.zip
cbfstool: Add helper function `buffer_from_file_aligned_size`
This change adds a helper function `buffer_from_file_aligned_size` that loads a file into memory buffer by creating a memory buffer of size rounded up to the provided `size_granularity` parameter. BUG=b:189177186,b:189167923 Change-Id: Iad3430d476abcdad850505ac50e36cd5d5deecb4 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55989 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'util/cbfstool/common.h')
-rw-r--r--util/cbfstool/common.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h
index 07ffdf82317e..b23c8d21b0ad 100644
--- a/util/cbfstool/common.h
+++ b/util/cbfstool/common.h
@@ -132,6 +132,11 @@ int buffer_create(struct buffer *buffer, size_t size, const char *name);
/* Loads a file into memory buffer. Returns 0 on success, otherwise non-zero. */
int buffer_from_file(struct buffer *buffer, const char *filename);
+/* Loads a file into memory buffer (with buffer size rounded up to a multiple of
+ size_granularity). Returns 0 on success, otherwise non-zero. */
+int buffer_from_file_aligned_size(struct buffer *buffer, const char *filename,
+ size_t size_granularity);
+
/* Writes memory buffer content into file.
* Returns 0 on success, otherwise non-zero. */
int buffer_write_file(struct buffer *buffer, const char *filename);