aboutsummaryrefslogtreecommitdiffstats
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 12:27:22 -0400
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)
1255 * otherwise, publishes read_head via put_tty_queue() 1255 * otherwise, publishes read_head via put_tty_queue()
1256 */ 1256 */
1257 1257
1258static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) 1258static void
1259n_tty_receive_char_special(struct tty_struct *tty, unsigned char c)
1259{ 1260{
1260 struct n_tty_data *ldata = tty->disc_data; 1261 struct n_tty_data *ldata = tty->disc_data;
1261 int parmrk; 1262 int parmrk;
1262 1263
1263 if (I_ISTRIP(tty))
1264 c &= 0x7f;
1265 if (I_IUCLC(tty) && L_IEXTEN(tty))
1266 c = tolower(c);
1267
1268 if (L_EXTPROC(tty)) {
1269 put_tty_queue(c, ldata);
1270 return;
1271 }
1272
1273 /*
1274 * If the previous character was LNEXT, or we know that this
1275 * character is not one of the characters that we'll have to
1276 * handle specially, do shortcut processing to speed things
1277 * up.
1278 */
1279 if (!test_bit(c, ldata->char_map) || ldata->lnext) {
1280 ldata->lnext = 0;
1281
1282 if (tty->stopped && !tty->flow_stopped && I_IXON(tty) &&
1283 I_IXANY(tty)) {
1284 start_tty(tty);
1285 process_echoes(tty);
1286 }
1287
1288 parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) ? 1 : 0;
1289 if (read_cnt(ldata) >= (N_TTY_BUF_SIZE - parmrk - 1)) {
1290 /* beep if no space */
1291 if (L_ECHO(tty))
1292 process_output('\a', tty);
1293 return;
1294 }
1295 if (L_ECHO(tty)) {
1296 finish_erasing(ldata);
1297 /* Record the column of first canon char. */
1298 if (ldata->canon_head == ldata->read_head)
1299 echo_set_canon_col(ldata);
1300 echo_char(c, tty);
1301 commit_echoes(tty);
1302 }
1303 if (parmrk)
1304 put_tty_queue(c, ldata);
1305 put_tty_queue(c, ldata);
1306 return;
1307 }
1308
1309 if (I_IXON(tty)) { 1264 if (I_IXON(tty)) {
1310 if (c == START_CHAR(tty)) { 1265 if (c == START_CHAR(tty)) {
1311 start_tty(tty); 1266 start_tty(tty);
@@ -1458,6 +1413,60 @@ handle_newline:
1458 put_tty_queue(c, ldata); 1413 put_tty_queue(c, ldata);
1459} 1414}
1460 1415
1416static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
1417{
1418 struct n_tty_data *ldata = tty->disc_data;
1419 int parmrk;
1420
1421 if (I_ISTRIP(tty))
1422 c &= 0x7f;
1423 if (I_IUCLC(tty) && L_IEXTEN(tty))
1424 c = tolower(c);
1425
1426 if (L_EXTPROC(tty)) {
1427 put_tty_queue(c, ldata);
1428 return;
1429 }
1430
1431 /*
1432 * If the previous character was LNEXT, or we know that this
1433 * character is not one of the characters that we'll have to
1434 * handle specially, do shortcut processing to speed things
1435 * up.
1436 */
1437 if (!test_bit(c, ldata->char_map) || ldata->lnext) {
1438 ldata->lnext = 0;
1439
1440 if (tty->stopped && !tty->flow_stopped && I_IXON(tty) &&
1441 I_IXANY(tty)) {
1442 start_tty(tty);
1443 process_echoes(tty);
1444 }
1445
1446 parmrk = (c == (unsigned char) '\377' && I_PARMRK(tty)) ? 1 : 0;
1447 if (read_cnt(ldata) >= (N_TTY_BUF_SIZE - parmrk - 1)) {
1448 /* beep if no space */
1449 if (L_ECHO(tty))
1450 process_output('\a', tty);
1451 return;
1452 }
1453 if (L_ECHO(tty)) {
1454 finish_erasing(ldata);
1455 /* Record the column of first canon char. */
1456 if (ldata->canon_head == ldata->read_head)
1457 echo_set_canon_col(ldata);
1458 echo_char(c, tty);
1459 commit_echoes(tty);
1460 }
1461 if (parmrk)
1462 put_tty_queue(c, ldata);
1463 put_tty_queue(c, ldata);
1464 return;
1465 }
1466
1467 n_tty_receive_char_special(tty, c);
1468}
1469
1461static inline void 1470static inline void
1462n_tty_receive_char_closing(struct tty_struct *tty, unsigned char c) 1471n_tty_receive_char_closing(struct tty_struct *tty, unsigned char c)
1463{ 1472{