diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-10-18 16:26:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-22 19:53:01 -0400 |
commit | 57c941212d203979720081198ebda41f51812635 (patch) | |
tree | 5486ba3a3a6aa5740edfdf8c96454acfd3f0efb2 /drivers | |
parent | bddc7152f68bc1e0ee1f55a8055e33531f384101 (diff) |
TTY: n_tty, propagate n_tty_data
In some funtions we need only n_tty_data, so pass it down directly in
case tty is not needed there.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/tty/n_tty.c | 171 |
1 files changed, 78 insertions, 93 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 0a6fcda96152..531e539dbfcf 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -153,10 +153,8 @@ static void n_tty_set_room(struct tty_struct *tty) | |||
153 | schedule_work(&tty->buf.work); | 153 | schedule_work(&tty->buf.work); |
154 | } | 154 | } |
155 | 155 | ||
156 | static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty) | 156 | static void put_tty_queue_nolock(unsigned char c, struct n_tty_data *ldata) |
157 | { | 157 | { |
158 | struct n_tty_data *ldata = tty->disc_data; | ||
159 | |||
160 | if (ldata->read_cnt < N_TTY_BUF_SIZE) { | 158 | if (ldata->read_cnt < N_TTY_BUF_SIZE) { |
161 | ldata->read_buf[ldata->read_head] = c; | 159 | ldata->read_buf[ldata->read_head] = c; |
162 | ldata->read_head = (ldata->read_head + 1) & (N_TTY_BUF_SIZE-1); | 160 | ldata->read_head = (ldata->read_head + 1) & (N_TTY_BUF_SIZE-1); |
@@ -167,23 +165,22 @@ static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty) | |||
167 | /** | 165 | /** |
168 | * put_tty_queue - add character to tty | 166 | * put_tty_queue - add character to tty |
169 | * @c: character | 167 | * @c: character |
170 | * @tty: tty device | 168 | * @ldata: n_tty data |
171 | * | 169 | * |
172 | * Add a character to the tty read_buf queue. This is done under the | 170 | * Add a character to the tty read_buf queue. This is done under the |
173 | * read_lock to serialize character addition and also to protect us | 171 | * read_lock to serialize character addition and also to protect us |
174 | * against parallel reads or flushes | 172 | * against parallel reads or flushes |
175 | */ | 173 | */ |
176 | 174 | ||
177 | static void put_tty_queue(unsigned char c, struct tty_struct *tty) | 175 | static void put_tty_queue(unsigned char c, struct n_tty_data *ldata) |
178 | { | 176 | { |
179 | struct n_tty_data *ldata = tty->disc_data; | ||
180 | unsigned long flags; | 177 | unsigned long flags; |
181 | /* | 178 | /* |
182 | * The problem of stomping on the buffers ends here. | 179 | * The problem of stomping on the buffers ends here. |
183 | * Why didn't anyone see this one coming? --AJK | 180 | * Why didn't anyone see this one coming? --AJK |
184 | */ | 181 | */ |
185 | spin_lock_irqsave(&ldata->read_lock, flags); | 182 | spin_lock_irqsave(&ldata->read_lock, flags); |
186 | put_tty_queue_nolock(c, tty); | 183 | put_tty_queue_nolock(c, ldata); |
187 | spin_unlock_irqrestore(&ldata->read_lock, flags); | 184 | spin_unlock_irqrestore(&ldata->read_lock, flags); |
188 | } | 185 | } |
189 | 186 | ||
@@ -699,16 +696,15 @@ static void process_echoes(struct tty_struct *tty) | |||
699 | /** | 696 | /** |
700 | * add_echo_byte - add a byte to the echo buffer | 697 | * add_echo_byte - add a byte to the echo buffer |
701 | * @c: unicode byte to echo | 698 | * @c: unicode byte to echo |
702 | * @tty: terminal device | 699 | * @ldata: n_tty data |
703 | * | 700 | * |
704 | * Add a character or operation byte to the echo buffer. | 701 | * Add a character or operation byte to the echo buffer. |
705 | * | 702 | * |
706 | * Should be called under the echo lock to protect the echo buffer. | 703 | * Should be called under the echo lock to protect the echo buffer. |
707 | */ | 704 | */ |
708 | 705 | ||
709 | static void add_echo_byte(unsigned char c, struct tty_struct *tty) | 706 | static void add_echo_byte(unsigned char c, struct n_tty_data *ldata) |
710 | { | 707 | { |
711 | struct n_tty_data *ldata = tty->disc_data; | ||
712 | int new_byte_pos; | 708 | int new_byte_pos; |
713 | 709 | ||
714 | if (ldata->echo_cnt == N_TTY_BUF_SIZE) { | 710 | if (ldata->echo_cnt == N_TTY_BUF_SIZE) { |
@@ -746,28 +742,24 @@ static void add_echo_byte(unsigned char c, struct tty_struct *tty) | |||
746 | 742 | ||
747 | /** | 743 | /** |
748 | * echo_move_back_col - add operation to move back a column | 744 | * echo_move_back_col - add operation to move back a column |
749 | * @tty: terminal device | 745 | * @ldata: n_tty data |
750 | * | 746 | * |
751 | * Add an operation to the echo buffer to move back one column. | 747 | * Add an operation to the echo buffer to move back one column. |
752 | * | 748 | * |
753 | * Locking: echo_lock to protect the echo buffer | 749 | * Locking: echo_lock to protect the echo buffer |
754 | */ | 750 | */ |
755 | 751 | ||
756 | static void echo_move_back_col(struct tty_struct *tty) | 752 | static void echo_move_back_col(struct n_tty_data *ldata) |
757 | { | 753 | { |
758 | struct n_tty_data *ldata = tty->disc_data; | ||
759 | |||
760 | mutex_lock(&ldata->echo_lock); | 754 | mutex_lock(&ldata->echo_lock); |
761 | 755 | add_echo_byte(ECHO_OP_START, ldata); | |
762 | add_echo_byte(ECHO_OP_START, tty); | 756 | add_echo_byte(ECHO_OP_MOVE_BACK_COL, ldata); |
763 | add_echo_byte(ECHO_OP_MOVE_BACK_COL, tty); | ||
764 | |||
765 | mutex_unlock(&ldata->echo_lock); | 757 | mutex_unlock(&ldata->echo_lock); |
766 | } | 758 | } |
767 | 759 | ||
768 | /** | 760 | /** |
769 | * echo_set_canon_col - add operation to set the canon column | 761 | * echo_set_canon_col - add operation to set the canon column |
770 | * @tty: terminal device | 762 | * @ldata: n_tty data |
771 | * | 763 | * |
772 | * Add an operation to the echo buffer to set the canon column | 764 | * Add an operation to the echo buffer to set the canon column |
773 | * to the current column. | 765 | * to the current column. |
@@ -775,15 +767,11 @@ static void echo_move_back_col(struct tty_struct *tty) | |||
775 | * Locking: echo_lock to protect the echo buffer | 767 | * Locking: echo_lock to protect the echo buffer |
776 | */ | 768 | */ |
777 | 769 | ||
778 | static void echo_set_canon_col(struct tty_struct *tty) | 770 | static void echo_set_canon_col(struct n_tty_data *ldata) |
779 | { | 771 | { |
780 | struct n_tty_data *ldata = tty->disc_data; | ||
781 | |||
782 | mutex_lock(&ldata->echo_lock); | 772 | mutex_lock(&ldata->echo_lock); |
783 | 773 | add_echo_byte(ECHO_OP_START, ldata); | |
784 | add_echo_byte(ECHO_OP_START, tty); | 774 | add_echo_byte(ECHO_OP_SET_CANON_COL, ldata); |
785 | add_echo_byte(ECHO_OP_SET_CANON_COL, tty); | ||
786 | |||
787 | mutex_unlock(&ldata->echo_lock); | 775 | mutex_unlock(&ldata->echo_lock); |
788 | } | 776 | } |
789 | 777 | ||
@@ -791,7 +779,7 @@ static void echo_set_canon_col(struct tty_struct *tty) | |||
791 | * echo_erase_tab - add operation to erase a tab | 779 | * echo_erase_tab - add operation to erase a tab |
792 | * @num_chars: number of character columns already used | 780 | * @num_chars: number of character columns already used |
793 | * @after_tab: true if num_chars starts after a previous tab | 781 | * @after_tab: true if num_chars starts after a previous tab |
794 | * @tty: terminal device | 782 | * @ldata: n_tty data |
795 | * | 783 | * |
796 | * Add an operation to the echo buffer to erase a tab. | 784 | * Add an operation to the echo buffer to erase a tab. |
797 | * | 785 | * |
@@ -805,14 +793,12 @@ static void echo_set_canon_col(struct tty_struct *tty) | |||
805 | */ | 793 | */ |
806 | 794 | ||
807 | static void echo_erase_tab(unsigned int num_chars, int after_tab, | 795 | static void echo_erase_tab(unsigned int num_chars, int after_tab, |
808 | struct tty_struct *tty) | 796 | struct n_tty_data *ldata) |
809 | { | 797 | { |
810 | struct n_tty_data *ldata = tty->disc_data; | ||
811 | |||
812 | mutex_lock(&ldata->echo_lock); | 798 | mutex_lock(&ldata->echo_lock); |
813 | 799 | ||
814 | add_echo_byte(ECHO_OP_START, tty); | 800 | add_echo_byte(ECHO_OP_START, ldata); |
815 | add_echo_byte(ECHO_OP_ERASE_TAB, tty); | 801 | add_echo_byte(ECHO_OP_ERASE_TAB, ldata); |
816 | 802 | ||
817 | /* We only need to know this modulo 8 (tab spacing) */ | 803 | /* We only need to know this modulo 8 (tab spacing) */ |
818 | num_chars &= 7; | 804 | num_chars &= 7; |
@@ -821,7 +807,7 @@ static void echo_erase_tab(unsigned int num_chars, int after_tab, | |||
821 | if (after_tab) | 807 | if (after_tab) |
822 | num_chars |= 0x80; | 808 | num_chars |= 0x80; |
823 | 809 | ||
824 | add_echo_byte(num_chars, tty); | 810 | add_echo_byte(num_chars, ldata); |
825 | 811 | ||
826 | mutex_unlock(&ldata->echo_lock); | 812 | mutex_unlock(&ldata->echo_lock); |
827 | } | 813 | } |
@@ -839,19 +825,15 @@ static void echo_erase_tab(unsigned int num_chars, int after_tab, | |||
839 | * Locking: echo_lock to protect the echo buffer | 825 | * Locking: echo_lock to protect the echo buffer |
840 | */ | 826 | */ |
841 | 827 | ||
842 | static void echo_char_raw(unsigned char c, struct tty_struct *tty) | 828 | static void echo_char_raw(unsigned char c, struct n_tty_data *ldata) |
843 | { | 829 | { |
844 | struct n_tty_data *ldata = tty->disc_data; | ||
845 | |||
846 | mutex_lock(&ldata->echo_lock); | 830 | mutex_lock(&ldata->echo_lock); |
847 | |||
848 | if (c == ECHO_OP_START) { | 831 | if (c == ECHO_OP_START) { |
849 | add_echo_byte(ECHO_OP_START, tty); | 832 | add_echo_byte(ECHO_OP_START, ldata); |
850 | add_echo_byte(ECHO_OP_START, tty); | 833 | add_echo_byte(ECHO_OP_START, ldata); |
851 | } else { | 834 | } else { |
852 | add_echo_byte(c, tty); | 835 | add_echo_byte(c, ldata); |
853 | } | 836 | } |
854 | |||
855 | mutex_unlock(&ldata->echo_lock); | 837 | mutex_unlock(&ldata->echo_lock); |
856 | } | 838 | } |
857 | 839 | ||
@@ -876,12 +858,12 @@ static void echo_char(unsigned char c, struct tty_struct *tty) | |||
876 | mutex_lock(&ldata->echo_lock); | 858 | mutex_lock(&ldata->echo_lock); |
877 | 859 | ||
878 | if (c == ECHO_OP_START) { | 860 | if (c == ECHO_OP_START) { |
879 | add_echo_byte(ECHO_OP_START, tty); | 861 | add_echo_byte(ECHO_OP_START, ldata); |
880 | add_echo_byte(ECHO_OP_START, tty); | 862 | add_echo_byte(ECHO_OP_START, ldata); |
881 | } else { | 863 | } else { |
882 | if (L_ECHOCTL(tty) && iscntrl(c) && c != '\t') | 864 | if (L_ECHOCTL(tty) && iscntrl(c) && c != '\t') |
883 | add_echo_byte(ECHO_OP_START, tty); | 865 | add_echo_byte(ECHO_OP_START, ldata); |
884 | add_echo_byte(c, tty); | 866 | add_echo_byte(c, ldata); |
885 | } | 867 | } |
886 | 868 | ||
887 | mutex_unlock(&ldata->echo_lock); | 869 | mutex_unlock(&ldata->echo_lock); |
@@ -889,14 +871,13 @@ static void echo_char(unsigned char c, struct tty_struct *tty) | |||
889 | 871 | ||
890 | /** | 872 | /** |
891 | * finish_erasing - complete erase | 873 | * finish_erasing - complete erase |
892 | * @tty: tty doing the erase | 874 | * @ldata: n_tty data |
893 | */ | 875 | */ |
894 | 876 | ||
895 | static inline void finish_erasing(struct tty_struct *tty) | 877 | static inline void finish_erasing(struct n_tty_data *ldata) |
896 | { | 878 | { |
897 | struct n_tty_data *ldata = tty->disc_data; | ||
898 | if (ldata->erasing) { | 879 | if (ldata->erasing) { |
899 | echo_char_raw('/', tty); | 880 | echo_char_raw('/', ldata); |
900 | ldata->erasing = 0; | 881 | ldata->erasing = 0; |
901 | } | 882 | } |
902 | } | 883 | } |
@@ -944,11 +925,11 @@ static void eraser(unsigned char c, struct tty_struct *tty) | |||
944 | (N_TTY_BUF_SIZE - 1)); | 925 | (N_TTY_BUF_SIZE - 1)); |
945 | ldata->read_head = ldata->canon_head; | 926 | ldata->read_head = ldata->canon_head; |
946 | spin_unlock_irqrestore(&ldata->read_lock, flags); | 927 | spin_unlock_irqrestore(&ldata->read_lock, flags); |
947 | finish_erasing(tty); | 928 | finish_erasing(ldata); |
948 | echo_char(KILL_CHAR(tty), tty); | 929 | echo_char(KILL_CHAR(tty), tty); |
949 | /* Add a newline if ECHOK is on and ECHOKE is off. */ | 930 | /* Add a newline if ECHOK is on and ECHOKE is off. */ |
950 | if (L_ECHOK(tty)) | 931 | if (L_ECHOK(tty)) |
951 | echo_char_raw('\n', tty); | 932 | echo_char_raw('\n', ldata); |
952 | return; | 933 | return; |
953 | } | 934 | } |
954 | kill_type = KILL; | 935 | kill_type = KILL; |
@@ -984,15 +965,16 @@ static void eraser(unsigned char c, struct tty_struct *tty) | |||
984 | if (L_ECHO(tty)) { | 965 | if (L_ECHO(tty)) { |
985 | if (L_ECHOPRT(tty)) { | 966 | if (L_ECHOPRT(tty)) { |
986 | if (!ldata->erasing) { | 967 | if (!ldata->erasing) { |
987 | echo_char_raw('\\', tty); | 968 | echo_char_raw('\\', ldata); |
988 | ldata->erasing = 1; | 969 | ldata->erasing = 1; |
989 | } | 970 | } |
990 | /* if cnt > 1, output a multi-byte character */ | 971 | /* if cnt > 1, output a multi-byte character */ |
991 | echo_char(c, tty); | 972 | echo_char(c, tty); |
992 | while (--cnt > 0) { | 973 | while (--cnt > 0) { |
993 | head = (head+1) & (N_TTY_BUF_SIZE-1); | 974 | head = (head+1) & (N_TTY_BUF_SIZE-1); |
994 | echo_char_raw(ldata->read_buf[head], tty); | 975 | echo_char_raw(ldata->read_buf[head], |
995 | echo_move_back_col(tty); | 976 | ldata); |
977 | echo_move_back_col(ldata); | ||
996 | } | 978 | } |
997 | } else if (kill_type == ERASE && !L_ECHOE(tty)) { | 979 | } else if (kill_type == ERASE && !L_ECHOE(tty)) { |
998 | echo_char(ERASE_CHAR(tty), tty); | 980 | echo_char(ERASE_CHAR(tty), tty); |
@@ -1021,17 +1003,17 @@ static void eraser(unsigned char c, struct tty_struct *tty) | |||
1021 | num_chars++; | 1003 | num_chars++; |
1022 | } | 1004 | } |
1023 | } | 1005 | } |
1024 | echo_erase_tab(num_chars, after_tab, tty); | 1006 | echo_erase_tab(num_chars, after_tab, ldata); |
1025 | } else { | 1007 | } else { |
1026 | if (iscntrl(c) && L_ECHOCTL(tty)) { | 1008 | if (iscntrl(c) && L_ECHOCTL(tty)) { |
1027 | echo_char_raw('\b', tty); | 1009 | echo_char_raw('\b', ldata); |
1028 | echo_char_raw(' ', tty); | 1010 | echo_char_raw(' ', ldata); |
1029 | echo_char_raw('\b', tty); | 1011 | echo_char_raw('\b', ldata); |
1030 | } | 1012 | } |
1031 | if (!iscntrl(c) || L_ECHOCTL(tty)) { | 1013 | if (!iscntrl(c) || L_ECHOCTL(tty)) { |
1032 | echo_char_raw('\b', tty); | 1014 | echo_char_raw('\b', ldata); |
1033 | echo_char_raw(' ', tty); | 1015 | echo_char_raw(' ', ldata); |
1034 | echo_char_raw('\b', tty); | 1016 | echo_char_raw('\b', ldata); |
1035 | } | 1017 | } |
1036 | } | 1018 | } |
1037 | } | 1019 | } |
@@ -1039,7 +1021,7 @@ static void eraser(unsigned char c, struct tty_struct *tty) | |||
1039 | break; | 1021 | break; |
1040 | } | 1022 | } |
1041 | if (ldata->read_head == ldata->canon_head && L_ECHO(tty)) | 1023 | if (ldata->read_head == ldata->canon_head && L_ECHO(tty)) |
1042 | finish_erasing(tty); | 1024 | finish_erasing(ldata); |
1043 | } | 1025 | } |
1044 | 1026 | ||
1045 | /** | 1027 | /** |
@@ -1078,6 +1060,8 @@ static inline void isig(int sig, struct tty_struct *tty, int flush) | |||
1078 | 1060 | ||
1079 | static inline void n_tty_receive_break(struct tty_struct *tty) | 1061 | static inline void n_tty_receive_break(struct tty_struct *tty) |
1080 | { | 1062 | { |
1063 | struct n_tty_data *ldata = tty->disc_data; | ||
1064 | |||
1081 | if (I_IGNBRK(tty)) | 1065 | if (I_IGNBRK(tty)) |
1082 | return; | 1066 | return; |
1083 | if (I_BRKINT(tty)) { | 1067 | if (I_BRKINT(tty)) { |
@@ -1085,10 +1069,10 @@ static inline void n_tty_receive_break(struct tty_struct *tty) | |||
1085 | return; | 1069 | return; |
1086 | } | 1070 | } |
1087 | if (I_PARMRK(tty)) { | 1071 | if (I_PARMRK(tty)) { |
1088 | put_tty_queue('\377', tty); | 1072 | put_tty_queue('\377', ldata); |
1089 | put_tty_queue('\0', tty); | 1073 | put_tty_queue('\0', ldata); |
1090 | } | 1074 | } |
1091 | put_tty_queue('\0', tty); | 1075 | put_tty_queue('\0', ldata); |
1092 | wake_up_interruptible(&tty->read_wait); | 1076 | wake_up_interruptible(&tty->read_wait); |
1093 | } | 1077 | } |
1094 | 1078 | ||
@@ -1132,16 +1116,18 @@ static inline void n_tty_receive_overrun(struct tty_struct *tty) | |||
1132 | static inline void n_tty_receive_parity_error(struct tty_struct *tty, | 1116 | static inline void n_tty_receive_parity_error(struct tty_struct *tty, |
1133 | unsigned char c) | 1117 | unsigned char c) |
1134 | { | 1118 | { |
1119 | struct n_tty_data *ldata = tty->disc_data; | ||
1120 | |||
1135 | if (I_IGNPAR(tty)) | 1121 | if (I_IGNPAR(tty)) |
1136 | return; | 1122 | return; |
1137 | if (I_PARMRK(tty)) { | 1123 | if (I_PARMRK(tty)) { |
1138 | put_tty_queue('\377', tty); | 1124 | put_tty_queue('\377', ldata); |
1139 | put_tty_queue('\0', tty); | 1125 | put_tty_queue('\0', ldata); |
1140 | put_tty_queue(c, tty); | 1126 | put_tty_queue(c, ldata); |
1141 | } else if (I_INPCK(tty)) | 1127 | } else if (I_INPCK(tty)) |
1142 | put_tty_queue('\0', tty); | 1128 | put_tty_queue('\0', ldata); |
1143 | else | 1129 | else |
1144 | put_tty_queue(c, tty); | 1130 | put_tty_queue(c, ldata); |
1145 | wake_up_interruptible(&tty->read_wait); | 1131 | wake_up_interruptible(&tty->read_wait); |
1146 | } | 1132 | } |
1147 | 1133 | ||
@@ -1162,7 +1148,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) | |||
1162 | int parmrk; | 1148 | int parmrk; |
1163 | 1149 | ||
1164 | if (ldata->raw) { | 1150 | if (ldata->raw) { |
1165 | put_tty_queue(c, tty); | 1151 | put_tty_queue(c, ldata); |
1166 | return; | 1152 | return; |
1167 | } | 1153 | } |
1168 | 1154 | ||
@@ -1172,7 +1158,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) | |||
1172 | c = tolower(c); | 1158 | c = tolower(c); |
1173 | 1159 | ||
1174 | if (L_EXTPROC(tty)) { | 1160 | if (L_EXTPROC(tty)) { |
1175 | put_tty_queue(c, tty); | 1161 | put_tty_queue(c, ldata); |
1176 | return; | 1162 | return; |
1177 | } | 1163 | } |
1178 | 1164 | ||
@@ -1210,16 +1196,16 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) | |||
1210 | return; | 1196 | return; |
1211 | } | 1197 | } |
1212 | if (L_ECHO(tty)) { | 1198 | if (L_ECHO(tty)) { |
1213 | finish_erasing(tty); | 1199 | finish_erasing(ldata); |
1214 | /* Record the column of first canon char. */ | 1200 | /* Record the column of first canon char. */ |
1215 | if (ldata->canon_head == ldata->read_head) | 1201 | if (ldata->canon_head == ldata->read_head) |
1216 | echo_set_canon_col(tty); | 1202 | echo_set_canon_col(ldata); |
1217 | echo_char(c, tty); | 1203 | echo_char(c, tty); |
1218 | process_echoes(tty); | 1204 | process_echoes(tty); |
1219 | } | 1205 | } |
1220 | if (parmrk) | 1206 | if (parmrk) |
1221 | put_tty_queue(c, tty); | 1207 | put_tty_queue(c, ldata); |
1222 | put_tty_queue(c, tty); | 1208 | put_tty_queue(c, ldata); |
1223 | return; | 1209 | return; |
1224 | } | 1210 | } |
1225 | 1211 | ||
@@ -1285,10 +1271,10 @@ send_signal: | |||
1285 | if (c == LNEXT_CHAR(tty) && L_IEXTEN(tty)) { | 1271 | if (c == LNEXT_CHAR(tty) && L_IEXTEN(tty)) { |
1286 | ldata->lnext = 1; | 1272 | ldata->lnext = 1; |
1287 | if (L_ECHO(tty)) { | 1273 | if (L_ECHO(tty)) { |
1288 | finish_erasing(tty); | 1274 | finish_erasing(ldata); |
1289 | if (L_ECHOCTL(tty)) { | 1275 | if (L_ECHOCTL(tty)) { |
1290 | echo_char_raw('^', tty); | 1276 | echo_char_raw('^', ldata); |
1291 | echo_char_raw('\b', tty); | 1277 | echo_char_raw('\b', ldata); |
1292 | process_echoes(tty); | 1278 | process_echoes(tty); |
1293 | } | 1279 | } |
1294 | } | 1280 | } |
@@ -1298,9 +1284,9 @@ send_signal: | |||
1298 | L_IEXTEN(tty)) { | 1284 | L_IEXTEN(tty)) { |
1299 | unsigned long tail = ldata->canon_head; | 1285 | unsigned long tail = ldata->canon_head; |
1300 | 1286 | ||
1301 | finish_erasing(tty); | 1287 | finish_erasing(ldata); |
1302 | echo_char(c, tty); | 1288 | echo_char(c, tty); |
1303 | echo_char_raw('\n', tty); | 1289 | echo_char_raw('\n', ldata); |
1304 | while (tail != ldata->read_head) { | 1290 | while (tail != ldata->read_head) { |
1305 | echo_char(ldata->read_buf[tail], tty); | 1291 | echo_char(ldata->read_buf[tail], tty); |
1306 | tail = (tail+1) & (N_TTY_BUF_SIZE-1); | 1292 | tail = (tail+1) & (N_TTY_BUF_SIZE-1); |
@@ -1315,7 +1301,7 @@ send_signal: | |||
1315 | return; | 1301 | return; |
1316 | } | 1302 | } |
1317 | if (L_ECHO(tty) || L_ECHONL(tty)) { | 1303 | if (L_ECHO(tty) || L_ECHONL(tty)) { |
1318 | echo_char_raw('\n', tty); | 1304 | echo_char_raw('\n', ldata); |
1319 | process_echoes(tty); | 1305 | process_echoes(tty); |
1320 | } | 1306 | } |
1321 | goto handle_newline; | 1307 | goto handle_newline; |
@@ -1343,7 +1329,7 @@ send_signal: | |||
1343 | if (L_ECHO(tty)) { | 1329 | if (L_ECHO(tty)) { |
1344 | /* Record the column of first canon char. */ | 1330 | /* Record the column of first canon char. */ |
1345 | if (ldata->canon_head == ldata->read_head) | 1331 | if (ldata->canon_head == ldata->read_head) |
1346 | echo_set_canon_col(tty); | 1332 | echo_set_canon_col(ldata); |
1347 | echo_char(c, tty); | 1333 | echo_char(c, tty); |
1348 | process_echoes(tty); | 1334 | process_echoes(tty); |
1349 | } | 1335 | } |
@@ -1352,12 +1338,12 @@ send_signal: | |||
1352 | * EOL_CHAR and EOL2_CHAR? | 1338 | * EOL_CHAR and EOL2_CHAR? |
1353 | */ | 1339 | */ |
1354 | if (parmrk) | 1340 | if (parmrk) |
1355 | put_tty_queue(c, tty); | 1341 | put_tty_queue(c, ldata); |
1356 | 1342 | ||
1357 | handle_newline: | 1343 | handle_newline: |
1358 | spin_lock_irqsave(&ldata->read_lock, flags); | 1344 | spin_lock_irqsave(&ldata->read_lock, flags); |
1359 | set_bit(ldata->read_head, ldata->read_flags); | 1345 | set_bit(ldata->read_head, ldata->read_flags); |
1360 | put_tty_queue_nolock(c, tty); | 1346 | put_tty_queue_nolock(c, ldata); |
1361 | ldata->canon_head = ldata->read_head; | 1347 | ldata->canon_head = ldata->read_head; |
1362 | ldata->canon_data++; | 1348 | ldata->canon_data++; |
1363 | spin_unlock_irqrestore(&ldata->read_lock, flags); | 1349 | spin_unlock_irqrestore(&ldata->read_lock, flags); |
@@ -1376,22 +1362,22 @@ handle_newline: | |||
1376 | return; | 1362 | return; |
1377 | } | 1363 | } |
1378 | if (L_ECHO(tty)) { | 1364 | if (L_ECHO(tty)) { |
1379 | finish_erasing(tty); | 1365 | finish_erasing(ldata); |
1380 | if (c == '\n') | 1366 | if (c == '\n') |
1381 | echo_char_raw('\n', tty); | 1367 | echo_char_raw('\n', ldata); |
1382 | else { | 1368 | else { |
1383 | /* Record the column of first canon char. */ | 1369 | /* Record the column of first canon char. */ |
1384 | if (ldata->canon_head == ldata->read_head) | 1370 | if (ldata->canon_head == ldata->read_head) |
1385 | echo_set_canon_col(tty); | 1371 | echo_set_canon_col(ldata); |
1386 | echo_char(c, tty); | 1372 | echo_char(c, tty); |
1387 | } | 1373 | } |
1388 | process_echoes(tty); | 1374 | process_echoes(tty); |
1389 | } | 1375 | } |
1390 | 1376 | ||
1391 | if (parmrk) | 1377 | if (parmrk) |
1392 | put_tty_queue(c, tty); | 1378 | put_tty_queue(c, ldata); |
1393 | 1379 | ||
1394 | put_tty_queue(c, tty); | 1380 | put_tty_queue(c, ldata); |
1395 | } | 1381 | } |
1396 | 1382 | ||
1397 | 1383 | ||
@@ -2140,9 +2126,8 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file, | |||
2140 | return mask; | 2126 | return mask; |
2141 | } | 2127 | } |
2142 | 2128 | ||
2143 | static unsigned long inq_canon(struct tty_struct *tty) | 2129 | static unsigned long inq_canon(struct n_tty_data *ldata) |
2144 | { | 2130 | { |
2145 | struct n_tty_data *ldata = tty->disc_data; | ||
2146 | int nr, head, tail; | 2131 | int nr, head, tail; |
2147 | 2132 | ||
2148 | if (!ldata->canon_data) | 2133 | if (!ldata->canon_data) |
@@ -2173,7 +2158,7 @@ static int n_tty_ioctl(struct tty_struct *tty, struct file *file, | |||
2173 | /* FIXME: Locking */ | 2158 | /* FIXME: Locking */ |
2174 | retval = ldata->read_cnt; | 2159 | retval = ldata->read_cnt; |
2175 | if (L_ICANON(tty)) | 2160 | if (L_ICANON(tty)) |
2176 | retval = inq_canon(tty); | 2161 | retval = inq_canon(ldata); |
2177 | return put_user(retval, (unsigned int __user *) arg); | 2162 | return put_user(retval, (unsigned int __user *) arg); |
2178 | default: | 2163 | default: |
2179 | return n_tty_ioctl_helper(tty, file, cmd, arg); | 2164 | return n_tty_ioctl_helper(tty, file, cmd, arg); |