Thread (154 messages) 154 messages, 16 authors, 2017-02-01
STALE3425d
Revisions (4)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]

[PATCH v1 2/7] tools: add a basic tools printk.h

From: mcgrof@kernel.org
Date: 2016-08-19 21:41:30
Also in: linux-kbuild, linux-sh, platform-driver-x86, sparclinux, xen-devel
Subsystem: the rest · Maintainer: Linus Torvalds

From: "Luis R. Rodriguez" <mcgrof@kernel.org>

This will be used later by the userspace linker-tables sandbox.
Since upstream kernel.h includes printk.h mimic this so we can
match and replicate C code as-is on userspace sandbox tools.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
 tools/include/linux/kernel.h |  1 +
 tools/include/linux/printk.h | 14 ++++++++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 tools/include/linux/printk.h
diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h
index 3d385a6d4fc1..afdf760bf35c 100644
--- a/tools/include/linux/kernel.h
+++ b/tools/include/linux/kernel.h
@@ -6,6 +6,7 @@
 #include <assert.h>
 
 #include <linux/bug.h>
+#include <linux/printk.h>
 
 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
 
diff --git a/tools/include/linux/printk.h b/tools/include/linux/printk.h
new file mode 100644
index 000000000000..7e34e9c817e8
--- /dev/null
+++ b/tools/include/linux/printk.h
@@ -0,0 +1,14 @@
+#ifndef __TOOLS_KERNEL_PRINTK__
+#define __TOOLS_KERNEL_PRINTK__
+
+#include <stdio.h>
+
+#ifndef pr_fmt
+#define pr_fmt(fmt)	fmt
+#endif
+
+#define pr_info(fmt, ...)	printf(pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_err(fmt, ...)	printf(pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_debug(fmt, ...)	printf(pr_fmt(fmt), ##__VA_ARGS__)
+
+#endif /* __TOOLS_KERNEL_PRINTK__ */
-- 
2.9.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help