diff options
Diffstat (limited to 'drivers/tty/tty_ioctl.c')
| -rw-r--r-- | drivers/tty/tty_ioctl.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index a1b9a2f68567..12b1fa0f4f86 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c | |||
| @@ -410,7 +410,7 @@ EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate); | |||
| 410 | 410 | ||
| 411 | void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud) | 411 | void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud) |
| 412 | { | 412 | { |
| 413 | tty_termios_encode_baud_rate(tty->termios, ibaud, obaud); | 413 | tty_termios_encode_baud_rate(&tty->termios, ibaud, obaud); |
| 414 | } | 414 | } |
| 415 | EXPORT_SYMBOL_GPL(tty_encode_baud_rate); | 415 | EXPORT_SYMBOL_GPL(tty_encode_baud_rate); |
| 416 | 416 | ||
| @@ -427,7 +427,7 @@ EXPORT_SYMBOL_GPL(tty_encode_baud_rate); | |||
| 427 | 427 | ||
| 428 | speed_t tty_get_baud_rate(struct tty_struct *tty) | 428 | speed_t tty_get_baud_rate(struct tty_struct *tty) |
| 429 | { | 429 | { |
| 430 | speed_t baud = tty_termios_baud_rate(tty->termios); | 430 | speed_t baud = tty_termios_baud_rate(&tty->termios); |
| 431 | 431 | ||
| 432 | if (baud == 38400 && tty->alt_speed) { | 432 | if (baud == 38400 && tty->alt_speed) { |
| 433 | if (!tty->warned) { | 433 | if (!tty->warned) { |
| @@ -509,14 +509,14 @@ int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios) | |||
| 509 | /* FIXME: we need to decide on some locking/ordering semantics | 509 | /* FIXME: we need to decide on some locking/ordering semantics |
| 510 | for the set_termios notification eventually */ | 510 | for the set_termios notification eventually */ |
| 511 | mutex_lock(&tty->termios_mutex); | 511 | mutex_lock(&tty->termios_mutex); |
| 512 | old_termios = *tty->termios; | 512 | old_termios = tty->termios; |
| 513 | *tty->termios = *new_termios; | 513 | tty->termios = *new_termios; |
| 514 | unset_locked_termios(tty->termios, &old_termios, tty->termios_locked); | 514 | unset_locked_termios(&tty->termios, &old_termios, &tty->termios_locked); |
| 515 | 515 | ||
| 516 | /* See if packet mode change of state. */ | 516 | /* See if packet mode change of state. */ |
| 517 | if (tty->link && tty->link->packet) { | 517 | if (tty->link && tty->link->packet) { |
| 518 | int extproc = (old_termios.c_lflag & EXTPROC) | | 518 | int extproc = (old_termios.c_lflag & EXTPROC) | |
| 519 | (tty->termios->c_lflag & EXTPROC); | 519 | (tty->termios.c_lflag & EXTPROC); |
| 520 | int old_flow = ((old_termios.c_iflag & IXON) && | 520 | int old_flow = ((old_termios.c_iflag & IXON) && |
| 521 | (old_termios.c_cc[VSTOP] == '\023') && | 521 | (old_termios.c_cc[VSTOP] == '\023') && |
| 522 | (old_termios.c_cc[VSTART] == '\021')); | 522 | (old_termios.c_cc[VSTART] == '\021')); |
| @@ -542,7 +542,7 @@ int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios) | |||
| 542 | if (tty->ops->set_termios) | 542 | if (tty->ops->set_termios) |
| 543 | (*tty->ops->set_termios)(tty, &old_termios); | 543 | (*tty->ops->set_termios)(tty, &old_termios); |
| 544 | else | 544 | else |
| 545 | tty_termios_copy_hw(tty->termios, &old_termios); | 545 | tty_termios_copy_hw(&tty->termios, &old_termios); |
| 546 | 546 | ||
| 547 | ld = tty_ldisc_ref(tty); | 547 | ld = tty_ldisc_ref(tty); |
| 548 | if (ld != NULL) { | 548 | if (ld != NULL) { |
| @@ -578,7 +578,7 @@ static int set_termios(struct tty_struct *tty, void __user *arg, int opt) | |||
| 578 | return retval; | 578 | return retval; |
| 579 | 579 | ||
| 580 | mutex_lock(&tty->termios_mutex); | 580 | mutex_lock(&tty->termios_mutex); |
| 581 | memcpy(&tmp_termios, tty->termios, sizeof(struct ktermios)); | 581 | tmp_termios = tty->termios; |
| 582 | mutex_unlock(&tty->termios_mutex); | 582 | mutex_unlock(&tty->termios_mutex); |
| 583 | 583 | ||
| 584 | if (opt & TERMIOS_TERMIO) { | 584 | if (opt & TERMIOS_TERMIO) { |
| @@ -632,14 +632,14 @@ static int set_termios(struct tty_struct *tty, void __user *arg, int opt) | |||
| 632 | static void copy_termios(struct tty_struct *tty, struct ktermios *kterm) | 632 | static void copy_termios(struct tty_struct *tty, struct ktermios *kterm) |
| 633 | { | 633 | { |
| 634 | mutex_lock(&tty->termios_mutex); | 634 | mutex_lock(&tty->termios_mutex); |
| 635 | memcpy(kterm, tty->termios, sizeof(struct ktermios)); | 635 | *kterm = tty->termios; |
| 636 | mutex_unlock(&tty->termios_mutex); | 636 | mutex_unlock(&tty->termios_mutex); |
| 637 | } | 637 | } |
| 638 | 638 | ||
| 639 | static void copy_termios_locked(struct tty_struct *tty, struct ktermios *kterm) | 639 | static void copy_termios_locked(struct tty_struct *tty, struct ktermios *kterm) |
| 640 | { | 640 | { |
| 641 | mutex_lock(&tty->termios_mutex); | 641 | mutex_lock(&tty->termios_mutex); |
| 642 | memcpy(kterm, tty->termios_locked, sizeof(struct ktermios)); | 642 | *kterm = tty->termios_locked; |
| 643 | mutex_unlock(&tty->termios_mutex); | 643 | mutex_unlock(&tty->termios_mutex); |
| 644 | } | 644 | } |
| 645 | 645 | ||
| @@ -707,16 +707,16 @@ static int get_sgflags(struct tty_struct *tty) | |||
| 707 | { | 707 | { |
| 708 | int flags = 0; | 708 | int flags = 0; |
| 709 | 709 | ||
| 710 | if (!(tty->termios->c_lflag & ICANON)) { | 710 | if (!(tty->termios.c_lflag & ICANON)) { |
| 711 | if (tty->termios->c_lflag & ISIG) | 711 | if (tty->termios.c_lflag & ISIG) |
| 712 | flags |= 0x02; /* cbreak */ | 712 | flags |= 0x02; /* cbreak */ |
| 713 | else | 713 | else |
| 714 | flags |= 0x20; /* raw */ | 714 | flags |= 0x20; /* raw */ |
| 715 | } | 715 | } |
| 716 | if (tty->termios->c_lflag & ECHO) | 716 | if (tty->termios.c_lflag & ECHO) |
| 717 | flags |= 0x08; /* echo */ | 717 | flags |= 0x08; /* echo */ |
| 718 | if (tty->termios->c_oflag & OPOST) | 718 | if (tty->termios.c_oflag & OPOST) |
| 719 | if (tty->termios->c_oflag & ONLCR) | 719 | if (tty->termios.c_oflag & ONLCR) |
| 720 | flags |= 0x10; /* crmod */ | 720 | flags |= 0x10; /* crmod */ |
| 721 | return flags; | 721 | return flags; |
| 722 | } | 722 | } |
| @@ -726,10 +726,10 @@ static int get_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb) | |||
| 726 | struct sgttyb tmp; | 726 | struct sgttyb tmp; |
| 727 | 727 | ||
| 728 | mutex_lock(&tty->termios_mutex); | 728 | mutex_lock(&tty->termios_mutex); |
| 729 | tmp.sg_ispeed = tty->termios->c_ispeed; | 729 | tmp.sg_ispeed = tty->termios.c_ispeed; |
| 730 | tmp.sg_ospeed = tty->termios->c_ospeed; | 730 | tmp.sg_ospeed = tty->termios.c_ospeed; |
| 731 | tmp.sg_erase = tty->termios->c_cc[VERASE]; | 731 | tmp.sg_erase = tty->termios.c_cc[VERASE]; |
| 732 | tmp.sg_kill = tty->termios->c_cc[VKILL]; | 732 | tmp.sg_kill = tty->termios.c_cc[VKILL]; |
| 733 | tmp.sg_flags = get_sgflags(tty); | 733 | tmp.sg_flags = get_sgflags(tty); |
| 734 | mutex_unlock(&tty->termios_mutex); | 734 | mutex_unlock(&tty->termios_mutex); |
| 735 | 735 | ||
| @@ -787,7 +787,7 @@ static int set_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb) | |||
| 787 | return -EFAULT; | 787 | return -EFAULT; |
| 788 | 788 | ||
| 789 | mutex_lock(&tty->termios_mutex); | 789 | mutex_lock(&tty->termios_mutex); |
| 790 | termios = *tty->termios; | 790 | termios = tty->termios; |
| 791 | termios.c_cc[VERASE] = tmp.sg_erase; | 791 | termios.c_cc[VERASE] = tmp.sg_erase; |
| 792 | termios.c_cc[VKILL] = tmp.sg_kill; | 792 | termios.c_cc[VKILL] = tmp.sg_kill; |
| 793 | set_sgflags(&termios, tmp.sg_flags); | 793 | set_sgflags(&termios, tmp.sg_flags); |
| @@ -808,12 +808,12 @@ static int get_tchars(struct tty_struct *tty, struct tchars __user *tchars) | |||
| 808 | struct tchars tmp; | 808 | struct tchars tmp; |
| 809 | 809 | ||
| 810 | mutex_lock(&tty->termios_mutex); | 810 | mutex_lock(&tty->termios_mutex); |
| 811 | tmp.t_intrc = tty->termios->c_cc[VINTR]; | 811 | tmp.t_intrc = tty->termios.c_cc[VINTR]; |
| 812 | tmp.t_quitc = tty->termios->c_cc[VQUIT]; | 812 | tmp.t_quitc = tty->termios.c_cc[VQUIT]; |
| 813 | tmp.t_startc = tty->termios->c_cc[VSTART]; | 813 | tmp.t_startc = tty->termios.c_cc[VSTART]; |
| 814 | tmp.t_stopc = tty->termios->c_cc[VSTOP]; | 814 | tmp.t_stopc = tty->termios.c_cc[VSTOP]; |
| 815 | tmp.t_eofc = tty->termios->c_cc[VEOF]; | 815 | tmp.t_eofc = tty->termios.c_cc[VEOF]; |
| 816 | tmp.t_brkc = tty->termios->c_cc[VEOL2]; /* what is brkc anyway? */ | 816 | tmp.t_brkc = tty->termios.c_cc[VEOL2]; /* what is brkc anyway? */ |
| 817 | mutex_unlock(&tty->termios_mutex); | 817 | mutex_unlock(&tty->termios_mutex); |
| 818 | return copy_to_user(tchars, &tmp, sizeof(tmp)) ? -EFAULT : 0; | 818 | return copy_to_user(tchars, &tmp, sizeof(tmp)) ? -EFAULT : 0; |
| 819 | } | 819 | } |
| @@ -825,12 +825,12 @@ static int set_tchars(struct tty_struct *tty, struct tchars __user *tchars) | |||
| 825 | if (copy_from_user(&tmp, tchars, sizeof(tmp))) | 825 | if (copy_from_user(&tmp, tchars, sizeof(tmp))) |
| 826 | return -EFAULT; | 826 | return -EFAULT; |
| 827 | mutex_lock(&tty->termios_mutex); | 827 | mutex_lock(&tty->termios_mutex); |
| 828 | tty->termios->c_cc[VINTR] = tmp.t_intrc; | 828 | tty->termios.c_cc[VINTR] = tmp.t_intrc; |
| 829 | tty->termios->c_cc[VQUIT] = tmp.t_quitc; | 829 | tty->termios.c_cc[VQUIT] = tmp.t_quitc; |
| 830 | tty->termios->c_cc[VSTART] = tmp.t_startc; | 830 | tty->termios.c_cc[VSTART] = tmp.t_startc; |
| 831 | tty->termios->c_cc[VSTOP] = tmp.t_stopc; | 831 | tty->termios.c_cc[VSTOP] = tmp.t_stopc; |
| 832 | tty->termios->c_cc[VEOF] = tmp.t_eofc; | 832 | tty->termios.c_cc[VEOF] = tmp.t_eofc; |
| 833 | tty->termios->c_cc[VEOL2] = tmp.t_brkc; /* what is brkc anyway? */ | 833 | tty->termios.c_cc[VEOL2] = tmp.t_brkc; /* what is brkc anyway? */ |
| 834 | mutex_unlock(&tty->termios_mutex); | 834 | mutex_unlock(&tty->termios_mutex); |
| 835 | return 0; | 835 | return 0; |
| 836 | } | 836 | } |
| @@ -842,14 +842,14 @@ static int get_ltchars(struct tty_struct *tty, struct ltchars __user *ltchars) | |||
| 842 | struct ltchars tmp; | 842 | struct ltchars tmp; |
| 843 | 843 | ||
| 844 | mutex_lock(&tty->termios_mutex); | 844 | mutex_lock(&tty->termios_mutex); |
| 845 | tmp.t_suspc = tty->termios->c_cc[VSUSP]; | 845 | tmp.t_suspc = tty->termios.c_cc[VSUSP]; |
| 846 | /* what is dsuspc anyway? */ | 846 | /* what is dsuspc anyway? */ |
| 847 | tmp.t_dsuspc = tty->termios->c_cc[VSUSP]; | 847 | tmp.t_dsuspc = tty->termios.c_cc[VSUSP]; |
| 848 | tmp.t_rprntc = tty->termios->c_cc[VREPRINT]; | 848 | tmp.t_rprntc = tty->termios.c_cc[VREPRINT]; |
| 849 | /* what is flushc anyway? */ | 849 | /* what is flushc anyway? */ |
| 850 | tmp.t_flushc = tty->termios->c_cc[VEOL2]; | 850 | tmp.t_flushc = tty->termios.c_cc[VEOL2]; |
| 851 | tmp.t_werasc = tty->termios->c_cc[VWERASE]; | 851 | tmp.t_werasc = tty->termios.c_cc[VWERASE]; |
| 852 | tmp.t_lnextc = tty->termios->c_cc[VLNEXT]; | 852 | tmp.t_lnextc = tty->termios.c_cc[VLNEXT]; |
| 853 | mutex_unlock(&tty->termios_mutex); | 853 | mutex_unlock(&tty->termios_mutex); |
| 854 | return copy_to_user(ltchars, &tmp, sizeof(tmp)) ? -EFAULT : 0; | 854 | return copy_to_user(ltchars, &tmp, sizeof(tmp)) ? -EFAULT : 0; |
| 855 | } | 855 | } |
| @@ -862,14 +862,14 @@ static int set_ltchars(struct tty_struct *tty, struct ltchars __user *ltchars) | |||
| 862 | return -EFAULT; | 862 | return -EFAULT; |
| 863 | 863 | ||
| 864 | mutex_lock(&tty->termios_mutex); | 864 | mutex_lock(&tty->termios_mutex); |
| 865 | tty->termios->c_cc[VSUSP] = tmp.t_suspc; | 865 | tty->termios.c_cc[VSUSP] = tmp.t_suspc; |
| 866 | /* what is dsuspc anyway? */ | 866 | /* what is dsuspc anyway? */ |
| 867 | tty->termios->c_cc[VEOL2] = tmp.t_dsuspc; | 867 | tty->termios.c_cc[VEOL2] = tmp.t_dsuspc; |
| 868 | tty->termios->c_cc[VREPRINT] = tmp.t_rprntc; | 868 | tty->termios.c_cc[VREPRINT] = tmp.t_rprntc; |
| 869 | /* what is flushc anyway? */ | 869 | /* what is flushc anyway? */ |
| 870 | tty->termios->c_cc[VEOL2] = tmp.t_flushc; | 870 | tty->termios.c_cc[VEOL2] = tmp.t_flushc; |
| 871 | tty->termios->c_cc[VWERASE] = tmp.t_werasc; | 871 | tty->termios.c_cc[VWERASE] = tmp.t_werasc; |
| 872 | tty->termios->c_cc[VLNEXT] = tmp.t_lnextc; | 872 | tty->termios.c_cc[VLNEXT] = tmp.t_lnextc; |
| 873 | mutex_unlock(&tty->termios_mutex); | 873 | mutex_unlock(&tty->termios_mutex); |
| 874 | return 0; | 874 | return 0; |
| 875 | } | 875 | } |
| @@ -920,12 +920,12 @@ static int tty_change_softcar(struct tty_struct *tty, int arg) | |||
| 920 | struct ktermios old; | 920 | struct ktermios old; |
| 921 | 921 | ||
| 922 | mutex_lock(&tty->termios_mutex); | 922 | mutex_lock(&tty->termios_mutex); |
| 923 | old = *tty->termios; | 923 | old = tty->termios; |
| 924 | tty->termios->c_cflag &= ~CLOCAL; | 924 | tty->termios.c_cflag &= ~CLOCAL; |
| 925 | tty->termios->c_cflag |= bit; | 925 | tty->termios.c_cflag |= bit; |
| 926 | if (tty->ops->set_termios) | 926 | if (tty->ops->set_termios) |
| 927 | tty->ops->set_termios(tty, &old); | 927 | tty->ops->set_termios(tty, &old); |
| 928 | if ((tty->termios->c_cflag & CLOCAL) != bit) | 928 | if ((tty->termios.c_cflag & CLOCAL) != bit) |
| 929 | ret = -EINVAL; | 929 | ret = -EINVAL; |
| 930 | mutex_unlock(&tty->termios_mutex); | 930 | mutex_unlock(&tty->termios_mutex); |
| 931 | return ret; | 931 | return ret; |
| @@ -1031,7 +1031,7 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file, | |||
| 1031 | (struct termios __user *) arg)) | 1031 | (struct termios __user *) arg)) |
| 1032 | return -EFAULT; | 1032 | return -EFAULT; |
| 1033 | mutex_lock(&real_tty->termios_mutex); | 1033 | mutex_lock(&real_tty->termios_mutex); |
| 1034 | memcpy(real_tty->termios_locked, &kterm, sizeof(struct ktermios)); | 1034 | real_tty->termios_locked = kterm; |
| 1035 | mutex_unlock(&real_tty->termios_mutex); | 1035 | mutex_unlock(&real_tty->termios_mutex); |
| 1036 | return 0; | 1036 | return 0; |
| 1037 | #else | 1037 | #else |
| @@ -1048,7 +1048,7 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file, | |||
| 1048 | (struct termios __user *) arg)) | 1048 | (struct termios __user *) arg)) |
| 1049 | return -EFAULT; | 1049 | return -EFAULT; |
| 1050 | mutex_lock(&real_tty->termios_mutex); | 1050 | mutex_lock(&real_tty->termios_mutex); |
| 1051 | memcpy(real_tty->termios_locked, &kterm, sizeof(struct ktermios)); | 1051 | real_tty->termios_locked = kterm; |
| 1052 | mutex_unlock(&real_tty->termios_mutex); | 1052 | mutex_unlock(&real_tty->termios_mutex); |
| 1053 | return ret; | 1053 | return ret; |
| 1054 | #endif | 1054 | #endif |
