aboutsummaryrefslogtreecommitdiff
path: root/include/log.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-01-20 20:10:52 -0700
committerTom Rini <trini@konsulko.com>2021-03-12 17:41:35 -0500
commit79d5983b61e41d5c586489b03e75a75961d31041 (patch)
tree0d2e23263b1656013685cfea2943798ba43389a5 /include/log.h
parentc57ec2c2bab00c02a457ca70624c1333c60c2ec0 (diff)
downloadu-boot-79d5983b61e41d5c586489b03e75a75961d31041.zip
u-boot-79d5983b61e41d5c586489b03e75a75961d31041.tar.gz
u-boot-79d5983b61e41d5c586489b03e75a75961d31041.tar.bz2
log: Set up a flag byte for log records
At present only a single flag (force_debug) is used in log records. Before adding more, convert this into a bitfield, so more can be added without using more space. To avoid expanding the log_record struct itself (which some drivers may wish to store in memory) reduce the line-number field to 16 bits. This provides for up to 64K lines which should be enough for anyone. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/log.h')
-rw-r--r--include/log.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/log.h b/include/log.h
index 2d27f9f..da053b0 100644
--- a/include/log.h
+++ b/include/log.h
@@ -322,6 +322,12 @@ void __assert_fail(const char *assertion, const char *file, unsigned int line,
#define log_msg_ret(_msg, _ret) ((void)(_msg), _ret)
#endif
+/** * enum log_rec_flags - Flags for a log record */
+enum log_rec_flags {
+ /** @LOGRECF_FORCE_DEBUG: Force output of debug record */
+ LOGRECF_FORCE_DEBUG = BIT(0),
+};
+
/**
* struct log_rec - a single log record
*
@@ -337,18 +343,18 @@ void __assert_fail(const char *assertion, const char *file, unsigned int line,
*
* @cat: Category, representing a uclass or part of U-Boot
* @level: Severity level, less severe is higher
- * @force_debug: Force output of debug
- * @file: Name of file where the log record was generated (not allocated)
* @line: Line number where the log record was generated
+ * @flags: Flags for log record (enum log_rec_flags)
+ * @file: Name of file where the log record was generated (not allocated)
* @func: Function where the log record was generated (not allocated)
* @msg: Log message (allocated)
*/
struct log_rec {
enum log_category_t cat;
enum log_level_t level;
- bool force_debug;
+ u16 line;
+ u8 flags;
const char *file;
- int line;
const char *func;
const char *msg;
};