1 commit ee5aa7b8b98774f408d20a2f61f97a89ac66c29b
2 Author: Joe Peterson <joe@skyrush.com>
3 Date: Wed Sep 9 15:03:13 2009 -0600
5 n_tty: honor opost flag for echoes
7 Fixes the following bug:
9 http://bugs.linuxbase.org/show_bug.cgi?id=2692
11 Causes processing of echoed characters (output from the echo buffer) to
12 honor the O_OPOST flag, which is consistent with the old behavior.
14 Note that this and the next patch ("n_tty: move echoctl check and
15 clean up logic") were verified together by the bug reporters, and
18 Signed-off-by: Joe Peterson <joe@skyrush.com>
19 Cc: Linux Torvalds <torvalds@linux-foundation.org>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
22 diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
23 index 4e28b35..e6eeeb2 100644
24 --- a/drivers/char/n_tty.c
25 +++ b/drivers/char/n_tty.c
26 @@ -272,7 +272,8 @@ static inline int is_continuation(unsigned char c, struct tty_struct *tty)
28 * This is a helper function that handles one output character
29 * (including special characters like TAB, CR, LF, etc.),
30 - * putting the results in the tty driver's write buffer.
31 + * doing OPOST processing and putting the results in the
32 + * tty driver's write buffer.
34 * Note that Linux currently ignores TABDLY, CRDLY, VTDLY, FFDLY
35 * and NLDLY. They simply aren't relevant in the world today.
36 @@ -350,8 +351,9 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
37 * @c: character (or partial unicode symbol)
38 * @tty: terminal device
40 - * Perform OPOST processing. Returns -1 when the output device is
41 - * full and the character must be retried.
42 + * Output one character with OPOST processing.
43 + * Returns -1 when the output device is full and the character
46 * Locking: output_lock to protect column state and space left
47 * (also, this is called from n_tty_write under the
48 @@ -377,8 +379,11 @@ static int process_output(unsigned char c, struct tty_struct *tty)
50 * process_output_block - block post processor
51 * @tty: terminal device
52 - * @inbuf: user buffer
53 - * @nr: number of bytes
54 + * @buf: character buffer
55 + * @nr: number of bytes to output
57 + * Output a block of characters with OPOST processing.
58 + * Returns the number of characters output.
60 * This path is used to speed up block console writes, among other
61 * things when processing blocks of output data. It handles only
62 @@ -605,12 +610,18 @@ static void process_echoes(struct tty_struct *tty)
68 - retval = do_output_char(c, tty, space);
73 + !(test_bit(TTY_HW_COOK_OUT, &tty->flags))) {
74 + int retval = do_output_char(c, tty, space);
81 + tty_put_char(tty, c);