Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 166495
b: refs/heads/master
c: 342a597
h: refs/heads/master
i:
  166493: dbebbc2
  166491: 448e3df
  166487: fd9d876
  166479: f114356
  166463: cfad7fa
v: v3
  • Loading branch information
Linus Torvalds committed Sep 30, 2009
1 parent 392a46f commit 584c44b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e207e143e2fb6a2790b1ce3687c8aedc3ddc357b
refs/heads/master: 342a597146e8639f7c8d49f056340c2e5536dda6
47 changes: 26 additions & 21 deletions trunk/drivers/char/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ int pty_resize(struct tty_struct *tty, struct winsize *ws)
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;
Expand Down Expand Up @@ -310,24 +313,6 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty)
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,
unsigned int cmd, unsigned long arg)
{
Expand All @@ -341,7 +326,12 @@ static int pty_bsd_ioctl(struct tty_struct *tty, struct file *file,
static int legacy_count = CONFIG_LEGACY_PTY_COUNT;
module_param(legacy_count, int, 0);

static const struct tty_operations pty_ops_bsd = {
/*
* The master side of a pty can do TIOCSPTLCK and thus
* has pty_bsd_ioctl.
*/
static const struct tty_operations master_pty_ops_bsd = {
.install = pty_install,
.open = pty_open,
.close = pty_close,
.write = pty_write,
Expand All @@ -354,8 +344,23 @@ static const struct tty_operations pty_ops_bsd = {
.resize = pty_resize
};

static const struct tty_operations slave_pty_ops_bsd = {
.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
};

static void __init legacy_pty_init(void)
{
struct tty_driver *pty_driver, *pty_slave_driver;

if (legacy_count <= 0)
return;

Expand Down Expand Up @@ -383,7 +388,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, &master_pty_ops_bsd);

pty_slave_driver->owner = THIS_MODULE;
pty_slave_driver->driver_name = "pty_slave";
Expand All @@ -399,7 +404,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, &slave_pty_ops_bsd);

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

0 comments on commit 584c44b

Please sign in to comment.