1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

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>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/85134
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:
Antonio Vázquez Blanco 2024-11-14 09:35:46 +01:00 committed by Anastasia Klimchuk
parent e15c1783e7
commit b792b44e14
4 changed files with 35 additions and 9 deletions

View File

@ -26,6 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <cli_getopt.h> #include <cli_getopt.h>
#include <cli_output.h>
#include "flash.h" #include "flash.h"
#include "flashchips.h" #include "flashchips.h"
#include "fmap.h" #include "fmap.h"

View File

@ -15,11 +15,12 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <cli_output.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include "flash.h"
enum flashrom_log_level verbose_screen = FLASHROM_MSG_INFO; enum flashrom_log_level verbose_screen = FLASHROM_MSG_INFO;
enum flashrom_log_level verbose_logfile = FLASHROM_MSG_DEBUG2; enum flashrom_log_level verbose_logfile = FLASHROM_MSG_DEBUG2;

31
include/cli_output.h Normal file
View File

@ -0,0 +1,31 @@
/*
* This file is part of the flashrom project.
*
* Copyright 2024 Antonio Vázquez Blanco <antoniovazquezblanco@gmail.com>
*
* 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 <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__ */

View File

@ -726,14 +726,7 @@ struct cli_progress {
/* cli_common.c */ /* cli_common.c */
void print_chip_support_status(const struct flashchip *chip); void print_chip_support_status(const struct flashchip *chip);
/* cli_output.c */ /* libflashrom.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);
/* Let gcc and clang check for correct printf-style format strings. */ /* Let gcc and clang check for correct printf-style format strings. */
int print(enum flashrom_log_level level, const char *fmt, ...) int print(enum flashrom_log_level level, const char *fmt, ...)
#ifdef __MINGW32__ #ifdef __MINGW32__