Commit 5f0f187f authored by Aleksa Sarai's avatar Aleksa Sarai Committed by Greg Kroah-Hartman

tty: add compat_ioctl callbacks

In order to avoid future diversions between fs/compat_ioctl.c and
drivers/tty/pty.c, define .compat_ioctl callbacks for the relevant
tty_operations structs. Since both pty_unix98_ioctl() and
pty_bsd_ioctl() are compatible between 32-bit and 64-bit userspace no
special translation is required.
Signed-off-by: default avatarAleksa Sarai <asarai@suse.de>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bea8be65
...@@ -481,6 +481,16 @@ static int pty_bsd_ioctl(struct tty_struct *tty, ...@@ -481,6 +481,16 @@ static int pty_bsd_ioctl(struct tty_struct *tty,
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
} }
static long pty_bsd_compat_ioctl(struct tty_struct *tty,
unsigned int cmd, unsigned long arg)
{
/*
* PTY ioctls don't require any special translation between 32-bit and
* 64-bit userspace, they are already compatible.
*/
return pty_bsd_ioctl(tty, cmd, arg);
}
static int legacy_count = CONFIG_LEGACY_PTY_COUNT; static int legacy_count = CONFIG_LEGACY_PTY_COUNT;
/* /*
* not really modular, but the easiest way to keep compat with existing * not really modular, but the easiest way to keep compat with existing
...@@ -502,6 +512,7 @@ static const struct tty_operations master_pty_ops_bsd = { ...@@ -502,6 +512,7 @@ static const struct tty_operations master_pty_ops_bsd = {
.chars_in_buffer = pty_chars_in_buffer, .chars_in_buffer = pty_chars_in_buffer,
.unthrottle = pty_unthrottle, .unthrottle = pty_unthrottle,
.ioctl = pty_bsd_ioctl, .ioctl = pty_bsd_ioctl,
.compat_ioctl = pty_bsd_compat_ioctl,
.cleanup = pty_cleanup, .cleanup = pty_cleanup,
.resize = pty_resize, .resize = pty_resize,
.remove = pty_remove .remove = pty_remove
...@@ -609,6 +620,16 @@ static int pty_unix98_ioctl(struct tty_struct *tty, ...@@ -609,6 +620,16 @@ static int pty_unix98_ioctl(struct tty_struct *tty,
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
} }
static long pty_unix98_compat_ioctl(struct tty_struct *tty,
unsigned int cmd, unsigned long arg)
{
/*
* PTY ioctls don't require any special translation between 32-bit and
* 64-bit userspace, they are already compatible.
*/
return pty_unix98_ioctl(tty, cmd, arg);
}
/** /**
* ptm_unix98_lookup - find a pty master * ptm_unix98_lookup - find a pty master
* @driver: ptm driver * @driver: ptm driver
...@@ -681,6 +702,7 @@ static const struct tty_operations ptm_unix98_ops = { ...@@ -681,6 +702,7 @@ static const struct tty_operations ptm_unix98_ops = {
.chars_in_buffer = pty_chars_in_buffer, .chars_in_buffer = pty_chars_in_buffer,
.unthrottle = pty_unthrottle, .unthrottle = pty_unthrottle,
.ioctl = pty_unix98_ioctl, .ioctl = pty_unix98_ioctl,
.compat_ioctl = pty_unix98_compat_ioctl,
.resize = pty_resize, .resize = pty_resize,
.cleanup = pty_cleanup .cleanup = pty_cleanup
}; };
......
...@@ -866,8 +866,6 @@ COMPATIBLE_IOCTL(TIOCGDEV) ...@@ -866,8 +866,6 @@ COMPATIBLE_IOCTL(TIOCGDEV)
COMPATIBLE_IOCTL(TIOCCBRK) COMPATIBLE_IOCTL(TIOCCBRK)
COMPATIBLE_IOCTL(TIOCGSID) COMPATIBLE_IOCTL(TIOCGSID)
COMPATIBLE_IOCTL(TIOCGICOUNT) COMPATIBLE_IOCTL(TIOCGICOUNT)
COMPATIBLE_IOCTL(TIOCGPKT)
COMPATIBLE_IOCTL(TIOCGPTLCK)
COMPATIBLE_IOCTL(TIOCGEXCL) COMPATIBLE_IOCTL(TIOCGEXCL)
/* Little t */ /* Little t */
COMPATIBLE_IOCTL(TIOCGETD) COMPATIBLE_IOCTL(TIOCGETD)
...@@ -883,16 +881,12 @@ COMPATIBLE_IOCTL(TIOCMGET) ...@@ -883,16 +881,12 @@ COMPATIBLE_IOCTL(TIOCMGET)
COMPATIBLE_IOCTL(TIOCMBIC) COMPATIBLE_IOCTL(TIOCMBIC)
COMPATIBLE_IOCTL(TIOCMBIS) COMPATIBLE_IOCTL(TIOCMBIS)
COMPATIBLE_IOCTL(TIOCMSET) COMPATIBLE_IOCTL(TIOCMSET)
COMPATIBLE_IOCTL(TIOCPKT)
COMPATIBLE_IOCTL(TIOCNOTTY) COMPATIBLE_IOCTL(TIOCNOTTY)
COMPATIBLE_IOCTL(TIOCSTI) COMPATIBLE_IOCTL(TIOCSTI)
COMPATIBLE_IOCTL(TIOCOUTQ) COMPATIBLE_IOCTL(TIOCOUTQ)
COMPATIBLE_IOCTL(TIOCSPGRP) COMPATIBLE_IOCTL(TIOCSPGRP)
COMPATIBLE_IOCTL(TIOCGPGRP) COMPATIBLE_IOCTL(TIOCGPGRP)
COMPATIBLE_IOCTL(TIOCGPTN)
COMPATIBLE_IOCTL(TIOCSPTLCK)
COMPATIBLE_IOCTL(TIOCSERGETLSR) COMPATIBLE_IOCTL(TIOCSERGETLSR)
COMPATIBLE_IOCTL(TIOCSIG)
#ifdef TIOCSRS485 #ifdef TIOCSRS485
COMPATIBLE_IOCTL(TIOCSRS485) COMPATIBLE_IOCTL(TIOCSRS485)
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment