diff options
author | David Miller <davem@davemloft.net> | 2007-10-17 22:38:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-10-17 22:38:10 -0400 |
commit | 6050afbbb01d1f5a867f7839be6460bac801f5bc (patch) | |
tree | 022be422a8b28f7b630cf20e8b7674b2dfcc9cfc /include/asm-sparc/termios.h | |
parent | 4209ab098c61b1a9684bb4d3fc287352fc2438c3 (diff) |
[SPARC]: Support for new termios.
[akpm@linux-foundation.org: coding-style tweaks]
Signed-off-by: David Miller <davem@davemloft.net>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-sparc/termios.h')
-rw-r--r-- | include/asm-sparc/termios.h | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h index d767f206ab33..4333232abb9f 100644 --- a/include/asm-sparc/termios.h +++ b/include/asm-sparc/termios.h | |||
@@ -108,13 +108,55 @@ struct winsize { | |||
108 | 108 | ||
109 | #define user_termios_to_kernel_termios(k, u) \ | 109 | #define user_termios_to_kernel_termios(k, u) \ |
110 | ({ \ | 110 | ({ \ |
111 | int err; \ | ||
112 | err = get_user((k)->c_iflag, &(u)->c_iflag); \ | ||
113 | err |= get_user((k)->c_oflag, &(u)->c_oflag); \ | ||
114 | err |= get_user((k)->c_cflag, &(u)->c_cflag); \ | ||
115 | err |= get_user((k)->c_lflag, &(u)->c_lflag); \ | ||
116 | err |= get_user((k)->c_line, &(u)->c_line); \ | ||
117 | err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \ | ||
118 | if ((k)->c_lflag & ICANON) { \ | ||
119 | err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | ||
120 | err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | ||
121 | } else { \ | ||
122 | err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | ||
123 | err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | ||
124 | } \ | ||
125 | err |= get_user((k)->c_ispeed, &(u)->c_ispeed); \ | ||
126 | err |= get_user((k)->c_ospeed, &(u)->c_ospeed); \ | ||
127 | err; \ | ||
128 | }) | ||
129 | |||
130 | #define kernel_termios_to_user_termios(u, k) \ | ||
131 | ({ \ | ||
132 | int err; \ | ||
133 | err = put_user((k)->c_iflag, &(u)->c_iflag); \ | ||
134 | err |= put_user((k)->c_oflag, &(u)->c_oflag); \ | ||
135 | err |= put_user((k)->c_cflag, &(u)->c_cflag); \ | ||
136 | err |= put_user((k)->c_lflag, &(u)->c_lflag); \ | ||
137 | err |= put_user((k)->c_line, &(u)->c_line); \ | ||
138 | err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \ | ||
139 | if (!((k)->c_lflag & ICANON)) { \ | ||
140 | err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | ||
141 | err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | ||
142 | } else { \ | ||
143 | err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | ||
144 | err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | ||
145 | } \ | ||
146 | err |= put_user((k)->c_ispeed, &(u)->c_ispeed); \ | ||
147 | err |= put_user((k)->c_ospeed, &(u)->c_ospeed); \ | ||
148 | err; \ | ||
149 | }) | ||
150 | |||
151 | #define user_termios_to_kernel_termios_1(k, u) \ | ||
152 | ({ \ | ||
111 | get_user((k)->c_iflag, &(u)->c_iflag); \ | 153 | get_user((k)->c_iflag, &(u)->c_iflag); \ |
112 | get_user((k)->c_oflag, &(u)->c_oflag); \ | 154 | get_user((k)->c_oflag, &(u)->c_oflag); \ |
113 | get_user((k)->c_cflag, &(u)->c_cflag); \ | 155 | get_user((k)->c_cflag, &(u)->c_cflag); \ |
114 | get_user((k)->c_lflag, &(u)->c_lflag); \ | 156 | get_user((k)->c_lflag, &(u)->c_lflag); \ |
115 | get_user((k)->c_line, &(u)->c_line); \ | 157 | get_user((k)->c_line, &(u)->c_line); \ |
116 | copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \ | 158 | copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \ |
117 | if((k)->c_lflag & ICANON) { \ | 159 | if ((k)->c_lflag & ICANON) { \ |
118 | get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | 160 | get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ |
119 | get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | 161 | get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ |
120 | } else { \ | 162 | } else { \ |
@@ -124,7 +166,7 @@ struct winsize { | |||
124 | 0; \ | 166 | 0; \ |
125 | }) | 167 | }) |
126 | 168 | ||
127 | #define kernel_termios_to_user_termios(u, k) \ | 169 | #define kernel_termios_to_user_termios_1(u, k) \ |
128 | ({ \ | 170 | ({ \ |
129 | put_user((k)->c_iflag, &(u)->c_iflag); \ | 171 | put_user((k)->c_iflag, &(u)->c_iflag); \ |
130 | put_user((k)->c_oflag, &(u)->c_oflag); \ | 172 | put_user((k)->c_oflag, &(u)->c_oflag); \ |
@@ -132,7 +174,7 @@ struct winsize { | |||
132 | put_user((k)->c_lflag, &(u)->c_lflag); \ | 174 | put_user((k)->c_lflag, &(u)->c_lflag); \ |
133 | put_user((k)->c_line, &(u)->c_line); \ | 175 | put_user((k)->c_line, &(u)->c_line); \ |
134 | copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \ | 176 | copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \ |
135 | if(!((k)->c_lflag & ICANON)) { \ | 177 | if (!((k)->c_lflag & ICANON)) { \ |
136 | put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | 178 | put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ |
137 | put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | 179 | put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ |
138 | } else { \ | 180 | } else { \ |