lkml.org 
[lkml]   [2009]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] Remove pty_ops_bsd and pty_bsd_ioctl() as they're not used


On Mon, 28 Sep 2009, Alan Cox wrote:

> On Mon, 28 Sep 2009 14:53:32 +0100
> David Howells <dhowells@redhat.com> wrote:
> >
> > Possibly legacy_pty_init() should be passing this to tty_set_operations()
> > rather than pty_ops.
>
> It should indeed, otherwise the BSD pty locking ioctl fails.

Hmm. The pty_ops_bsd thing is missing the .install handler. And looking at
it, I'm not immediately seeing the difference between the pty_install
handler and the pty_unix98_install one. There's some differences in
termios initialization, and there is that

driver->other->ttys[idx] = o_tty;
driver->ttys[idx] = tty

thing, but it's not entirely clear to me why the legacy pty's don't use
the 'lookup()' logic instead (like the unix98 ones). Oh well.

Does anybody want to test this patch?

And is there any situation where this can be actually noticed? You
obviously need to have an old distro that actually uses the old static pty
setup.

Linus

---
drivers/char/pty.c | 24 ++++++------------------
1 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 53761ce..7f93ca2 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -261,6 +261,9 @@ done:
return 0;
}

+/* Traditional BSD devices */
+#ifdef CONFIG_LEGACY_PTYS
+
static int pty_install(struct tty_driver *driver, struct tty_struct *tty)
{
struct tty_struct *o_tty;
@@ -310,22 +313,6 @@ free_mem_out:
return -ENOMEM;
}

-
-static const struct tty_operations pty_ops = {
- .install = pty_install,
- .open = pty_open,
- .close = pty_close,
- .write = pty_write,
- .write_room = pty_write_room,
- .flush_buffer = pty_flush_buffer,
- .chars_in_buffer = pty_chars_in_buffer,
- .unthrottle = pty_unthrottle,
- .set_termios = pty_set_termios,
- .resize = pty_resize
-};
-
-/* Traditional BSD devices */
-#ifdef CONFIG_LEGACY_PTYS
static struct tty_driver *pty_driver, *pty_slave_driver;

static int pty_bsd_ioctl(struct tty_struct *tty, struct file *file,
@@ -342,6 +329,7 @@ static int legacy_count = CONFIG_LEGACY_PTY_COUNT;
module_param(legacy_count, int, 0);

static const struct tty_operations pty_ops_bsd = {
+ .install = pty_install,
.open = pty_open,
.close = pty_close,
.write = pty_write,
@@ -383,7 +371,7 @@ static void __init legacy_pty_init(void)
pty_driver->init_termios.c_ospeed = 38400;
pty_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW;
pty_driver->other = pty_slave_driver;
- tty_set_operations(pty_driver, &pty_ops);
+ tty_set_operations(pty_driver, &pty_ops_bsd);

pty_slave_driver->owner = THIS_MODULE;
pty_slave_driver->driver_name = "pty_slave";
@@ -399,7 +387,7 @@ static void __init legacy_pty_init(void)
pty_slave_driver->flags = TTY_DRIVER_RESET_TERMIOS |
TTY_DRIVER_REAL_RAW;
pty_slave_driver->other = pty_driver;
- tty_set_operations(pty_slave_driver, &pty_ops);
+ tty_set_operations(pty_slave_driver, &pty_ops_bsd);

if (tty_register_driver(pty_driver))
panic("Couldn't register pty driver");

\
 
 \ /
  Last update: 2009-10-18 23:28    [from the cache]
©2003-2011 Jasper Spaans