diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-07-16 02:38:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:38 -0400 |
commit | d14ad81f800a57d3f21f8e98556c728968883e9a (patch) | |
tree | cbe17039283dd51654aaa5a9ac4fae9233285d96 /arch/um | |
parent | 75886f21e3a53a298b097103fd52e83184a89c22 (diff) |
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 | |||
189 | # CONFIG_NOCONFIG_CHAN is not set | 189 | # CONFIG_NOCONFIG_CHAN is not set |
190 | CONFIG_CON_ZERO_CHAN="fd:0,fd:1" | 190 | CONFIG_CON_ZERO_CHAN="fd:0,fd:1" |
191 | CONFIG_CON_CHAN="xterm" | 191 | CONFIG_CON_CHAN="xterm" |
192 | CONFIG_SSL_CHAN="pty" | 192 | CONFIG_SSL_CHAN="pts" |
193 | CONFIG_UNIX98_PTYS=y | 193 | CONFIG_UNIX98_PTYS=y |
194 | CONFIG_LEGACY_PTYS=y | 194 | CONFIG_LEGACY_PTYS=y |
195 | CONFIG_LEGACY_PTY_COUNT=256 | 195 | 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) | |||
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | void enable_chan(struct line *line) | 206 | int enable_chan(struct line *line) |
207 | { | 207 | { |
208 | struct list_head *ele; | 208 | struct list_head *ele; |
209 | struct chan *chan; | 209 | struct chan *chan; |
210 | int err; | ||
210 | 211 | ||
211 | list_for_each(ele, &line->chan_list){ | 212 | list_for_each(ele, &line->chan_list){ |
212 | chan = list_entry(ele, struct chan, list); | 213 | chan = list_entry(ele, struct chan, list); |
213 | if(open_one_chan(chan)) | 214 | err = open_one_chan(chan); |
215 | if (err) { | ||
216 | if (chan->primary) | ||
217 | goto out_close; | ||
218 | |||
214 | continue; | 219 | continue; |
220 | } | ||
215 | 221 | ||
216 | if(chan->enabled) | 222 | if(chan->enabled) |
217 | continue; | 223 | continue; |
218 | line_setup_irq(chan->fd, chan->input, chan->output, line, | 224 | err = line_setup_irq(chan->fd, chan->input, chan->output, line, |
219 | chan); | 225 | chan); |
226 | if (err) | ||
227 | goto out_close; | ||
228 | |||
220 | chan->enabled = 1; | 229 | chan->enabled = 1; |
221 | } | 230 | } |
231 | |||
232 | return 0; | ||
233 | |||
234 | out_close: | ||
235 | close_chan(&line->chan_list, 0); | ||
236 | return err; | ||
222 | } | 237 | } |
223 | 238 | ||
224 | /* Items are added in IRQ context, when free_irq can't be called, and | 239 | /* 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) | |||
454 | tty->driver_data = line; | 454 | tty->driver_data = line; |
455 | line->tty = tty; | 455 | line->tty = tty; |
456 | 456 | ||
457 | enable_chan(line); | 457 | err = enable_chan(line); |
458 | if (err) | ||
459 | return err; | ||
460 | |||
458 | INIT_DELAYED_WORK(&line->task, line_timer_cb); | 461 | INIT_DELAYED_WORK(&line->task, line_timer_cb); |
459 | 462 | ||
460 | if(!line->sigio){ | 463 | 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) | |||
97 | 97 | ||
98 | static int ssl_open(struct tty_struct *tty, struct file *filp) | 98 | static int ssl_open(struct tty_struct *tty, struct file *filp) |
99 | { | 99 | { |
100 | return line_open(serial_lines, tty); | 100 | int err = line_open(serial_lines, tty); |
101 | |||
102 | if (err) | ||
103 | printk(KERN_ERR "Failed to open serial line %d, err = %d\n", | ||
104 | tty->index, err); | ||
105 | |||
106 | return err; | ||
101 | } | 107 | } |
102 | 108 | ||
103 | #if 0 | 109 | #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) | |||
99 | 99 | ||
100 | static int con_open(struct tty_struct *tty, struct file *filp) | 100 | static int con_open(struct tty_struct *tty, struct file *filp) |
101 | { | 101 | { |
102 | return line_open(vts, tty); | 102 | int err = line_open(vts, tty); |
103 | if (err) | ||
104 | printk(KERN_ERR "Failed to open console %d, err = %d\n", | ||
105 | tty->index, err); | ||
106 | |||
107 | return err; | ||
103 | } | 108 | } |
104 | 109 | ||
105 | /* Set in an initcall, checked in an exitcall */ | 110 | /* 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); | |||
40 | extern void deactivate_chan(struct list_head *chans, int irq); | 40 | extern void deactivate_chan(struct list_head *chans, int irq); |
41 | extern void reactivate_chan(struct list_head *chans, int irq); | 41 | extern void reactivate_chan(struct list_head *chans, int irq); |
42 | extern void chan_enable_winch(struct list_head *chans, struct tty_struct *tty); | 42 | extern void chan_enable_winch(struct list_head *chans, struct tty_struct *tty); |
43 | extern void enable_chan(struct line *line); | 43 | extern int enable_chan(struct line *line); |
44 | extern void close_chan(struct list_head *chans, int delay_free_irq); | 44 | extern void close_chan(struct list_head *chans, int delay_free_irq); |
45 | extern int chan_window_size(struct list_head *chans, | 45 | extern int chan_window_size(struct list_head *chans, |
46 | unsigned short *rows_out, | 46 | unsigned short *rows_out, |