diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-07-16 08:38:54 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 18:05:38 +0200 |
commit | d14ad81f800a57d3f21f8e98556c728968883e9a (patch) | |
tree | cbe17039283dd51654aaa5a9ac4fae9233285d96 /arch/um | |
parent | uml: pty channel tidying (diff) | |
download | linux-d14ad81f800a57d3f21f8e98556c728968883e9a.tar.xz linux-d14ad81f800a57d3f21f8e98556c728968883e9a.zip |
uml: handle errors on opening host side of consoles
If the host side of a console can't be opened, this will now produce visible
error messages.
enable_chan now returns a status and this is passed up to con_open and
ssl_open, which will complain if anything went wrong.
The default host device for the serial line driver is now a pts device rather
than a pty device since lots of hosts have LEGACY_PTYS disabled. This had
always been failing on such hosts, but silently.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/defconfig | 2 | ||||
-rw-r--r-- | arch/um/drivers/chan_kern.c | 23 | ||||
-rw-r--r-- | arch/um/drivers/line.c | 5 | ||||
-rw-r--r-- | arch/um/drivers/ssl.c | 8 | ||||
-rw-r--r-- | arch/um/drivers/stdio_console.c | 7 | ||||
-rw-r--r-- | arch/um/include/chan_kern.h | 2 |
6 files changed, 38 insertions, 9 deletions
diff --git a/arch/um/defconfig b/arch/um/defconfig index e5b2df9e12de..a25cd25d55d4 100644 --- a/arch/um/defconfig +++ b/arch/um/defconfig @@ -189,7 +189,7 @@ CONFIG_XTERM_CHAN=y # CONFIG_NOCONFIG_CHAN is not set CONFIG_CON_ZERO_CHAN="fd:0,fd:1" CONFIG_CON_CHAN="xterm" -CONFIG_SSL_CHAN="pty" +CONFIG_SSL_CHAN="pts" CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index 3aa351611763..368d3e97dfd9 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c @@ -203,22 +203,37 @@ void chan_enable_winch(struct list_head *chans, struct tty_struct *tty) } } -void enable_chan(struct line *line) +int enable_chan(struct line *line) { struct list_head *ele; struct chan *chan; + int err; list_for_each(ele, &line->chan_list){ chan = list_entry(ele, struct chan, list); - if(open_one_chan(chan)) + err = open_one_chan(chan); + if (err) { + if (chan->primary) + goto out_close; + continue; + } if(chan->enabled) continue; - line_setup_irq(chan->fd, chan->input, chan->output, line, - chan); + err = line_setup_irq(chan->fd, chan->input, chan->output, line, + chan); + if (err) + goto out_close; + chan->enabled = 1; } + + return 0; + + out_close: + close_chan(&line->chan_list, 0); + return err; } /* Items are added in IRQ context, when free_irq can't be called, and diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 4bd40bb43ec2..1fb3e51108b9 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -454,7 +454,10 @@ int line_open(struct line *lines, struct tty_struct *tty) tty->driver_data = line; line->tty = tty; - enable_chan(line); + err = enable_chan(line); + if (err) + return err; + INIT_DELAYED_WORK(&line->task, line_timer_cb); if(!line->sigio){ diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c index b4ecf8db8f09..875d60d0c6a2 100644 --- a/arch/um/drivers/ssl.c +++ b/arch/um/drivers/ssl.c @@ -97,7 +97,13 @@ static int ssl_remove(int n, char **error_out) static int ssl_open(struct tty_struct *tty, struct file *filp) { - return line_open(serial_lines, tty); + int err = line_open(serial_lines, tty); + + if (err) + printk(KERN_ERR "Failed to open serial line %d, err = %d\n", + tty->index, err); + + return err; } #if 0 diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c index e312488a7a99..656036e90b19 100644 --- a/arch/um/drivers/stdio_console.c +++ b/arch/um/drivers/stdio_console.c @@ -99,7 +99,12 @@ static int con_remove(int n, char **error_out) static int con_open(struct tty_struct *tty, struct file *filp) { - return line_open(vts, tty); + int err = line_open(vts, tty); + if (err) + printk(KERN_ERR "Failed to open console %d, err = %d\n", + tty->index, err); + + return err; } /* Set in an initcall, checked in an exitcall */ diff --git a/arch/um/include/chan_kern.h b/arch/um/include/chan_kern.h index c4b41bb1035f..624b5100a3cd 100644 --- a/arch/um/include/chan_kern.h +++ b/arch/um/include/chan_kern.h @@ -40,7 +40,7 @@ extern int console_open_chan(struct line *line, struct console *co); extern void deactivate_chan(struct list_head *chans, int irq); extern void reactivate_chan(struct list_head *chans, int irq); extern void chan_enable_winch(struct list_head *chans, struct tty_struct *tty); -extern void enable_chan(struct line *line); +extern int enable_chan(struct line *line); extern void close_chan(struct list_head *chans, int delay_free_irq); extern int chan_window_size(struct list_head *chans, unsigned short *rows_out, |