summaryrefslogtreecommitdiff
path: root/util/cbfstool/cbfs_image.c
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2014-12-23 15:59:57 -0800
committerPatrick Georgi <pgeorgi@google.com>2015-04-18 08:50:38 +0200
commit45e5997c61b7decdaebf48a47dc15040c96de3dc (patch)
tree335837f25756313752fd853c4017823cdce73cb6 /util/cbfstool/cbfs_image.c
parent1161473ecb65844ee24359b0b943a33a696eea24 (diff)
downloadcoreboot-45e5997c61b7decdaebf48a47dc15040c96de3dc.tar.xz
cbfstool: clean up source code
The following changes were made: - order commands and options definitions alphabetically - do not report errors at cbfs_image_from_file() call sites - the error is reported by the function itself - remove the unused parameter in cbfs_create_empty_entry() prototype BRANCH=storm BUG=none TEST=compiled cbfstool, built a storm image, observed that the image still boots Change-Id: I31b15fab0a63749c6f2d351901ed545de531eb39 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: a909a50e03be77f972b1a497198fe758661aa9f8 Original-Change-Id: I4b8898dbd44eeb2c6b388a485366e4e22b1bed16 Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/237560 Original-Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: http://review.coreboot.org/9746 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util/cbfstool/cbfs_image.c')
-rw-r--r--util/cbfstool/cbfs_image.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index 9df2030679..e3f3e4eec1 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -262,7 +262,7 @@ int cbfs_image_create(struct cbfs_image *image,
if (header_offset > entries_offset && header_offset < cbfs_len)
cbfs_len = header_offset;
cbfs_len -= entries_offset + align + entry_header_len;
- cbfs_create_empty_entry(image, entry, cbfs_len, "");
+ cbfs_create_empty_entry(entry, cbfs_len, "");
LOG("Created CBFS image (capacity = %d bytes)\n", cbfs_len);
return 0;
}
@@ -371,7 +371,7 @@ int cbfs_copy_instance(struct cbfs_image *image, size_t copy_offset,
if (last_entry_size < 0)
WARN("No room to create the last entry!\n")
else
- cbfs_create_empty_entry(image, dst_entry, last_entry_size, "");
+ cbfs_create_empty_entry(dst_entry, last_entry_size, "");
return 0;
}
@@ -421,14 +421,14 @@ static int cbfs_add_entry_at(struct cbfs_image *image,
if (target - addr > min_entry_size) {
DEBUG("|min|...|header|content|... <create new entry>\n");
len = target - addr - min_entry_size;
- cbfs_create_empty_entry(image, entry, len, "");
+ cbfs_create_empty_entry(entry, len, "");
if (verbose > 1) cbfs_print_entry_info(image, entry, stderr);
entry = cbfs_find_next_entry(image, entry);
addr = cbfs_get_entry_addr(image, entry);
}
len = size + (content_offset - addr - header_size);
- cbfs_create_empty_entry(image, entry, len, name);
+ cbfs_create_empty_entry(entry, len, name);
if (len != size) {
DEBUG("|..|header|content|... <use offset to create entry>\n");
DEBUG("before: offset=0x%x, len=0x%x\n",
@@ -462,7 +462,7 @@ static int cbfs_add_entry_at(struct cbfs_image *image,
}
len = addr_next - addr - min_entry_size;
- cbfs_create_empty_entry(image, entry, len, "");
+ cbfs_create_empty_entry(entry, len, "");
if (verbose > 1) cbfs_print_entry_info(image, entry, stderr);
return 0;
}
@@ -518,8 +518,7 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
if (!content_offset || content_offset == addr + header_size) {
DEBUG("Filling new entry data (%zd bytes).\n",
buffer->size);
- cbfs_create_empty_entry(image, entry, buffer->size,
- name);
+ cbfs_create_empty_entry(entry, buffer->size, name);
entry->type = htonl(type);
memcpy(CBFS_SUBHEADER(entry), buffer->data, buffer->size);
if (verbose)
@@ -542,7 +541,7 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
}
new_size -= cbfs_calculate_file_header_size("");
DEBUG("new size: %d\n", new_size);
- cbfs_create_empty_entry(image, entry, new_size, "");
+ cbfs_create_empty_entry(entry, new_size, "");
if (verbose)
cbfs_print_entry_info(image, entry, stderr);
return 0;
@@ -827,7 +826,7 @@ int cbfs_merge_empty_entry(struct cbfs_image *image, struct cbfs_file *entry,
DEBUG("join_empty_entry: combine 0x%x+0x%x and 0x%x+0x%x.\n",
cbfs_get_entry_addr(image, entry), ntohl(entry->len),
cbfs_get_entry_addr(image, next), ntohl(next->len));
- cbfs_create_empty_entry(image, entry,
+ cbfs_create_empty_entry(entry,
(last_addr - addr -
cbfs_calculate_file_header_size("")),
"");
@@ -943,8 +942,8 @@ int cbfs_is_valid_entry(struct cbfs_image *image, struct cbfs_file *entry)
sizeof(entry->magic)) == 0);
}
-int cbfs_create_empty_entry(struct cbfs_image *image, struct cbfs_file *entry,
- size_t len, const char *name)
+int cbfs_create_empty_entry(struct cbfs_file *entry,
+ size_t len, const char *name)
{
memset(entry, CBFS_CONTENT_DEFAULT_VALUE, sizeof(*entry));
memcpy(entry->magic, CBFS_FILE_MAGIC, sizeof(entry->magic));