Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
termios.h
Go to the documentation of this file.
1 /*
2  * Modified 1999
3  * David Mosberger-Tang <[email protected]>, Hewlett-Packard Co
4  *
5  * 99/01/28 Added N_IRDA and N_SMSBLOCK
6  */
7 #ifndef _ASM_IA64_TERMIOS_H
8 #define _ASM_IA64_TERMIOS_H
9 
10 #include <uapi/asm/termios.h>
11 
12 
13 /* intr=^C quit=^\ erase=del kill=^U
14  eof=^D vtime=\0 vmin=\1 sxtc=\0
15  start=^Q stop=^S susp=^Z eol=\0
16  reprint=^R discard=^U werase=^W lnext=^V
17  eol2=\0
18 */
19 #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
20 
21 /*
22  * Translate a "termio" structure into a "termios". Ugh.
23  */
24 #define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
25  unsigned short __tmp; \
26  get_user(__tmp,&(termio)->x); \
27  *(unsigned short *) &(termios)->x = __tmp; \
28 }
29 
30 #define user_termio_to_kernel_termios(termios, termio) \
31 ({ \
32  SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
33  SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
34  SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
35  SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
36  copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
37 })
38 
39 /*
40  * Translate a "termios" structure into a "termio". Ugh.
41  */
42 #define kernel_termios_to_user_termio(termio, termios) \
43 ({ \
44  put_user((termios)->c_iflag, &(termio)->c_iflag); \
45  put_user((termios)->c_oflag, &(termio)->c_oflag); \
46  put_user((termios)->c_cflag, &(termio)->c_cflag); \
47  put_user((termios)->c_lflag, &(termio)->c_lflag); \
48  put_user((termios)->c_line, &(termio)->c_line); \
49  copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
50 })
51 
52 #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
53 #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
54 #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
55 #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
56 
57 #endif /* _ASM_IA64_TERMIOS_H */