[coreboot] Patch merged into coreboot/master: 3cfacbf cbfstool: Add buffer management API.
gerrit at coreboot.org
gerrit at coreboot.org
Tue Feb 5 22:24:47 CET 2013
the following patch was just integrated into master:
commit 3cfacbf1961accff8670997368b403d8068ad94c
Author: Hung-Te Lin <hungte at chromium.org>
Date: Wed Jan 30 00:43:46 2013 +0800
cbfstool: Add buffer management API.
Many functions in cbfstool need to deal with a memory buffer - both location and
size. Right now it's made by different ways: for ROM image using global variable
(romsize, master_header); and in cbfs-* using return value for size and char**
to return memory location.
This may cause bugs like assuming incorrect return types, ex:
uint32_t file_size = parse(); // which returns "-1" on error
if (file_size <= 0) { ...
And the parse error will never be caught.
We can simplify this by introducing a buffer API, to change
unsigned int do_something(char *input, size_t len, char **output, ...)
into
int do_something(struct buffer *input, struct buffer *output, ...)
The buffer API will be used by further commits.
Change-Id: Iaddaeb109f08be6be84c6728d72c6a043b0e7a9f
Signed-off-by: Hung-Te Lin <hungte at chromium.org>
Reviewed-on: http://review.coreboot.org/2205
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer at coreboot.org>
Build-Tested: build bot (Jenkins) at Mon Feb 4 23:18:18 2013, giving +1
Reviewed-By: Stefan Reinauer <stefan.reinauer at coreboot.org> at Tue Feb 5 22:24:45 2013, giving +2
See http://review.coreboot.org/2205 for details.
-gerrit
More information about the coreboot
mailing list