License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[sfrench/cifs-2.6.git] / arch / parisc / include / asm / termios.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _PARISC_TERMIOS_H
3 #define _PARISC_TERMIOS_H
4
5 #include <uapi/asm/termios.h>
6
7
8 /*      intr=^C         quit=^\         erase=del       kill=^U
9         eof=^D          vtime=\0        vmin=\1         sxtc=\0
10         start=^Q        stop=^S         susp=^Z         eol=\0
11         reprint=^R      discard=^U      werase=^W       lnext=^V
12         eol2=\0
13 */
14 #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
15
16 /*
17  * Translate a "termio" structure into a "termios". Ugh.
18  */
19 #define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
20         unsigned short __tmp; \
21         get_user(__tmp,&(termio)->x); \
22         *(unsigned short *) &(termios)->x = __tmp; \
23 }
24
25 #define user_termio_to_kernel_termios(termios, termio) \
26 ({ \
27         SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
28         SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
29         SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
30         SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
31         copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
32 })
33
34 /*
35  * Translate a "termios" structure into a "termio". Ugh.
36  */
37 #define kernel_termios_to_user_termio(termio, termios) \
38 ({ \
39         put_user((termios)->c_iflag, &(termio)->c_iflag); \
40         put_user((termios)->c_oflag, &(termio)->c_oflag); \
41         put_user((termios)->c_cflag, &(termio)->c_cflag); \
42         put_user((termios)->c_lflag, &(termio)->c_lflag); \
43         put_user((termios)->c_line,  &(termio)->c_line); \
44         copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
45 })
46
47 #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
48 #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
49 #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
50 #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
51
52 #endif  /* _PARISC_TERMIOS_H */