summaryrefslogtreecommitdiffstats
path: root/include/asm-i386/termios.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-04-29 21:13:14 +0000
committer <ralf@linux-mips.org>1997-04-29 21:13:14 +0000
commit19c9bba94152148523ba0f7ef7cffe3d45656b11 (patch)
tree40b1cb534496a7f1ca0f5c314a523c69f1fee464 /include/asm-i386/termios.h
parent7206675c40394c78a90e74812bbdbf8cf3cca1be (diff)
Import of Linux/MIPS 2.1.36
Diffstat (limited to 'include/asm-i386/termios.h')
-rw-r--r--include/asm-i386/termios.h66
1 files changed, 35 insertions, 31 deletions
diff --git a/include/asm-i386/termios.h b/include/asm-i386/termios.h
index 76551dea9..c1176d6f8 100644
--- a/include/asm-i386/termios.h
+++ b/include/asm-i386/termios.h
@@ -21,16 +21,6 @@ struct termio {
unsigned char c_cc[NCC]; /* control characters */
};
-#ifdef __KERNEL__
-/* intr=^C quit=^\ erase=del kill=^U
- eof=^D vtime=\0 vmin=\1 sxtc=\0
- start=^Q stop=^S susp=^Z eol=\0
- reprint=^R discard=^U werase=^W lnext=^V
- eol2=\0
-*/
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-#endif
-
/* modem lines */
#define TIOCM_LE 0x001
#define TIOCM_DTR 0x002
@@ -43,6 +33,8 @@ struct termio {
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
@@ -53,39 +45,51 @@ struct termio {
#define N_PPP 3
#define N_STRIP 4
#define N_AX25 5
+#define N_X25 6 /* X.25 async */
#ifdef __KERNEL__
-#include <linux/string.h>
+/* intr=^C quit=^\ erase=del kill=^U
+ eof=^D vtime=\0 vmin=\1 sxtc=\0
+ start=^Q stop=^S susp=^Z eol=\0
+ reprint=^R discard=^U werase=^W lnext=^V
+ eol2=\0
+*/
+#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
/*
* Translate a "termio" structure into a "termios". Ugh.
*/
-extern inline void trans_from_termio(struct termio * termio,
- struct termios * termios)
-{
-#define SET_LOW_BITS(x,y) (*(unsigned short *)(&x) = (y))
- SET_LOW_BITS(termios->c_iflag, termio->c_iflag);
- SET_LOW_BITS(termios->c_oflag, termio->c_oflag);
- SET_LOW_BITS(termios->c_cflag, termio->c_cflag);
- SET_LOW_BITS(termios->c_lflag, termio->c_lflag);
-#undef SET_LOW_BITS
- memcpy(termios->c_cc, termio->c_cc, NCC);
+#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
+ unsigned short __tmp; \
+ get_user(__tmp,&(termio)->x); \
+ *(unsigned short *) &(termios)->x = __tmp; \
}
+#define user_termio_to_kernel_termios(termios, termio) \
+({ \
+ SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
+ SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
+ SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
+ SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
+ copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
+})
+
/*
* Translate a "termios" structure into a "termio". Ugh.
*/
-extern inline void trans_to_termio(struct termios * termios,
- struct termio * termio)
-{
- termio->c_iflag = termios->c_iflag;
- termio->c_oflag = termios->c_oflag;
- termio->c_cflag = termios->c_cflag;
- termio->c_lflag = termios->c_lflag;
- termio->c_line = termios->c_line;
- memcpy(termio->c_cc, termios->c_cc, NCC);
-}
+#define kernel_termios_to_user_termio(termio, termios) \
+({ \
+ put_user((termios)->c_iflag, &(termio)->c_iflag); \
+ put_user((termios)->c_oflag, &(termio)->c_oflag); \
+ put_user((termios)->c_cflag, &(termio)->c_cflag); \
+ put_user((termios)->c_lflag, &(termio)->c_lflag); \
+ put_user((termios)->c_line, &(termio)->c_line); \
+ copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
+})
+
+#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
+#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
#endif /* __KERNEL__ */