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>
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user