提交 e6885107 编写于 作者: A Alan Cox 提交者: Linus Torvalds

tty: move tioclinux from a special case

Right now we have ifdefs and hooks in the core ioctl handler for TIOCLINUX
and then test if its a console. This is brain dead. Instead call the
tioclinux helper from the relevant driver ioctl methods.
Signed-off-by: NAlan Cox <alan@redhat.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 b70ac771
...@@ -3026,10 +3026,6 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -3026,10 +3026,6 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return put_user(tty->ldisc.ops->num, (int __user *)p); return put_user(tty->ldisc.ops->num, (int __user *)p);
case TIOCSETD: case TIOCSETD:
return tiocsetd(tty, p); return tiocsetd(tty, p);
#ifdef CONFIG_VT
case TIOCLINUX:
return tioclinux(tty, arg);
#endif
/* /*
* Break handling * Break handling
*/ */
......
...@@ -2583,8 +2583,6 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) ...@@ -2583,8 +2583,6 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
int lines; int lines;
int ret; int ret;
if (tty->driver->type != TTY_DRIVER_TYPE_CONSOLE)
return -EINVAL;
if (current->signal->tty != tty && !capable(CAP_SYS_ADMIN)) if (current->signal->tty != tty && !capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (get_user(type, p)) if (get_user(type, p))
......
...@@ -395,6 +395,8 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -395,6 +395,8 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
kbd = kbd_table + console; kbd = kbd_table + console;
switch (cmd) { switch (cmd) {
case TIOCLINUX:
return tioclinux(tty, arg);
case KIOCSOUND: case KIOCSOUND:
if (!perm) if (!perm)
goto eperm; goto eperm;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册