Antonio Vázquez Blanco has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/85134?usp=email )
Change subject: Extract cli_output declarations to a separate header. ......................................................................
Extract cli_output declarations to a separate header.
This is a simple refactor that aims to simplify maintenance and to clarify file dependency inside the project. Currently, many declarations reside in flash.h making it difficult to really understand file dependency.
Change-Id: I4209d5ed205ca14c39e83aa923e103b7282a7059 Signed-off-by: Antonio Vázquez Blanco antoniovazquezblanco@gmail.com --- M cli_classic.c M cli_output.c A include/cli_output.h M include/flash.h 4 files changed, 26 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/34/85134/1
diff --git a/cli_classic.c b/cli_classic.c index 8f37019..e99230c 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -26,6 +26,7 @@ #include <stdlib.h> #include <stdint.h> #include <cli_getopt.h> +#include <cli_output.h> #include "flash.h" #include "flashchips.h" #include "fmap.h" diff --git a/cli_output.c b/cli_output.c index 20295b8..a8b8d7c 100644 --- a/cli_output.c +++ b/cli_output.c @@ -15,11 +15,12 @@ * GNU General Public License for more details. */
+#include <cli_output.h> + #include <stdio.h> #include <stdarg.h> #include <string.h> #include <errno.h> -#include "flash.h"
enum flashrom_log_level verbose_screen = FLASHROM_MSG_INFO; enum flashrom_log_level verbose_logfile = FLASHROM_MSG_DEBUG2; diff --git a/include/cli_output.h b/include/cli_output.h new file mode 100644 index 0000000..70d8590 --- /dev/null +++ b/include/cli_output.h @@ -0,0 +1,22 @@ +/* + * This file is part of the flashrom project. + * + * SPDX-FileCopyrightText: 2024 Antonio Vázquez Blanco antoniovazquezblanco@gmail.com + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef __CLI_OUTPUT_H__ +#define __CLI_OUTPUT_H__ + +#include <stdarg.h> +#include <flash.h> + +extern enum flashrom_log_level verbose_screen; +extern enum flashrom_log_level verbose_logfile; +int open_logfile(const char * const filename); +int close_logfile(void); +void start_logging(void); +int flashrom_print_cb(enum flashrom_log_level level, const char *fmt, va_list ap); +void flashrom_progress_cb(struct flashrom_flashctx *flashctx); + +#endif /* __CLI_OUTPUT_H__ */ diff --git a/include/flash.h b/include/flash.h index a1f1551..629ef3a 100644 --- a/include/flash.h +++ b/include/flash.h @@ -726,14 +726,7 @@ /* cli_common.c */ void print_chip_support_status(const struct flashchip *chip);
-/* cli_output.c */ -extern enum flashrom_log_level verbose_screen; -extern enum flashrom_log_level verbose_logfile; -int open_logfile(const char * const filename); -int close_logfile(void); -void start_logging(void); -int flashrom_print_cb(enum flashrom_log_level level, const char *fmt, va_list ap); -void flashrom_progress_cb(struct flashrom_flashctx *flashctx); +/* libflashrom.c */ /* Let gcc and clang check for correct printf-style format strings. */ int print(enum flashrom_log_level level, const char *fmt, ...) #ifdef __MINGW32__