diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2008-06-06 15:27:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-18 00:42:15 -0400 |
commit | c6d1b0e3d2b71ded7c457c2c9f1ab8c2c957aafe (patch) | |
tree | 18700d1b847b6c47c91cfbd356b6499f0145cc9f /include/asm-sparc | |
parent | 943d0e86133a3f2e69b24e9754390a60d92ad224 (diff) |
sparc: Merge asm-sparc{,64}/termios.h
Bring the commit e55c57e0b51c68d78845549505057169c6c3cba6
("[SPARC64]: Report any user access faults in termios accessors")
over to sparc when unifying the two files.
The diff was manually inspected to contain no
other relevant changes.
This unification therefore changes functionality of sparc.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'include/asm-sparc')
-rw-r--r-- | include/asm-sparc/termios.h | 79 |
1 files changed, 41 insertions, 38 deletions
diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h index f7b4409c35ff..e8ba95399643 100644 --- a/include/asm-sparc/termios.h +++ b/include/asm-sparc/termios.h | |||
@@ -53,7 +53,6 @@ struct winsize { | |||
53 | #define _VMIN 4 | 53 | #define _VMIN 4 |
54 | #define _VTIME 5 | 54 | #define _VTIME 5 |
55 | 55 | ||
56 | |||
57 | /* intr=^C quit=^\ erase=del kill=^U | 56 | /* intr=^C quit=^\ erase=del kill=^U |
58 | eof=^D eol=\0 eol2=\0 sxtc=\0 | 57 | eof=^D eol=\0 eol2=\0 sxtc=\0 |
59 | start=^Q stop=^S susp=^Z dsusp=^Y | 58 | start=^Q stop=^S susp=^Z dsusp=^Y |
@@ -68,16 +67,17 @@ struct winsize { | |||
68 | #define user_termio_to_kernel_termios(termios, termio) \ | 67 | #define user_termio_to_kernel_termios(termios, termio) \ |
69 | ({ \ | 68 | ({ \ |
70 | unsigned short tmp; \ | 69 | unsigned short tmp; \ |
71 | get_user(tmp, &(termio)->c_iflag); \ | 70 | int err; \ |
71 | err = get_user(tmp, &(termio)->c_iflag); \ | ||
72 | (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \ | 72 | (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \ |
73 | get_user(tmp, &(termio)->c_oflag); \ | 73 | err |= get_user(tmp, &(termio)->c_oflag); \ |
74 | (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \ | 74 | (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \ |
75 | get_user(tmp, &(termio)->c_cflag); \ | 75 | err |= get_user(tmp, &(termio)->c_cflag); \ |
76 | (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \ | 76 | (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \ |
77 | get_user(tmp, &(termio)->c_lflag); \ | 77 | err |= get_user(tmp, &(termio)->c_lflag); \ |
78 | (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \ | 78 | (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \ |
79 | copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ | 79 | err |= copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ |
80 | 0; \ | 80 | err; \ |
81 | }) | 81 | }) |
82 | 82 | ||
83 | /* | 83 | /* |
@@ -87,17 +87,18 @@ struct winsize { | |||
87 | */ | 87 | */ |
88 | #define kernel_termios_to_user_termio(termio, termios) \ | 88 | #define kernel_termios_to_user_termio(termio, termios) \ |
89 | ({ \ | 89 | ({ \ |
90 | put_user((termios)->c_iflag, &(termio)->c_iflag); \ | 90 | int err; \ |
91 | put_user((termios)->c_oflag, &(termio)->c_oflag); \ | 91 | err = put_user((termios)->c_iflag, &(termio)->c_iflag); \ |
92 | put_user((termios)->c_cflag, &(termio)->c_cflag); \ | 92 | err |= put_user((termios)->c_oflag, &(termio)->c_oflag); \ |
93 | put_user((termios)->c_lflag, &(termio)->c_lflag); \ | 93 | err |= put_user((termios)->c_cflag, &(termio)->c_cflag); \ |
94 | put_user((termios)->c_line, &(termio)->c_line); \ | 94 | err |= put_user((termios)->c_lflag, &(termio)->c_lflag); \ |
95 | copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | 95 | err |= put_user((termios)->c_line, &(termio)->c_line); \ |
96 | err |= copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | ||
96 | if (!((termios)->c_lflag & ICANON)) { \ | 97 | if (!((termios)->c_lflag & ICANON)) { \ |
97 | put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \ | 98 | err |= put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \ |
98 | put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \ | 99 | err |= put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \ |
99 | } \ | 100 | } \ |
100 | 0; \ | 101 | err; \ |
101 | }) | 102 | }) |
102 | 103 | ||
103 | #define user_termios_to_kernel_termios(k, u) \ | 104 | #define user_termios_to_kernel_termios(k, u) \ |
@@ -144,38 +145,40 @@ struct winsize { | |||
144 | 145 | ||
145 | #define user_termios_to_kernel_termios_1(k, u) \ | 146 | #define user_termios_to_kernel_termios_1(k, u) \ |
146 | ({ \ | 147 | ({ \ |
147 | get_user((k)->c_iflag, &(u)->c_iflag); \ | 148 | int err; \ |
148 | get_user((k)->c_oflag, &(u)->c_oflag); \ | 149 | err = get_user((k)->c_iflag, &(u)->c_iflag); \ |
149 | get_user((k)->c_cflag, &(u)->c_cflag); \ | 150 | err |= get_user((k)->c_oflag, &(u)->c_oflag); \ |
150 | get_user((k)->c_lflag, &(u)->c_lflag); \ | 151 | err |= get_user((k)->c_cflag, &(u)->c_cflag); \ |
151 | get_user((k)->c_line, &(u)->c_line); \ | 152 | err |= get_user((k)->c_lflag, &(u)->c_lflag); \ |
152 | copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \ | 153 | err |= get_user((k)->c_line, &(u)->c_line); \ |
154 | err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \ | ||
153 | if ((k)->c_lflag & ICANON) { \ | 155 | if ((k)->c_lflag & ICANON) { \ |
154 | get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | 156 | err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ |
155 | get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | 157 | err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ |
156 | } else { \ | 158 | } else { \ |
157 | get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | 159 | err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ |
158 | get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | 160 | err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ |
159 | } \ | 161 | } \ |
160 | 0; \ | 162 | err; \ |
161 | }) | 163 | }) |
162 | 164 | ||
163 | #define kernel_termios_to_user_termios_1(u, k) \ | 165 | #define kernel_termios_to_user_termios_1(u, k) \ |
164 | ({ \ | 166 | ({ \ |
165 | put_user((k)->c_iflag, &(u)->c_iflag); \ | 167 | int err; \ |
166 | put_user((k)->c_oflag, &(u)->c_oflag); \ | 168 | err = put_user((k)->c_iflag, &(u)->c_iflag); \ |
167 | put_user((k)->c_cflag, &(u)->c_cflag); \ | 169 | err |= put_user((k)->c_oflag, &(u)->c_oflag); \ |
168 | put_user((k)->c_lflag, &(u)->c_lflag); \ | 170 | err |= put_user((k)->c_cflag, &(u)->c_cflag); \ |
169 | put_user((k)->c_line, &(u)->c_line); \ | 171 | err |= put_user((k)->c_lflag, &(u)->c_lflag); \ |
170 | copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \ | 172 | err |= put_user((k)->c_line, &(u)->c_line); \ |
173 | err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \ | ||
171 | if (!((k)->c_lflag & ICANON)) { \ | 174 | if (!((k)->c_lflag & ICANON)) { \ |
172 | put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ | 175 | err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ |
173 | put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ | 176 | err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ |
174 | } else { \ | 177 | } else { \ |
175 | put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ | 178 | err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ |
176 | put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ | 179 | err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ |
177 | } \ | 180 | } \ |
178 | 0; \ | 181 | err; \ |
179 | }) | 182 | }) |
180 | 183 | ||
181 | #endif /* __KERNEL__ */ | 184 | #endif /* __KERNEL__ */ |