aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Peterson <joe@skyrush.com>2009-09-09 17:03:13 -0400
committerLive-CD User <linux@linux.site>2009-09-19 16:13:34 -0400
commitee5aa7b8b98774f408d20a2f61f97a89ac66c29b (patch)
tree76a794dff90c687bb7a400f7edfa994f983d7287
parentfe1ae7fdd2ee603f2d95f04e09a68f7f79045127 (diff)
n_tty: honor opost flag for echoes
Fixes the following bug: http://bugs.linuxbase.org/show_bug.cgi?id=2692 Causes processing of echoed characters (output from the echo buffer) to honor the O_OPOST flag, which is consistent with the old behavior. Note that this and the next patch ("n_tty: move echoctl check and clean up logic") were verified together by the bug reporters, and the test now passes. Signed-off-by: Joe Peterson <joe@skyrush.com> Cc: Linux Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/char/n_tty.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index 4e28b35024ec..e6eeeb234e5d 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -272,7 +272,8 @@ static inline int is_continuation(unsigned char c, struct tty_struct *tty)
272 * 272 *
273 * This is a helper function that handles one output character 273 * This is a helper function that handles one output character
274 * (including special characters like TAB, CR, LF, etc.), 274 * (including special characters like TAB, CR, LF, etc.),
275 * putting the results in the tty driver's write buffer. 275 * doing OPOST processing and putting the results in the
276 * tty driver's write buffer.
276 * 277 *
277 * Note that Linux currently ignores TABDLY, CRDLY, VTDLY, FFDLY 278 * Note that Linux currently ignores TABDLY, CRDLY, VTDLY, FFDLY
278 * and NLDLY. They simply aren't relevant in the world today. 279 * and NLDLY. They simply aren't relevant in the world today.
@@ -350,8 +351,9 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
350 * @c: character (or partial unicode symbol) 351 * @c: character (or partial unicode symbol)
351 * @tty: terminal device 352 * @tty: terminal device
352 * 353 *
353 * Perform OPOST processing. Returns -1 when the output device is 354 * Output one character with OPOST processing.
354 * full and the character must be retried. 355 * Returns -1 when the output device is full and the character
356 * must be retried.
355 * 357 *
356 * Locking: output_lock to protect column state and space left 358 * Locking: output_lock to protect column state and space left
357 * (also, this is called from n_tty_write under the 359 * (also, this is called from n_tty_write under the
@@ -377,8 +379,11 @@ static int process_output(unsigned char c, struct tty_struct *tty)
377/** 379/**
378 * process_output_block - block post processor 380 * process_output_block - block post processor
379 * @tty: terminal device 381 * @tty: terminal device
380 * @inbuf: user buffer 382 * @buf: character buffer
381 * @nr: number of bytes 383 * @nr: number of bytes to output
384 *
385 * Output a block of characters with OPOST processing.
386 * Returns the number of characters output.
382 * 387 *
383 * This path is used to speed up block console writes, among other 388 * This path is used to speed up block console writes, among other
384 * things when processing blocks of output data. It handles only 389 * things when processing blocks of output data. It handles only
@@ -605,12 +610,18 @@ static void process_echoes(struct tty_struct *tty)
605 if (no_space_left) 610 if (no_space_left)
606 break; 611 break;
607 } else { 612 } else {
608 int retval; 613 if (O_OPOST(tty) &&
609 614 !(test_bit(TTY_HW_COOK_OUT, &tty->flags))) {
610 retval = do_output_char(c, tty, space); 615 int retval = do_output_char(c, tty, space);
611 if (retval < 0) 616 if (retval < 0)
612 break; 617 break;
613 space -= retval; 618 space -= retval;
619 } else {
620 if (!space)
621 break;
622 tty_put_char(tty, c);
623 space -= 1;
624 }
614 cp += 1; 625 cp += 1;
615 nr -= 1; 626 nr -= 1;
616 } 627 }