summaryrefslogtreecommitdiff
path: root/drivers/tty/n_tty.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2013-07-24 08:29:51 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-24 09:27:22 -0700
commit4b1f79c2d7352605b567cab49de20d3b67762ee3 (patch)
tree03c9f0dc2b8be9388ad582afe64d72ee70258134 /drivers/tty/n_tty.c
parent855df3c08968beac9d9a86536c43c0474684ac37 (diff)
n_tty: Split n_tty_receive_char()
Factor 'special' per-char processing into standalone fn, n_tty_receive_char_special(), which handles processing for chars marked in the char_map. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/n_tty.c')
-rw-r--r--drivers/tty/n_tty.c103
1 files changed, 56 insertions, 47 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index f2e6bdb319cf..8686124b1309 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1255,57 +1255,12 @@ n_tty_receive_signal_char(struct tty_struct *tty, int signal, unsigned char c)
* otherwise, publishes read_head via put_tty_queue()
*/
-static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
+static void
+n_tty_receive_char_special(struct tty_struct *tty, unsigned char c)
{
struct n_tty_data *ldata = tty->disc_data;
int parmrk;
- if (I_ISTRIP(tty))
- c &= 0x7f;
- if (I_IUCLC(tty) && L_IEXTEN(tty))
- c = tolower(c);
-
- if (L_EXTPROC(tty)) {
- put_tty_queue(c, ldata);
- return;
- }
-
- /*
- * If the previous character was LNEXT, or we know that this
- * character is not one of the characters that we'll have to
- * handle specially, do shortcut processing to speed things
- * up.
- */
- if (!test_bit(c, ldata->char_map) || ldata->lnext) {
- ldata->lnext = 0;
-
- if (tty->stopped && !tty->flow_stopped && I_IXON(tty) &&
- I_IXANY(tty)) {
- start_tty(tty);
- process_echoes(tty);
- }
-
- parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) ? 1 : 0;
- if (read_cnt(ldata) >= (N_TTY_BUF_SIZE - parmrk - 1)) {
- /* beep if no space */
- if (L_ECHO(tty))
- process_output('\a', tty);
- return;
- }
- if (L_ECHO(tty)) {
- finish_erasing(ldata);
- /* Record the column of first canon char. */
- if (ldata->canon_head == ldata->read_head)
- echo_set_canon_col(ldata);
- echo_char(c, tty);
- commit_echoes(tty);
- }
- if (parmrk)
- put_tty_queue(c, ldata);
- put_tty_queue(c, ldata);
- return;
- }
-
if (I_IXON(tty)) {
if (c == START_CHAR(tty)) {
start_tty(tty);
@@ -1458,6 +1413,60 @@ handle_newline:
put_tty_queue(c, ldata);
}
+static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
+{
+ struct n_tty_data *ldata = tty->disc_data;
+ int parmrk;
+
+ if (I_ISTRIP(tty))
+ c &= 0x7f;
+ if (I_IUCLC(tty) && L_IEXTEN(tty))
+ c = tolower(c);
+
+ if (L_EXTPROC(tty)) {
+ put_tty_queue(c, ldata);
+ return;
+ }
+
+ /*
+ * If the previous character was LNEXT, or we know that this
+ * character is not one of the characters that we'll have to
+ * handle specially, do shortcut processing to speed things
+ * up.
+ */
+ if (!test_bit(c, ldata->char_map) || ldata->lnext) {
+ ldata->lnext = 0;
+
+ if (tty->stopped && !tty->flow_stopped && I_IXON(tty) &&
+ I_IXANY(tty)) {
+ start_tty(tty);
+ process_echoes(tty);
+ }
+
+ parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) ? 1 : 0;
+ if (read_cnt(ldata) >= (N_TTY_BUF_SIZE - parmrk - 1)) {
+ /* beep if no space */
+ if (L_ECHO(tty))
+ process_output('\a', tty);
+ return;
+ }
+ if (L_ECHO(tty)) {
+ finish_erasing(ldata);
+ /* Record the column of first canon char. */
+ if (ldata->canon_head == ldata->read_head)
+ echo_set_canon_col(ldata);
+ echo_char(c, tty);
+ commit_echoes(tty);
+ }
+ if (parmrk)
+ put_tty_queue(c, ldata);
+ put_tty_queue(c, ldata);
+ return;
+ }
+
+ n_tty_receive_char_special(tty, c);
+}
+
static inline void
n_tty_receive_char_closing(struct tty_struct *tty, unsigned char c)
{