diff options
Diffstat (limited to 'include/asm-sparc/termios.h')
-rw-r--r-- | include/asm-sparc/termios.h | 183 |
1 files changed, 0 insertions, 183 deletions
diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h deleted file mode 100644 index f7b4409c35ff..000000000000 --- a/include/asm-sparc/termios.h +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
1 | #ifndef _SPARC_TERMIOS_H | ||
2 | #define _SPARC_TERMIOS_H | ||
3 | |||
4 | #include <asm/ioctls.h> | ||
5 | #include <asm/termbits.h> | ||
6 | |||
7 | #if defined(__KERNEL__) || defined(__DEFINE_BSD_TERMIOS) | ||
8 | struct sgttyb { | ||
9 | char sg_ispeed; | ||
10 | char sg_ospeed; | ||
11 | char sg_erase; | ||
12 | char sg_kill; | ||
13 | short sg_flags; | ||
14 | }; | ||
15 | |||
16 | struct tchars { | ||
17 | char t_intrc; | ||
18 | char t_quitc; | ||
19 | char t_startc; | ||
20 | char t_stopc; | ||
21 | char t_eofc; | ||
22 | char t_brkc; | ||
23 | }; | ||
24 | |||
25 | struct ltchars { | ||
26 | char t_suspc; | ||
27 | char t_dsuspc; | ||
28 | char t_rprntc; | ||
29 | char t_flushc; | ||
30 | char t_werasc; | ||
31 | char t_lnextc; | ||
32 | }; | ||
33 | #endif /* __KERNEL__ */ | ||
34 | |||
35 | struct winsize { | ||
36 | unsigned short ws_row; | ||
37 | unsigned short ws_col; | ||
38 | unsigned short ws_xpixel; | ||
39 | unsigned short ws_ypixel; | ||
40 | }; | ||
41 | |||
42 | #ifdef __KERNEL__ | ||
43 | #include <linux/module.h> | ||
44 | |||
45 | /* | ||
46 | * c_cc characters in the termio structure. Oh, how I love being | ||
47 | * backwardly compatible. Notice that character 4 and 5 are | ||
48 | * interpreted differently depending on whether ICANON is set in | ||
49 | * c_lflag. If it's set, they are used as _VEOF and _VEOL, otherwise | ||
50 | * as _VMIN and V_TIME. This is for compatibility with OSF/1 (which | ||
51 | * is compatible with sysV)... | ||
52 | */ | ||
53 | #define _VMIN 4 | ||
54 | #define _VTIME 5 | ||
55 | |||
56 | |||
57 | /* intr=^C quit=^\ erase=del kill=^U | ||
58 | eof=^D eol=\0 eol2=\0 sxtc=\0 | ||
59 | start=^Q stop=^S susp=^Z dsusp=^Y | ||
60 | reprint=^R discard=^U werase=^W lnext=^V | ||
61 | vmin=\1 vtime=\0 | ||
62 | */ | ||
63 | #define INIT_C_CC "\003\034\177\025\004\000\000\000\021\023\032\031\022\025\027\026\001" | ||
64 | |||
65 | /* | ||
66 | * Translate a "termio" structure into a "termios". Ugh. | ||
67 | */ | ||
68 | #define user_termio_to_kernel_termios(termios, termio) \ | ||
69 | ({ \ | ||
70 | unsigned short tmp; \ | ||
71 | get_user(tmp, &(termio)->c_iflag); \ | ||
72 | (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \ | ||
73 | get_user(tmp, &(termio)->c_oflag); \ | ||
74 | (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \ | ||
75 | get_user(tmp, &(termio)->c_cflag); \ | ||
76 | (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \ | ||
77 | get_user(tmp, &(termio)->c_lflag); \ | ||
78 | (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \ | ||
79 | copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ | ||
80 | 0; \ | ||
81 | }) | ||
82 | |||
83 | /* | ||
84 | * Translate a "termios" structure into a "termio". Ugh. | ||
85 | * | ||
86 | * Note the "fun" _VMIN overloading. | ||
87 | */ | ||
88 | #define kernel_termios_to_user_termio(termio, termios) \ | ||
89 | ({ \ | ||
90 | put_user((termios)->c_iflag, &(termio)->c_iflag); \ | ||
91 | put_user((termios)->c_oflag, &(termio)->c_oflag); \ | ||
92 | put_user((termios)->c_cflag, &(termio)->c_cflag); \ | ||
93 | put_user((termios)->c_lflag, &(termio)->c_lflag); \ | ||
94 | put_user((termios)->c_line, &(termio)->c_line); \ | ||
95 | copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | ||
96 | if (!((termios)->c_lflag & ICANON)) { \ | ||
97 | put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \ | ||
98 | put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \ | ||
99 | } \ | ||
100 | 0; \ | ||
101 | }) | ||
102 | |||
103 | #define user_termios_to_kernel_termios(k, u) \ | ||
104 | ({ \ | ||
105 | int err; \ | ||
106 | err = get_user((k)->c_iflag, &(u)->c_iflag); \ | ||
107 | err |= get_user((k)->c_oflag, &(u)->c_oflag); \ | ||
108 | err |= get_user((k)->c_cflag, &(u)->c_cflag); \ | ||
109 | err |= get_user((k)->c_lflag, &(u)->c_lflag); \ | ||
110 | err |= get_user((k)->c_line, &(u)->c_line); \ | ||
111 | err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \ | ||
112 | if ((k)->c_lflag & ICANON) { \ | ||
113 | err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | ||
114 | err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | ||
115 | } else { \ | ||
116 | err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | ||
117 | err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | ||
118 | } \ | ||
119 | err |= get_user((k)->c_ispeed, &(u)->c_ispeed); \ | ||
120 | err |= get_user((k)->c_ospeed, &(u)->c_ospeed); \ | ||
121 | err; \ | ||
122 | }) | ||
123 | |||
124 | #define kernel_termios_to_user_termios(u, k) \ | ||
125 | ({ \ | ||
126 | int err; \ | ||
127 | err = put_user((k)->c_iflag, &(u)->c_iflag); \ | ||
128 | err |= put_user((k)->c_oflag, &(u)->c_oflag); \ | ||
129 | err |= put_user((k)->c_cflag, &(u)->c_cflag); \ | ||
130 | err |= put_user((k)->c_lflag, &(u)->c_lflag); \ | ||
131 | err |= put_user((k)->c_line, &(u)->c_line); \ | ||
132 | err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \ | ||
133 | if (!((k)->c_lflag & ICANON)) { \ | ||
134 | err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | ||
135 | err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | ||
136 | } else { \ | ||
137 | err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | ||
138 | err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | ||
139 | } \ | ||
140 | err |= put_user((k)->c_ispeed, &(u)->c_ispeed); \ | ||
141 | err |= put_user((k)->c_ospeed, &(u)->c_ospeed); \ | ||
142 | err; \ | ||
143 | }) | ||
144 | |||
145 | #define user_termios_to_kernel_termios_1(k, u) \ | ||
146 | ({ \ | ||
147 | get_user((k)->c_iflag, &(u)->c_iflag); \ | ||
148 | get_user((k)->c_oflag, &(u)->c_oflag); \ | ||
149 | get_user((k)->c_cflag, &(u)->c_cflag); \ | ||
150 | get_user((k)->c_lflag, &(u)->c_lflag); \ | ||
151 | get_user((k)->c_line, &(u)->c_line); \ | ||
152 | copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \ | ||
153 | if ((k)->c_lflag & ICANON) { \ | ||
154 | get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | ||
155 | get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | ||
156 | } else { \ | ||
157 | get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | ||
158 | get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | ||
159 | } \ | ||
160 | 0; \ | ||
161 | }) | ||
162 | |||
163 | #define kernel_termios_to_user_termios_1(u, k) \ | ||
164 | ({ \ | ||
165 | put_user((k)->c_iflag, &(u)->c_iflag); \ | ||
166 | put_user((k)->c_oflag, &(u)->c_oflag); \ | ||
167 | put_user((k)->c_cflag, &(u)->c_cflag); \ | ||
168 | put_user((k)->c_lflag, &(u)->c_lflag); \ | ||
169 | put_user((k)->c_line, &(u)->c_line); \ | ||
170 | copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \ | ||
171 | if (!((k)->c_lflag & ICANON)) { \ | ||
172 | put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | ||
173 | put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | ||
174 | } else { \ | ||
175 | put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | ||
176 | put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | ||
177 | } \ | ||
178 | 0; \ | ||
179 | }) | ||
180 | |||
181 | #endif /* __KERNEL__ */ | ||
182 | |||
183 | #endif /* _SPARC_TERMIOS_H */ | ||