diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 04:26:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:04 -0400 |
commit | e99525f9706900417f37721e601d2b414d41bfee (patch) | |
tree | fb407ea65a7c4c8bf457dd2ccab98842570cc62f /arch/um/drivers/xterm.c | |
parent | 79f662334fefa2dd3fdf66c44a4d2dca5e378ab4 (diff) |
uml: console subsystem tidying
This does a lot of cleanup on the UML console system. This patch should be
entirely non-functional.
The tidying is as follows:
header cleanups - the includes should be closer to minimal and complete
all printks now have a severity
lots of style fixes
fd_close is restructured a little in order to reduce the nesting
some functions were calling the os_* wrappers when they can
call libc directly
port_accept had a unnecessary variable
it also tested a pid unecessarily before killing it
some functions were made static
xterm_free is gone, as it was identical to generic_free
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/drivers/xterm.c')
-rw-r--r-- | arch/um/drivers/xterm.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c index fd817e541543..87e18bf2c667 100644 --- a/arch/um/drivers/xterm.c +++ b/arch/um/drivers/xterm.c | |||
@@ -3,18 +3,19 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stddef.h> | ||
6 | #include <stdlib.h> | 7 | #include <stdlib.h> |
7 | #include <stdio.h> | 8 | #include <stdio.h> |
8 | #include <unistd.h> | 9 | #include <unistd.h> |
9 | #include <string.h> | ||
10 | #include <errno.h> | 10 | #include <errno.h> |
11 | #include <string.h> | ||
11 | #include <termios.h> | 12 | #include <termios.h> |
12 | #include "chan_user.h" | 13 | #include "chan_user.h" |
14 | #include "kern_constants.h" | ||
13 | #include "os.h" | 15 | #include "os.h" |
14 | #include "init.h" | 16 | #include "um_malloc.h" |
15 | #include "user.h" | 17 | #include "user.h" |
16 | #include "xterm.h" | 18 | #include "xterm.h" |
17 | #include "kern_constants.h" | ||
18 | 19 | ||
19 | struct xterm_chan { | 20 | struct xterm_chan { |
20 | int pid; | 21 | int pid; |
@@ -29,7 +30,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts) | |||
29 | { | 30 | { |
30 | struct xterm_chan *data; | 31 | struct xterm_chan *data; |
31 | 32 | ||
32 | data = malloc(sizeof(*data)); | 33 | data = kmalloc(sizeof(*data), UM_GFP_KERNEL); |
33 | if (data == NULL) | 34 | if (data == NULL) |
34 | return NULL; | 35 | return NULL; |
35 | *data = ((struct xterm_chan) { .pid = -1, | 36 | *data = ((struct xterm_chan) { .pid = -1, |
@@ -207,11 +208,6 @@ static void xterm_close(int fd, void *d) | |||
207 | os_close_file(fd); | 208 | os_close_file(fd); |
208 | } | 209 | } |
209 | 210 | ||
210 | static void xterm_free(void *d) | ||
211 | { | ||
212 | free(d); | ||
213 | } | ||
214 | |||
215 | const struct chan_ops xterm_ops = { | 211 | const struct chan_ops xterm_ops = { |
216 | .type = "xterm", | 212 | .type = "xterm", |
217 | .init = xterm_init, | 213 | .init = xterm_init, |
@@ -221,6 +217,6 @@ const struct chan_ops xterm_ops = { | |||
221 | .write = generic_write, | 217 | .write = generic_write, |
222 | .console_write = generic_console_write, | 218 | .console_write = generic_console_write, |
223 | .window_size = generic_window_size, | 219 | .window_size = generic_window_size, |
224 | .free = xterm_free, | 220 | .free = generic_free, |
225 | .winch = 1, | 221 | .winch = 1, |
226 | }; | 222 | }; |