x86/efi: Enforce CONFIG_RELOCATABLE for EFI boot stub
[linux/fpc-iii.git] / arch / sparc / include / asm / termios.h
blob0c2414ddd52c336e244789283b72067cc06ed365
1 #ifndef _SPARC_TERMIOS_H
2 #define _SPARC_TERMIOS_H
4 #include <uapi/asm/termios.h>
7 /*
8 * c_cc characters in the termio structure. Oh, how I love being
9 * backwardly compatible. Notice that character 4 and 5 are
10 * interpreted differently depending on whether ICANON is set in
11 * c_lflag. If it's set, they are used as _VEOF and _VEOL, otherwise
12 * as _VMIN and V_TIME. This is for compatibility with OSF/1 (which
13 * is compatible with sysV)...
15 #define _VMIN 4
16 #define _VTIME 5
18 /* intr=^C quit=^\ erase=del kill=^U
19 eof=^D eol=\0 eol2=\0 sxtc=\0
20 start=^Q stop=^S susp=^Z dsusp=^Y
21 reprint=^R discard=^U werase=^W lnext=^V
22 vmin=\1 vtime=\0
24 #define INIT_C_CC "\003\034\177\025\004\000\000\000\021\023\032\031\022\025\027\026\001"
27 * Translate a "termio" structure into a "termios". Ugh.
29 #define user_termio_to_kernel_termios(termios, termio) \
30 ({ \
31 unsigned short tmp; \
32 int err; \
33 err = get_user(tmp, &(termio)->c_iflag); \
34 (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
35 err |= get_user(tmp, &(termio)->c_oflag); \
36 (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
37 err |= get_user(tmp, &(termio)->c_cflag); \
38 (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
39 err |= get_user(tmp, &(termio)->c_lflag); \
40 (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
41 err |= copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
42 err; \
46 * Translate a "termios" structure into a "termio". Ugh.
48 * Note the "fun" _VMIN overloading.
50 #define kernel_termios_to_user_termio(termio, termios) \
51 ({ \
52 int err; \
53 err = put_user((termios)->c_iflag, &(termio)->c_iflag); \
54 err |= put_user((termios)->c_oflag, &(termio)->c_oflag); \
55 err |= put_user((termios)->c_cflag, &(termio)->c_cflag); \
56 err |= put_user((termios)->c_lflag, &(termio)->c_lflag); \
57 err |= put_user((termios)->c_line, &(termio)->c_line); \
58 err |= copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
59 if (!((termios)->c_lflag & ICANON)) { \
60 err |= put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \
61 err |= put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \
62 } \
63 err; \
66 #define user_termios_to_kernel_termios(k, u) \
67 ({ \
68 int err; \
69 err = get_user((k)->c_iflag, &(u)->c_iflag); \
70 err |= get_user((k)->c_oflag, &(u)->c_oflag); \
71 err |= get_user((k)->c_cflag, &(u)->c_cflag); \
72 err |= get_user((k)->c_lflag, &(u)->c_lflag); \
73 err |= get_user((k)->c_line, &(u)->c_line); \
74 err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
75 if ((k)->c_lflag & ICANON) { \
76 err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
77 err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
78 } else { \
79 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
80 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
81 } \
82 err |= get_user((k)->c_ispeed, &(u)->c_ispeed); \
83 err |= get_user((k)->c_ospeed, &(u)->c_ospeed); \
84 err; \
87 #define kernel_termios_to_user_termios(u, k) \
88 ({ \
89 int err; \
90 err = put_user((k)->c_iflag, &(u)->c_iflag); \
91 err |= put_user((k)->c_oflag, &(u)->c_oflag); \
92 err |= put_user((k)->c_cflag, &(u)->c_cflag); \
93 err |= put_user((k)->c_lflag, &(u)->c_lflag); \
94 err |= put_user((k)->c_line, &(u)->c_line); \
95 err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
96 if (!((k)->c_lflag & ICANON)) { \
97 err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
98 err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
99 } else { \
100 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
101 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
103 err |= put_user((k)->c_ispeed, &(u)->c_ispeed); \
104 err |= put_user((k)->c_ospeed, &(u)->c_ospeed); \
105 err; \
108 #define user_termios_to_kernel_termios_1(k, u) \
109 ({ \
110 int err; \
111 err = get_user((k)->c_iflag, &(u)->c_iflag); \
112 err |= get_user((k)->c_oflag, &(u)->c_oflag); \
113 err |= get_user((k)->c_cflag, &(u)->c_cflag); \
114 err |= get_user((k)->c_lflag, &(u)->c_lflag); \
115 err |= get_user((k)->c_line, &(u)->c_line); \
116 err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
117 if ((k)->c_lflag & ICANON) { \
118 err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
119 err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
120 } else { \
121 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
122 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
124 err; \
127 #define kernel_termios_to_user_termios_1(u, k) \
128 ({ \
129 int err; \
130 err = put_user((k)->c_iflag, &(u)->c_iflag); \
131 err |= put_user((k)->c_oflag, &(u)->c_oflag); \
132 err |= put_user((k)->c_cflag, &(u)->c_cflag); \
133 err |= put_user((k)->c_lflag, &(u)->c_lflag); \
134 err |= put_user((k)->c_line, &(u)->c_line); \
135 err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
136 if (!((k)->c_lflag & ICANON)) { \
137 err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
138 err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
139 } else { \
140 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
141 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
143 err; \
146 #endif /* _SPARC_TERMIOS_H */