Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10967
-gerrit
commit 1125eaaad2332eedb2b36d3ed5c657da5fd21cf4 Author: Patrick Georgi pgeorgi@chromium.org Date: Fri Jul 17 22:07:26 2015 +0200
cbfstool: Deduplicate code to merge empty files
The code for removing a file had its own merge routine. Use the generic one instead.
Change-Id: I90ed007ab86f78a2728f529fa0143c5c1dfbbdc3 Signed-off-by: Patrick Georgi patrick@georgi-clan.de --- util/cbfstool/cbfs_image.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index 6f028c8..05593ff 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -694,25 +694,16 @@ int cbfs_export_entry(struct cbfs_image *image, const char *entry_name,
int cbfs_remove_entry(struct cbfs_image *image, const char *name) { - struct cbfs_file *entry, *next; - size_t len; + struct cbfs_file *entry; entry = cbfs_get_entry(image, name); if (!entry) { ERROR("CBFS file %s not found.\n", name); return -1; } - next = cbfs_find_next_entry(image, entry); - assert(next); DEBUG("cbfs_remove_entry: Removed %s @ 0x%x\n", entry->filename, cbfs_get_entry_addr(image, entry)); entry->type = htonl(CBFS_COMPONENT_DELETED); - len = (cbfs_get_entry_addr(image, next) - - cbfs_get_entry_addr(image, entry)); - entry->offset = htonl(cbfs_calculate_file_header_size("")); - entry->len = htonl(len - ntohl(entry->offset)); - memset(entry->filename, 0, ntohl(entry->offset) - sizeof(*entry)); - memset(CBFS_SUBHEADER(entry), CBFS_CONTENT_DEFAULT_VALUE, - ntohl(entry->len)); + cbfs_walk(image, cbfs_merge_empty_entry, NULL); return 0; }