From b792b44e14c696a53ef0abf611a2259401d68dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20V=C3=A1zquez=20Blanco?= Date: Thu, 14 Nov 2024 09:35:46 +0100 Subject: [PATCH] Extract cli_output declarations to a separate header. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://review.coreboot.org/c/flashrom/+/85134 Tested-by: build bot (Jenkins) Reviewed-by: Anastasia Klimchuk --- cli_classic.c | 1 + cli_output.c | 3 ++- include/cli_output.h | 31 +++++++++++++++++++++++++++++++ include/flash.h | 9 +-------- 4 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 include/cli_output.h diff --git a/cli_classic.c b/cli_classic.c index f622720c7..1a0565bf8 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "flash.h" #include "flashchips.h" #include "fmap.h" diff --git a/cli_output.c b/cli_output.c index 20295b899..a8b8d7cf6 100644 --- a/cli_output.c +++ b/cli_output.c @@ -15,11 +15,12 @@ * GNU General Public License for more details. */ +#include + #include #include #include #include -#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 000000000..3a3db88ee --- /dev/null +++ b/include/cli_output.h @@ -0,0 +1,31 @@ +/* + * This file is part of the flashrom project. + * + * Copyright 2024 Antonio Vázquez Blanco + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __CLI_OUTPUT_H__ +#define __CLI_OUTPUT_H__ + +#include +#include + +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 a1f15514e..629ef3a3f 100644 --- a/include/flash.h +++ b/include/flash.h @@ -726,14 +726,7 @@ struct cli_progress { /* 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__