diff options
author | Alan Cox <alan@redhat.com> | 2008-10-13 05:39:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 12:51:41 -0400 |
commit | 95f9bfc6b76e862265a2d70ae061eec18fe14140 (patch) | |
tree | 88e72e0d31b9f368d5c9dcb3e0d92994effe5edc /drivers | |
parent | 452a00d2ee288f2cbc36f676edd06cb14d2878c1 (diff) |
tty: Move tty_write_message out of kernel/printk
This is pure tty code so put it in the tty layer where it can be with the
locking relevant material it uses
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/tty_io.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 4c0e4ed31a48..913b50258f90 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -1081,6 +1081,31 @@ out: | |||
1081 | return ret; | 1081 | return ret; |
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | /** | ||
1085 | * tty_write_message - write a message to a certain tty, not just the console. | ||
1086 | * @tty: the destination tty_struct | ||
1087 | * @msg: the message to write | ||
1088 | * | ||
1089 | * This is used for messages that need to be redirected to a specific tty. | ||
1090 | * We don't put it into the syslog queue right now maybe in the future if | ||
1091 | * really needed. | ||
1092 | * | ||
1093 | * We must still hold the BKL and test the CLOSING flag for the moment. | ||
1094 | */ | ||
1095 | |||
1096 | void tty_write_message(struct tty_struct *tty, char *msg) | ||
1097 | { | ||
1098 | lock_kernel(); | ||
1099 | if (tty) { | ||
1100 | mutex_lock(&tty->atomic_write_lock); | ||
1101 | if (tty->ops->write && !test_bit(TTY_CLOSING, &tty->flags)) | ||
1102 | tty->ops->write(tty, msg, strlen(msg)); | ||
1103 | tty_write_unlock(tty); | ||
1104 | } | ||
1105 | unlock_kernel(); | ||
1106 | return; | ||
1107 | } | ||
1108 | |||
1084 | 1109 | ||
1085 | /** | 1110 | /** |
1086 | * tty_write - write method for tty device file | 1111 | * tty_write - write method for tty device file |