summaryrefslogtreecommitdiff
path: root/util/cbfstool/fmd.c
diff options
context:
space:
mode:
authorSol Boucher <solb@chromium.org>2015-03-18 10:13:48 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2015-05-08 20:33:22 +0200
commitb974081c13ad203a78fcdb28021706f55eaa5010 (patch)
tree08a3090babe8568168354146f4f49b05aee13ae3 /util/cbfstool/fmd.c
parente3260a042f438cedb446c5e7b3dc6f55a3b9aa95 (diff)
downloadcoreboot-b974081c13ad203a78fcdb28021706f55eaa5010.tar.xz
fmaptool: Conform to cbfstool's error message format
The tool now makes use of the ERROR() macros from common.h. Change-Id: Ie38f40c65f7b6d3bc2adb97e246224cd38d4cb99 Signed-off-by: Sol Boucher <solb@chromium.org> Reviewed-on: http://review.coreboot.org/10048 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util/cbfstool/fmd.c')
-rw-r--r--util/cbfstool/fmd.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/util/cbfstool/fmd.c b/util/cbfstool/fmd.c
index bfce0490cd..a4430bed58 100644
--- a/util/cbfstool/fmd.c
+++ b/util/cbfstool/fmd.c
@@ -19,6 +19,7 @@
#include "fmd.h"
+#include "common.h"
#include "fmd_parser.h"
#include "fmd_scanner.h"
#include "option.h"
@@ -56,8 +57,7 @@ static bool validate_descriptor_node(const struct flashmap_descriptor *node,
ENTRY search_key = {node->name, NULL};
if (hsearch(search_key, FIND)) {
- fprintf(stderr, "ERROR: Multiple sections with name '%s'\n",
- node->name);
+ ERROR("Multiple sections with name '%s'\n", node->name);
return false;
}
if (!hsearch(search_key, ENTER))
@@ -65,26 +65,22 @@ static bool validate_descriptor_node(const struct flashmap_descriptor *node,
if (node->offset_known) {
if (start.val_known && node->offset < start.val) {
- fprintf(stderr, "ERROR: Section '%s' starts too low\n",
- node->name);
+ ERROR("Section '%s' starts too low\n", node->name);
return false;
} else if (end.val_known && node->offset > end.val) {
- fprintf(stderr, "ERROR: Section '%s' starts too high\n",
- node->name);
+ ERROR("Section '%s' starts too high\n", node->name);
return false;
}
}
if (node->size_known) {
if (node->size == 0) {
- fprintf(stderr, "ERROR: Section '%s' given no space\n",
- node->name);
+ ERROR("Section '%s' given no space\n", node->name);
return false;
} else if (node->offset_known) {
unsigned node_end = node->offset + node->size;
if (end.val_known && node_end > end.val) {
- fprintf(stderr, "ERROR: Section '%s' too big\n",
- node->name);
+ ERROR("Section '%s' too big\n", node->name);
return false;
}
}
@@ -120,16 +116,14 @@ static bool complete_missing_info_backward(
assert(cur->offset_known || cur->size_known);
if (!cur->offset_known) {
if (cur->size > end_watermark) {
- fprintf(stderr, "ERROR: Section '%s' too big\n",
- cur->name);
+ ERROR("Section '%s' too big\n", cur->name);
return false;
}
cur->offset_known = true;
cur->offset = end_watermark -= cur->size;
} else if (!cur->size_known) {
if (cur->offset > end_watermark) {
- fprintf(stderr,
- "ERROR: Section '%s' starts too high\n",
+ ERROR("Section '%s' starts too high\n",
cur->name);
return false;
}
@@ -230,8 +224,7 @@ static bool validate_and_complete_info(struct flashmap_descriptor *cur_level)
if (!cur_section->size_known) {
if (!cur_section->offset_known) {
- fprintf(stderr,
- "ERROR: Cannot determine either offset or size of section '%s'\n",
+ ERROR("Cannot determine either offset or size of section '%s'\n",
cur_section->name);
return false;
} else if (!first_incomplete_it) {
@@ -315,7 +308,7 @@ struct flashmap_descriptor *fmd_create(FILE *stream)
// This hash table is used to store the declared name of each
// section and ensure that each is globally unique.
if (!hcreate(fmd_count_nodes(ret))) {
- perror("ERROR: While initializing hashtable");
+ perror("E: While initializing hashtable");
fmd_cleanup(ret);
return NULL;
}