summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBernhard Walle <bernhard@bwalle.de>2009-12-14 18:00:43 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-15 08:53:28 -0800
commit5ada918b82399eef3afd6a71e3637697d6bd719f (patch)
tree9bff5251d9d21960726078c2117a0ab19ca25956 /include
parentc95d1e53ed89b75a4d7b68d1cbae4607b1479243 (diff)
downloadlinux-5ada918b82399eef3afd6a71e3637697d6bd719f.tar.bz2
vt: introduce and use vt_kmsg_redirect() function
The kernel offers with TIOCL_GETKMSGREDIRECT ioctl() the possibility to redirect the kernel messages to a specific console. However, since it's not possible to switch to the kernel message console after a panic(), it would be nice if the kernel would print the panic message on the current console. This patch series adds a new interface to access the global kmsg_redirect variable by a function to be able to use it in code where CONFIG_VT_CONSOLE is not set (kernel/panic.c). This patch: Instead of using and exporting a global value kmsg_redirect, introduce a function vt_kmsg_redirect() that both can set and return the console where messages are printed. Change all users of kmsg_redirect (the VT code itself and kernel/power.c) to the new interface. The main advantage is that vt_kmsg_redirect() can also be used when CONFIG_VT_CONSOLE is not set. Signed-off-by: Bernhard Walle <bernhard@bwalle.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/vt.h15
2 files changed, 15 insertions, 2 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 405a9035fe40..ef3a2947b102 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -350,8 +350,6 @@ extern void tty_write_flush(struct tty_struct *);
extern struct ktermios tty_std_termios;
-extern int kmsg_redirect;
-
extern void console_init(void);
extern int vcs_init(void);
diff --git a/include/linux/vt.h b/include/linux/vt.h
index 7ffa11f06232..3fb9944e50a6 100644
--- a/include/linux/vt.h
+++ b/include/linux/vt.h
@@ -84,4 +84,19 @@ struct vt_setactivate {
#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */
+#ifdef CONFIG_VT_CONSOLE
+
+extern int vt_kmsg_redirect(int new);
+
+#else
+
+static inline int vt_kmsg_redirect(int new)
+{
+ return 0;
+}
+
+#endif
+
+#define vt_get_kmsg_redirect() vt_kmsg_redirect(-1)
+
#endif /* _LINUX_VT_H */