[coreboot-gerrit] New patch to review for coreboot: cbfstool: Deduplicate code to merge empty files

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Fri Jul 17 22:08:43 CEST 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10967

-gerrit

commit 4df6e14683e6fbcf441ca9af5800ba3b6619bff4
Author: Patrick Georgi <pgeorgi at 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 at georgi-clan.de>
---
 util/cbfstool/cbfs_image.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index 6f028c8..5bd98ab 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -701,18 +701,10 @@ int cbfs_remove_entry(struct cbfs_image *image, const char *name)
 		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;
 }
 



More information about the coreboot-gerrit mailing list