[POWERPC] mpic_u3msi: Failed allocation unnoticed
[linux-2.6/next.git] / include / asm-sparc64 / termios.h
blobcacbea171ad74bc60800e8b2601d99595a3bd6fb
1 /* $Id: termios.h,v 1.11 2001/06/01 08:12:11 davem Exp $ */
2 #ifndef _SPARC64_TERMIOS_H
3 #define _SPARC64_TERMIOS_H
5 #include <asm/ioctls.h>
6 #include <asm/termbits.h>
8 #if defined(__KERNEL__) || defined(__DEFINE_BSD_TERMIOS)
9 struct sgttyb {
10 char sg_ispeed;
11 char sg_ospeed;
12 char sg_erase;
13 char sg_kill;
14 short sg_flags;
17 struct tchars {
18 char t_intrc;
19 char t_quitc;
20 char t_startc;
21 char t_stopc;
22 char t_eofc;
23 char t_brkc;
26 struct ltchars {
27 char t_suspc;
28 char t_dsuspc;
29 char t_rprntc;
30 char t_flushc;
31 char t_werasc;
32 char t_lnextc;
34 #endif /* __KERNEL__ */
36 struct winsize {
37 unsigned short ws_row;
38 unsigned short ws_col;
39 unsigned short ws_xpixel;
40 unsigned short ws_ypixel;
43 #ifdef __KERNEL__
44 #include <linux/module.h>
47 * c_cc characters in the termio structure. Oh, how I love being
48 * backwardly compatible. Notice that character 4 and 5 are
49 * interpreted differently depending on whether ICANON is set in
50 * c_lflag. If it's set, they are used as _VEOF and _VEOL, otherwise
51 * as _VMIN and V_TIME. This is for compatibility with OSF/1 (which
52 * is compatible with sysV)...
54 #define _VMIN 4
55 #define _VTIME 5
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
63 #define INIT_C_CC "\003\034\177\025\004\000\000\000\021\023\032\031\022\025\027\026\001"
66 * Translate a "termio" structure into a "termios". Ugh.
68 #define user_termio_to_kernel_termios(termios, termio) \
69 ({ \
70 unsigned short tmp; \
71 int err; \
72 err = get_user(tmp, &(termio)->c_iflag); \
73 (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
74 err |= get_user(tmp, &(termio)->c_oflag); \
75 (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
76 err |= get_user(tmp, &(termio)->c_cflag); \
77 (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
78 err |= get_user(tmp, &(termio)->c_lflag); \
79 (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
80 err |= copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
81 err; \
85 * Translate a "termios" structure into a "termio". Ugh.
87 * Note the "fun" _VMIN overloading.
89 #define kernel_termios_to_user_termio(termio, termios) \
90 ({ \
91 int err; \
92 err = put_user((termios)->c_iflag, &(termio)->c_iflag); \
93 err |= put_user((termios)->c_oflag, &(termio)->c_oflag); \
94 err |= put_user((termios)->c_cflag, &(termio)->c_cflag); \
95 err |= put_user((termios)->c_lflag, &(termio)->c_lflag); \
96 err |= put_user((termios)->c_line, &(termio)->c_line); \
97 err |= copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
98 if (!((termios)->c_lflag & ICANON)) { \
99 err |= put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \
100 err |= put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \
102 err; \
105 #define user_termios_to_kernel_termios(k, u) \
106 ({ \
107 int err; \
108 err = get_user((k)->c_iflag, &(u)->c_iflag); \
109 err |= get_user((k)->c_oflag, &(u)->c_oflag); \
110 err |= get_user((k)->c_cflag, &(u)->c_cflag); \
111 err |= get_user((k)->c_lflag, &(u)->c_lflag); \
112 err |= get_user((k)->c_line, &(u)->c_line); \
113 err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
114 if((k)->c_lflag & ICANON) { \
115 err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
116 err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
117 } else { \
118 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
119 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
121 err |= get_user((k)->c_ispeed, &(u)->c_ispeed); \
122 err |= get_user((k)->c_ospeed, &(u)->c_ospeed); \
123 err; \
126 #define kernel_termios_to_user_termios(u, k) \
127 ({ \
128 int err; \
129 err = put_user((k)->c_iflag, &(u)->c_iflag); \
130 err |= put_user((k)->c_oflag, &(u)->c_oflag); \
131 err |= put_user((k)->c_cflag, &(u)->c_cflag); \
132 err |= put_user((k)->c_lflag, &(u)->c_lflag); \
133 err |= put_user((k)->c_line, &(u)->c_line); \
134 err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
135 if(!((k)->c_lflag & ICANON)) { \
136 err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
137 err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
138 } else { \
139 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
140 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
142 err |= put_user((k)->c_ispeed, &(u)->c_ispeed); \
143 err |= put_user((k)->c_ospeed, &(u)->c_ospeed); \
144 err; \
147 #define user_termios_to_kernel_termios_1(k, u) \
148 ({ \
149 int err; \
150 err = get_user((k)->c_iflag, &(u)->c_iflag); \
151 err |= get_user((k)->c_oflag, &(u)->c_oflag); \
152 err |= get_user((k)->c_cflag, &(u)->c_cflag); \
153 err |= get_user((k)->c_lflag, &(u)->c_lflag); \
154 err |= get_user((k)->c_line, &(u)->c_line); \
155 err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
156 if((k)->c_lflag & ICANON) { \
157 err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
158 err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
159 } else { \
160 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
161 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
163 err; \
166 #define kernel_termios_to_user_termios_1(u, k) \
167 ({ \
168 int err; \
169 err = put_user((k)->c_iflag, &(u)->c_iflag); \
170 err |= put_user((k)->c_oflag, &(u)->c_oflag); \
171 err |= put_user((k)->c_cflag, &(u)->c_cflag); \
172 err |= put_user((k)->c_lflag, &(u)->c_lflag); \
173 err |= put_user((k)->c_line, &(u)->c_line); \
174 err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
175 if(!((k)->c_lflag & ICANON)) { \
176 err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
177 err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
178 } else { \
179 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
180 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
182 err; \
185 #endif /* __KERNEL__ */
187 #endif /* _SPARC64_TERMIOS_H */