aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tty_ioctl.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-12-08 05:38:47 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 11:28:57 -0500
commit64bb6c5e1ddcd47c951740485026ef08975ee2e6 (patch)
treea27f48dd4e9f123dcbc961e4660d55dae25b8e6b /drivers/char/tty_ioctl.c
parent606d099cdd1080bbb50ea50dc52d98252f8f10a1 (diff)
[PATCH] tty_ioctl: use termios for the old structure and termios2 for the new
Having split out the user and kernel structures it turns out that some non glibc C libraries pull their termios struct from the kernel headers directly or indirectly. This means we must keep "struct termios" as the library sees it correct for the old ioctls. Not a big problem just shuffle the names and ifdef around a bit [akpm@osdl.org: build fix] Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/tty_ioctl.c')
-rw-r--r--drivers/char/tty_ioctl.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 30486df9fd3f..dee47f40c6a3 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -399,23 +399,27 @@ static int set_termios(struct tty_struct * tty, void __user *arg, int opt)
399 if (retval) 399 if (retval)
400 return retval; 400 return retval;
401 401
402 memcpy(&tmp_termios, tty->termios, sizeof(struct ktermios));
403
402 if (opt & TERMIOS_TERMIO) { 404 if (opt & TERMIOS_TERMIO) {
403 memcpy(&tmp_termios, tty->termios, sizeof(struct ktermios));
404 if (user_termio_to_kernel_termios(&tmp_termios, 405 if (user_termio_to_kernel_termios(&tmp_termios,
405 (struct termio __user *)arg)) 406 (struct termio __user *)arg))
406 return -EFAULT; 407 return -EFAULT;
407#ifdef TCGETS2 408#ifdef TCGETS2
408 } else if (opt & TERMIOS_OLD) { 409 } else if (opt & TERMIOS_OLD) {
409 memcpy(&tmp_termios, tty->termios, sizeof(struct termios));
410 if (user_termios_to_kernel_termios_1(&tmp_termios, 410 if (user_termios_to_kernel_termios_1(&tmp_termios,
411 (struct termios_v1 __user *)arg)) 411 (struct termios __user *)arg))
412 return -EFAULT; 412 return -EFAULT;
413#endif
414 } else { 413 } else {
415 if (user_termios_to_kernel_termios(&tmp_termios, 414 if (user_termios_to_kernel_termios(&tmp_termios,
416 (struct termios __user *)arg)) 415 (struct termios2 __user *)arg))
417 return -EFAULT; 416 return -EFAULT;
418 } 417 }
418#else
419 } else if (user_termios_to_kernel_termios(&tmp_termios,
420 (struct termios __user *)arg))
421 return -EFAULT;
422#endif
419 423
420 /* If old style Bfoo values are used then load c_ispeed/c_ospeed with the real speed 424 /* If old style Bfoo values are used then load c_ispeed/c_ospeed with the real speed
421 so its unconditionally usable */ 425 so its unconditionally usable */
@@ -707,11 +711,11 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
707 return 0; 711 return 0;
708#else 712#else
709 case TCGETS: 713 case TCGETS:
710 if (kernel_termios_to_user_termios_1((struct termios_v1 __user *)arg, real_tty->termios)) 714 if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios))
711 return -EFAULT; 715 return -EFAULT;
712 return 0; 716 return 0;
713 case TCGETS2: 717 case TCGETS2:
714 if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios)) 718 if (kernel_termios_to_user_termios((struct termios2 __user *)arg, real_tty->termios))
715 return -EFAULT; 719 return -EFAULT;
716 return 0; 720 return 0;
717 case TCSETSF2: 721 case TCSETSF2: