summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-09-30 10:26:20 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-09-30 15:33:22 +0200
commit930ce6e142354268d11ec9fe5cf6f4fc66a8f1f0 (patch)
treed924b3a215a8dac31e35c1e83ebf3440545d353e /include
parent6ae9a40c799dd341db985c95cc906ae2e0aacf97 (diff)
downloadbarebox-930ce6e142354268d11ec9fe5cf6f4fc66a8f1f0.tar.gz
barebox-930ce6e142354268d11ec9fe5cf6f4fc66a8f1f0.tar.xz
Introduce message logging support
This adds a buffer for log messages and a 'dmesg' command to print the messages. The log buffer is implemented as log objects rather than a string buffer. This makes it easy to implement limiting the messages, cleaning the buffer and timestamping the messages. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/printk.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/printk.h b/include/printk.h
index 454315632b..fb635868ab 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -72,4 +72,21 @@ int dev_printf(int level, const struct device_d *dev, const char *format, ...)
#define debug(fmt, arg...) __pr_printk(7, pr_fmt(fmt), ##arg)
#define pr_vdebug(fmt, arg...) __pr_printk(8, pr_fmt(fmt), ##arg)
+struct log_entry {
+ struct list_head list;
+ char *msg;
+ void *dummy;
+ uint64_t timestamp;
+ int level;
+};
+
+extern struct list_head barebox_logbuf;
+
+extern void log_clean(unsigned int limit);
+
+#define BAREBOX_LOG_PRINT_TIME (1 << 0)
+#define BAREBOX_LOG_DIFF_TIME (1 << 1)
+
+void log_print(unsigned flags);
+
#endif