summaryrefslogtreecommitdiff
path: root/futility/updater.h
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2018-09-28 19:41:57 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-10-02 09:17:11 -0700
commitb95aa03f38d2073e68968145c99a216e4d45084f (patch)
tree03fc1617651ba3ed01999cd750579107cc5da1f0 /futility/updater.h
parentbbe5fda1e8f35bd242ba2e2766a110bada4389e4 (diff)
downloadvboot-b95aa03f38d2073e68968145c99a216e4d45084f.tar.gz
futility: updater: Revise verbosity and error messages
`futility` used to print debug messages to stdout, but there is a side effect that stdout may be buffered and then flush later than stderr. For example, when calling futility via ssh, we will see flashrom messages before any of futility's own messages. Also, many people want to get flashrom verbose messages (-V). With this change, when calling ERROR and DEBUG, we will always output to stderr. This also enables better parameter type checking. `-d` and `-v` both contribute to verbosity, that will be converted to -V's when calling flashrom. BUG=chromium:875551 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I1d22a8054fc43cdc5e6c7415e131cc9826fbff0c Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1251145
Diffstat (limited to 'futility/updater.h')
-rw-r--r--futility/updater.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/futility/updater.h b/futility/updater.h
index 58445a1c..3993f073 100644
--- a/futility/updater.h
+++ b/futility/updater.h
@@ -8,11 +8,15 @@
#ifndef VBOOT_REFERENCE_FUTILITY_UPDATER_H_
#define VBOOT_REFERENCE_FUTILITY_UPDATER_H_
+#include <stdio.h>
+
#include "fmap.h"
-#include "futility.h"
-#define DEBUG(format, ...) Debug("%s: " format "\n", __FUNCTION__,##__VA_ARGS__)
-#define ERROR(format, ...) Error("%s: " format "\n", __FUNCTION__,##__VA_ARGS__)
+extern int debugging_enabled;
+#define DEBUG(format, ...) do { if (debugging_enabled) fprintf(stderr, \
+ "DEBUG: %s: " format "\n", __FUNCTION__, ##__VA_ARGS__); } while (0)
+#define ERROR(format, ...) fprintf(stderr, \
+ "ERROR: %s: " format "\n", __FUNCTION__, ##__VA_ARGS__)
/* FMAP section names. */
static const char * const FMAP_RO_FRID = "RO_FRID",
@@ -97,6 +101,7 @@ struct updater_config {
int try_update;
int force_update;
int legacy_update;
+ int verbosity;
const char *emulation;
};
@@ -153,7 +158,8 @@ int updater_setup_config(struct updater_config *cfg,
const char *write_protection,
int is_factory,
int try_update,
- int force_update);
+ int force_update,
+ int verbosity);
/* Prints the name and description from all supported quirks. */
void updater_list_config_quirks(const struct updater_config *cfg);