Lines Matching refs:ldata

132 static inline size_t read_cnt(struct n_tty_data *ldata)  in read_cnt()  argument
134 return ldata->read_head - ldata->read_tail; in read_cnt()
137 static inline unsigned char read_buf(struct n_tty_data *ldata, size_t i) in read_buf() argument
139 return ldata->read_buf[i & (N_TTY_BUF_SIZE - 1)]; in read_buf()
142 static inline unsigned char *read_buf_addr(struct n_tty_data *ldata, size_t i) in read_buf_addr() argument
144 return &ldata->read_buf[i & (N_TTY_BUF_SIZE - 1)]; in read_buf_addr()
147 static inline unsigned char echo_buf(struct n_tty_data *ldata, size_t i) in echo_buf() argument
150 return ldata->echo_buf[i & (N_TTY_BUF_SIZE - 1)]; in echo_buf()
153 static inline unsigned char *echo_buf_addr(struct n_tty_data *ldata, size_t i) in echo_buf_addr() argument
155 return &ldata->echo_buf[i & (N_TTY_BUF_SIZE - 1)]; in echo_buf_addr()
170 struct n_tty_data *ldata = tty->disc_data; in tty_copy() local
172 void *from = read_buf_addr(ldata, tail); in tty_copy()
180 from = ldata->read_buf; in tty_copy()
201 struct n_tty_data *ldata = tty->disc_data; in n_tty_kick_worker() local
204 if (unlikely(ldata->no_room)) { in n_tty_kick_worker()
205 ldata->no_room = 0; in n_tty_kick_worker()
221 struct n_tty_data *ldata = tty->disc_data; in chars_in_buffer() local
224 if (!ldata->icanon) in chars_in_buffer()
225 n = ldata->commit_head - ldata->read_tail; in chars_in_buffer()
227 n = ldata->canon_head - ldata->read_tail; in chars_in_buffer()
246 struct n_tty_data *ldata = tty->disc_data; in n_tty_check_throttle() local
253 if (ldata->icanon && ldata->canon_head == ldata->read_tail) in n_tty_check_throttle()
259 if (N_TTY_BUF_SIZE - read_cnt(ldata) >= TTY_THRESHOLD_THROTTLE) in n_tty_check_throttle()
310 static inline void put_tty_queue(unsigned char c, struct n_tty_data *ldata) in put_tty_queue() argument
312 *read_buf_addr(ldata, ldata->read_head) = c; in put_tty_queue()
313 ldata->read_head++; in put_tty_queue()
327 static void reset_buffer_flags(struct n_tty_data *ldata) in reset_buffer_flags() argument
329 ldata->read_head = ldata->canon_head = ldata->read_tail = 0; in reset_buffer_flags()
330 ldata->commit_head = 0; in reset_buffer_flags()
331 ldata->line_start = 0; in reset_buffer_flags()
333 ldata->erasing = 0; in reset_buffer_flags()
334 bitmap_zero(ldata->read_flags, N_TTY_BUF_SIZE); in reset_buffer_flags()
335 ldata->push = 0; in reset_buffer_flags()
421 struct n_tty_data *ldata = tty->disc_data; in do_output_char() local
430 ldata->column = 0; in do_output_char()
434 ldata->canon_column = ldata->column = 0; in do_output_char()
438 ldata->canon_column = ldata->column; in do_output_char()
441 if (O_ONOCR(tty) && ldata->column == 0) in do_output_char()
446 ldata->canon_column = ldata->column = 0; in do_output_char()
449 ldata->canon_column = ldata->column = 0; in do_output_char()
452 spaces = 8 - (ldata->column & 7); in do_output_char()
456 ldata->column += spaces; in do_output_char()
460 ldata->column += spaces; in do_output_char()
463 if (ldata->column > 0) in do_output_char()
464 ldata->column--; in do_output_char()
471 ldata->column++; in do_output_char()
495 struct n_tty_data *ldata = tty->disc_data; in process_output() local
498 mutex_lock(&ldata->output_lock); in process_output()
503 mutex_unlock(&ldata->output_lock); in process_output()
531 struct n_tty_data *ldata = tty->disc_data; in process_output_block() local
536 mutex_lock(&ldata->output_lock); in process_output_block()
540 mutex_unlock(&ldata->output_lock); in process_output_block()
552 ldata->column = 0; in process_output_block()
555 ldata->canon_column = ldata->column; in process_output_block()
558 if (O_ONOCR(tty) && ldata->column == 0) in process_output_block()
562 ldata->canon_column = ldata->column = 0; in process_output_block()
567 if (ldata->column > 0) in process_output_block()
568 ldata->column--; in process_output_block()
575 ldata->column++; in process_output_block()
583 mutex_unlock(&ldata->output_lock); in process_output_block()
611 struct n_tty_data *ldata = tty->disc_data; in __process_echoes() local
618 tail = ldata->echo_tail; in __process_echoes()
619 while (MASK(ldata->echo_commit) != MASK(tail)) { in __process_echoes()
620 c = echo_buf(ldata, tail); in __process_echoes()
630 if (MASK(ldata->echo_commit) == MASK(tail + 1)) in __process_echoes()
637 op = echo_buf(ldata, tail + 1); in __process_echoes()
643 if (MASK(ldata->echo_commit) == MASK(tail + 2)) in __process_echoes()
645 num_chars = echo_buf(ldata, tail + 2); in __process_echoes()
658 num_chars += ldata->canon_column; in __process_echoes()
668 if (ldata->column > 0) in __process_echoes()
669 ldata->column--; in __process_echoes()
675 ldata->canon_column = ldata->column; in __process_echoes()
680 if (ldata->column > 0) in __process_echoes()
681 ldata->column--; in __process_echoes()
692 ldata->column++; in __process_echoes()
713 ldata->column += 2; in __process_echoes()
739 while (ldata->echo_commit > tail && in __process_echoes()
740 ldata->echo_commit - tail >= ECHO_DISCARD_WATERMARK) { in __process_echoes()
741 if (echo_buf(ldata, tail) == ECHO_OP_START) { in __process_echoes()
742 if (echo_buf(ldata, tail + 1) == ECHO_OP_ERASE_TAB) in __process_echoes()
751 ldata->echo_tail = tail; in __process_echoes()
757 struct n_tty_data *ldata = tty->disc_data; in commit_echoes() local
761 mutex_lock(&ldata->output_lock); in commit_echoes()
762 head = ldata->echo_head; in commit_echoes()
763 ldata->echo_mark = head; in commit_echoes()
764 old = ldata->echo_commit - ldata->echo_tail; in commit_echoes()
769 nr = head - ldata->echo_tail; in commit_echoes()
772 mutex_unlock(&ldata->output_lock); in commit_echoes()
776 ldata->echo_commit = head; in commit_echoes()
778 mutex_unlock(&ldata->output_lock); in commit_echoes()
786 struct n_tty_data *ldata = tty->disc_data; in process_echoes() local
789 if (ldata->echo_mark == ldata->echo_tail) in process_echoes()
792 mutex_lock(&ldata->output_lock); in process_echoes()
793 ldata->echo_commit = ldata->echo_mark; in process_echoes()
795 mutex_unlock(&ldata->output_lock); in process_echoes()
804 struct n_tty_data *ldata = tty->disc_data; in flush_echoes() local
807 ldata->echo_commit == ldata->echo_head) in flush_echoes()
810 mutex_lock(&ldata->output_lock); in flush_echoes()
811 ldata->echo_commit = ldata->echo_head; in flush_echoes()
813 mutex_unlock(&ldata->output_lock); in flush_echoes()
823 static inline void add_echo_byte(unsigned char c, struct n_tty_data *ldata) in add_echo_byte() argument
825 *echo_buf_addr(ldata, ldata->echo_head) = c; in add_echo_byte()
827 ldata->echo_head++; in add_echo_byte()
836 static void echo_move_back_col(struct n_tty_data *ldata) in echo_move_back_col() argument
838 add_echo_byte(ECHO_OP_START, ldata); in echo_move_back_col()
839 add_echo_byte(ECHO_OP_MOVE_BACK_COL, ldata); in echo_move_back_col()
849 static void echo_set_canon_col(struct n_tty_data *ldata) in echo_set_canon_col() argument
851 add_echo_byte(ECHO_OP_START, ldata); in echo_set_canon_col()
852 add_echo_byte(ECHO_OP_SET_CANON_COL, ldata); in echo_set_canon_col()
869 struct n_tty_data *ldata) in echo_erase_tab() argument
871 add_echo_byte(ECHO_OP_START, ldata); in echo_erase_tab()
872 add_echo_byte(ECHO_OP_ERASE_TAB, ldata); in echo_erase_tab()
881 add_echo_byte(num_chars, ldata); in echo_erase_tab()
894 static void echo_char_raw(unsigned char c, struct n_tty_data *ldata) in echo_char_raw() argument
897 add_echo_byte(ECHO_OP_START, ldata); in echo_char_raw()
898 add_echo_byte(ECHO_OP_START, ldata); in echo_char_raw()
900 add_echo_byte(c, ldata); in echo_char_raw()
917 struct n_tty_data *ldata = tty->disc_data; in echo_char() local
920 add_echo_byte(ECHO_OP_START, ldata); in echo_char()
921 add_echo_byte(ECHO_OP_START, ldata); in echo_char()
924 add_echo_byte(ECHO_OP_START, ldata); in echo_char()
925 add_echo_byte(c, ldata); in echo_char()
933 static inline void finish_erasing(struct n_tty_data *ldata) in finish_erasing() argument
935 if (ldata->erasing) { in finish_erasing()
936 echo_char_raw('/', ldata); in finish_erasing()
937 ldata->erasing = 0; in finish_erasing()
955 struct n_tty_data *ldata = tty->disc_data; in eraser() local
961 if (ldata->read_head == ldata->canon_head) { in eraser()
971 ldata->read_head = ldata->canon_head; in eraser()
975 ldata->read_head = ldata->canon_head; in eraser()
976 finish_erasing(ldata); in eraser()
980 echo_char_raw('\n', ldata); in eraser()
987 while (MASK(ldata->read_head) != MASK(ldata->canon_head)) { in eraser()
988 head = ldata->read_head; in eraser()
993 c = read_buf(ldata, head); in eraser()
995 MASK(head) != MASK(ldata->canon_head)); in eraser()
1008 cnt = ldata->read_head - head; in eraser()
1009 ldata->read_head = head; in eraser()
1012 if (!ldata->erasing) { in eraser()
1013 echo_char_raw('\\', ldata); in eraser()
1014 ldata->erasing = 1; in eraser()
1020 echo_char_raw(read_buf(ldata, head), ldata); in eraser()
1021 echo_move_back_col(ldata); in eraser()
1028 size_t tail = ldata->read_head; in eraser()
1037 while (MASK(tail) != MASK(ldata->canon_head)) { in eraser()
1039 c = read_buf(ldata, tail); in eraser()
1050 echo_erase_tab(num_chars, after_tab, ldata); in eraser()
1053 echo_char_raw('\b', ldata); in eraser()
1054 echo_char_raw(' ', ldata); in eraser()
1055 echo_char_raw('\b', ldata); in eraser()
1058 echo_char_raw('\b', ldata); in eraser()
1059 echo_char_raw(' ', ldata); in eraser()
1060 echo_char_raw('\b', ldata); in eraser()
1067 if (ldata->read_head == ldata->canon_head && L_ECHO(tty)) in eraser()
1068 finish_erasing(ldata); in eraser()
1097 struct n_tty_data *ldata = tty->disc_data; in isig() local
1110 mutex_lock(&ldata->output_lock); in isig()
1111 ldata->echo_head = ldata->echo_tail = 0; in isig()
1112 ldata->echo_mark = ldata->echo_commit = 0; in isig()
1113 mutex_unlock(&ldata->output_lock); in isig()
1144 struct n_tty_data *ldata = tty->disc_data; in n_tty_receive_break() local
1153 put_tty_queue('\377', ldata); in n_tty_receive_break()
1154 put_tty_queue('\0', ldata); in n_tty_receive_break()
1156 put_tty_queue('\0', ldata); in n_tty_receive_break()
1171 struct n_tty_data *ldata = tty->disc_data; in n_tty_receive_overrun() local
1173 ldata->num_overrun++; in n_tty_receive_overrun()
1174 if (time_after(jiffies, ldata->overrun_time + HZ) || in n_tty_receive_overrun()
1175 time_after(ldata->overrun_time, jiffies)) { in n_tty_receive_overrun()
1176 tty_warn(tty, "%d input overrun(s)\n", ldata->num_overrun); in n_tty_receive_overrun()
1177 ldata->overrun_time = jiffies; in n_tty_receive_overrun()
1178 ldata->num_overrun = 0; in n_tty_receive_overrun()
1195 struct n_tty_data *ldata = tty->disc_data; in n_tty_receive_parity_error() local
1201 put_tty_queue('\377', ldata); in n_tty_receive_parity_error()
1202 put_tty_queue('\0', ldata); in n_tty_receive_parity_error()
1203 put_tty_queue(c, ldata); in n_tty_receive_parity_error()
1205 put_tty_queue('\0', ldata); in n_tty_receive_parity_error()
1207 put_tty_queue(c, ldata); in n_tty_receive_parity_error()
1247 struct n_tty_data *ldata = tty->disc_data; in n_tty_receive_char_special() local
1278 if (ldata->icanon) { in n_tty_receive_char_special()
1286 ldata->lnext = 1; in n_tty_receive_char_special()
1288 finish_erasing(ldata); in n_tty_receive_char_special()
1290 echo_char_raw('^', ldata); in n_tty_receive_char_special()
1291 echo_char_raw('\b', ldata); in n_tty_receive_char_special()
1298 size_t tail = ldata->canon_head; in n_tty_receive_char_special()
1300 finish_erasing(ldata); in n_tty_receive_char_special()
1302 echo_char_raw('\n', ldata); in n_tty_receive_char_special()
1303 while (MASK(tail) != MASK(ldata->read_head)) { in n_tty_receive_char_special()
1304 echo_char(read_buf(ldata, tail), tty); in n_tty_receive_char_special()
1312 echo_char_raw('\n', ldata); in n_tty_receive_char_special()
1328 if (ldata->canon_head == ldata->read_head) in n_tty_receive_char_special()
1329 echo_set_canon_col(ldata); in n_tty_receive_char_special()
1338 put_tty_queue(c, ldata); in n_tty_receive_char_special()
1341 set_bit(ldata->read_head & (N_TTY_BUF_SIZE - 1), ldata->read_flags); in n_tty_receive_char_special()
1342 put_tty_queue(c, ldata); in n_tty_receive_char_special()
1343 smp_store_release(&ldata->canon_head, ldata->read_head); in n_tty_receive_char_special()
1351 finish_erasing(ldata); in n_tty_receive_char_special()
1353 echo_char_raw('\n', ldata); in n_tty_receive_char_special()
1356 if (ldata->canon_head == ldata->read_head) in n_tty_receive_char_special()
1357 echo_set_canon_col(ldata); in n_tty_receive_char_special()
1365 put_tty_queue(c, ldata); in n_tty_receive_char_special()
1367 put_tty_queue(c, ldata); in n_tty_receive_char_special()
1384 struct n_tty_data *ldata = tty->disc_data; in n_tty_receive_char() local
1391 finish_erasing(ldata); in n_tty_receive_char()
1393 if (ldata->canon_head == ldata->read_head) in n_tty_receive_char()
1394 echo_set_canon_col(ldata); in n_tty_receive_char()
1400 put_tty_queue(c, ldata); in n_tty_receive_char()
1401 put_tty_queue(c, ldata); in n_tty_receive_char()
1447 struct n_tty_data *ldata = tty->disc_data; in n_tty_receive_char_lnext() local
1449 ldata->lnext = 0; in n_tty_receive_char_lnext()
1464 struct n_tty_data *ldata = tty->disc_data; in n_tty_receive_buf_real_raw() local
1467 head = ldata->read_head & (N_TTY_BUF_SIZE - 1); in n_tty_receive_buf_real_raw()
1469 memcpy(read_buf_addr(ldata, head), cp, n); in n_tty_receive_buf_real_raw()
1470 ldata->read_head += n; in n_tty_receive_buf_real_raw()
1474 head = ldata->read_head & (N_TTY_BUF_SIZE - 1); in n_tty_receive_buf_real_raw()
1476 memcpy(read_buf_addr(ldata, head), cp, n); in n_tty_receive_buf_real_raw()
1477 ldata->read_head += n; in n_tty_receive_buf_real_raw()
1484 struct n_tty_data *ldata = tty->disc_data; in n_tty_receive_buf_raw() local
1491 put_tty_queue(*cp++, ldata); in n_tty_receive_buf_raw()
1514 struct n_tty_data *ldata = tty->disc_data; in n_tty_receive_buf_standard() local
1523 if (ldata->lnext) { in n_tty_receive_buf_standard()
1538 put_tty_queue(c, ldata); in n_tty_receive_buf_standard()
1542 if (test_bit(c, ldata->char_map)) in n_tty_receive_buf_standard()
1552 struct n_tty_data *ldata = tty->disc_data; in __receive_buf() local
1555 if (ldata->real_raw) in __receive_buf()
1557 else if (ldata->raw || (L_EXTPROC(tty) && !preops)) in __receive_buf()
1569 if (ldata->icanon && !L_EXTPROC(tty)) in __receive_buf()
1573 smp_store_release(&ldata->commit_head, ldata->read_head); in __receive_buf()
1575 if (read_cnt(ldata)) { in __receive_buf()
1618 struct n_tty_data *ldata = tty->disc_data; in n_tty_receive_buf_common() local
1637 size_t tail = smp_load_acquire(&ldata->read_tail); in n_tty_receive_buf_common()
1639 room = N_TTY_BUF_SIZE - (ldata->read_head - tail); in n_tty_receive_buf_common()
1644 overflow = ldata->icanon && ldata->canon_head == tail; in n_tty_receive_buf_common()
1646 ldata->read_head--; in n_tty_receive_buf_common()
1648 ldata->no_room = flow && !room; in n_tty_receive_buf_common()
1710 struct n_tty_data *ldata = tty->disc_data; in n_tty_set_termios() local
1713 bitmap_zero(ldata->read_flags, N_TTY_BUF_SIZE); in n_tty_set_termios()
1714 ldata->line_start = ldata->read_tail; in n_tty_set_termios()
1715 if (!L_ICANON(tty) || !read_cnt(ldata)) { in n_tty_set_termios()
1716 ldata->canon_head = ldata->read_tail; in n_tty_set_termios()
1717 ldata->push = 0; in n_tty_set_termios()
1719 set_bit((ldata->read_head - 1) & (N_TTY_BUF_SIZE - 1), in n_tty_set_termios()
1720 ldata->read_flags); in n_tty_set_termios()
1721 ldata->canon_head = ldata->read_head; in n_tty_set_termios()
1722 ldata->push = 1; in n_tty_set_termios()
1724 ldata->commit_head = ldata->read_head; in n_tty_set_termios()
1725 ldata->erasing = 0; in n_tty_set_termios()
1726 ldata->lnext = 0; in n_tty_set_termios()
1729 ldata->icanon = (L_ICANON(tty) != 0); in n_tty_set_termios()
1735 bitmap_zero(ldata->char_map, 256); in n_tty_set_termios()
1738 set_bit('\r', ldata->char_map); in n_tty_set_termios()
1740 set_bit('\n', ldata->char_map); in n_tty_set_termios()
1743 set_bit(ERASE_CHAR(tty), ldata->char_map); in n_tty_set_termios()
1744 set_bit(KILL_CHAR(tty), ldata->char_map); in n_tty_set_termios()
1745 set_bit(EOF_CHAR(tty), ldata->char_map); in n_tty_set_termios()
1746 set_bit('\n', ldata->char_map); in n_tty_set_termios()
1747 set_bit(EOL_CHAR(tty), ldata->char_map); in n_tty_set_termios()
1749 set_bit(WERASE_CHAR(tty), ldata->char_map); in n_tty_set_termios()
1750 set_bit(LNEXT_CHAR(tty), ldata->char_map); in n_tty_set_termios()
1751 set_bit(EOL2_CHAR(tty), ldata->char_map); in n_tty_set_termios()
1754 ldata->char_map); in n_tty_set_termios()
1758 set_bit(START_CHAR(tty), ldata->char_map); in n_tty_set_termios()
1759 set_bit(STOP_CHAR(tty), ldata->char_map); in n_tty_set_termios()
1762 set_bit(INTR_CHAR(tty), ldata->char_map); in n_tty_set_termios()
1763 set_bit(QUIT_CHAR(tty), ldata->char_map); in n_tty_set_termios()
1764 set_bit(SUSP_CHAR(tty), ldata->char_map); in n_tty_set_termios()
1766 clear_bit(__DISABLED_CHAR, ldata->char_map); in n_tty_set_termios()
1767 ldata->raw = 0; in n_tty_set_termios()
1768 ldata->real_raw = 0; in n_tty_set_termios()
1770 ldata->raw = 1; in n_tty_set_termios()
1774 ldata->real_raw = 1; in n_tty_set_termios()
1776 ldata->real_raw = 0; in n_tty_set_termios()
1802 struct n_tty_data *ldata = tty->disc_data; in n_tty_close() local
1808 vfree(ldata); in n_tty_close()
1823 struct n_tty_data *ldata; in n_tty_open() local
1826 ldata = vzalloc(sizeof(*ldata)); in n_tty_open()
1827 if (!ldata) in n_tty_open()
1830 ldata->overrun_time = jiffies; in n_tty_open()
1831 mutex_init(&ldata->atomic_read_lock); in n_tty_open()
1832 mutex_init(&ldata->output_lock); in n_tty_open()
1834 tty->disc_data = ldata; in n_tty_open()
1845 struct n_tty_data *ldata = tty->disc_data; in input_available_p() local
1848 if (ldata->icanon && !L_EXTPROC(tty)) in input_available_p()
1849 return ldata->canon_head != ldata->read_tail; in input_available_p()
1851 return ldata->commit_head - ldata->read_tail >= amt; in input_available_p()
1877 struct n_tty_data *ldata = tty->disc_data; in copy_from_read_buf() local
1880 size_t head = smp_load_acquire(&ldata->commit_head); in copy_from_read_buf()
1881 size_t tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1); in copy_from_read_buf()
1883 n = min(head - ldata->read_tail, N_TTY_BUF_SIZE - tail); in copy_from_read_buf()
1886 unsigned char *from = read_buf_addr(ldata, tail); in copy_from_read_buf()
1891 smp_store_release(&ldata->read_tail, ldata->read_tail + n); in copy_from_read_buf()
1893 if (L_EXTPROC(tty) && ldata->icanon && is_eof && in copy_from_read_buf()
1894 (head == ldata->read_tail)) in copy_from_read_buf()
1900 return head != ldata->read_tail; in copy_from_read_buf()
1931 struct n_tty_data *ldata = tty->disc_data; in canon_copy_from_read_buf() local
1941 canon_head = smp_load_acquire(&ldata->canon_head); in canon_copy_from_read_buf()
1942 n = min(*nr, canon_head - ldata->read_tail); in canon_copy_from_read_buf()
1944 tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1); in canon_copy_from_read_buf()
1950 eol = find_next_bit(ldata->read_flags, size, tail); in canon_copy_from_read_buf()
1954 eol = find_first_bit(ldata->read_flags, more); in canon_copy_from_read_buf()
1964 if (!found || read_buf(ldata, eol) != __DISABLED_CHAR) in canon_copy_from_read_buf()
1975 clear_bit(eol, ldata->read_flags); in canon_copy_from_read_buf()
1976 smp_store_release(&ldata->read_tail, ldata->read_tail + c); in canon_copy_from_read_buf()
1979 if (!ldata->push) in canon_copy_from_read_buf()
1980 ldata->line_start = ldata->read_tail; in canon_copy_from_read_buf()
1982 ldata->push = 0; in canon_copy_from_read_buf()
1988 return ldata->read_tail != canon_head; in canon_copy_from_read_buf()
1998 struct n_tty_data *ldata = tty->disc_data; in canon_skip_eof() local
2001 canon_head = smp_load_acquire(&ldata->canon_head); in canon_skip_eof()
2002 tail = ldata->read_tail; in canon_skip_eof()
2010 if (!test_bit(tail, ldata->read_flags)) in canon_skip_eof()
2012 if (read_buf(ldata, tail) != __DISABLED_CHAR) in canon_skip_eof()
2016 clear_bit(tail, ldata->read_flags); in canon_skip_eof()
2017 smp_store_release(&ldata->read_tail, ldata->read_tail + 1); in canon_skip_eof()
2072 struct n_tty_data *ldata = tty->disc_data; in n_tty_read() local
2089 if (ldata->icanon && !L_EXTPROC(tty)) { in n_tty_read()
2108 mutex_unlock(&ldata->atomic_read_lock); in n_tty_read()
2121 if (!mutex_trylock(&ldata->atomic_read_lock)) in n_tty_read()
2124 if (mutex_lock_interruptible(&ldata->atomic_read_lock)) in n_tty_read()
2132 if (!ldata->icanon) { in n_tty_read()
2143 tail = ldata->read_tail; in n_tty_read()
2198 if (ldata->icanon && !L_EXTPROC(tty)) { in n_tty_read()
2232 if (tail != ldata->read_tail) in n_tty_read()
2237 mutex_unlock(&ldata->atomic_read_lock); in n_tty_read()
2316 struct n_tty_data *ldata = tty->disc_data; in n_tty_write() local
2319 mutex_lock(&ldata->output_lock); in n_tty_write()
2321 mutex_unlock(&ldata->output_lock); in n_tty_write()
2393 static unsigned long inq_canon(struct n_tty_data *ldata) in inq_canon() argument
2397 if (ldata->canon_head == ldata->read_tail) in inq_canon()
2399 head = ldata->canon_head; in inq_canon()
2400 tail = ldata->read_tail; in inq_canon()
2404 if (test_bit(tail & (N_TTY_BUF_SIZE - 1), ldata->read_flags) && in inq_canon()
2405 read_buf(ldata, tail) == __DISABLED_CHAR) in inq_canon()
2415 struct n_tty_data *ldata = tty->disc_data; in n_tty_ioctl() local
2424 retval = inq_canon(ldata); in n_tty_ioctl()
2426 retval = read_cnt(ldata); in n_tty_ioctl()