diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 04:26:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:04 -0400 |
commit | 8e2d10e1e76d894ec73d66dd63b641ccf5f5fb67 (patch) | |
tree | 5ae54e7ecfd3b8fca96aa59890b0c0007c4fd242 /arch/um/drivers | |
parent | 89fe64766ab76b02c65a806b8b5a864652493bd6 (diff) |
uml: tidy recently-moved code
Now that the generic console operations are in a userspace file, we
can do the following:
directly call into libc instead of through the os_* wrappers
eliminate os_window_size since it has only one user
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')
-rw-r--r-- | arch/um/drivers/chan_user.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c index 249c877410d7..40271afa3ee2 100644 --- a/arch/um/drivers/chan_user.c +++ b/arch/um/drivers/chan_user.c | |||
@@ -23,43 +23,43 @@ | |||
23 | 23 | ||
24 | void generic_close(int fd, void *unused) | 24 | void generic_close(int fd, void *unused) |
25 | { | 25 | { |
26 | os_close_file(fd); | 26 | close(fd); |
27 | } | 27 | } |
28 | 28 | ||
29 | int generic_read(int fd, char *c_out, void *unused) | 29 | int generic_read(int fd, char *c_out, void *unused) |
30 | { | 30 | { |
31 | int n; | 31 | int n; |
32 | 32 | ||
33 | n = os_read_file(fd, c_out, sizeof(*c_out)); | 33 | n = read(fd, c_out, sizeof(*c_out)); |
34 | 34 | if (n > 0) | |
35 | if(n == -EAGAIN) | 35 | return n; |
36 | else if (errno == EAGAIN) | ||
36 | return 0; | 37 | return 0; |
37 | else if(n == 0) | 38 | else if (n == 0) |
38 | return -EIO; | 39 | return -EIO; |
39 | return n; | 40 | return -errno; |
40 | } | 41 | } |
41 | 42 | ||
42 | /* XXX Trivial wrapper around os_write_file */ | 43 | /* XXX Trivial wrapper around write */ |
43 | 44 | ||
44 | int generic_write(int fd, const char *buf, int n, void *unused) | 45 | int generic_write(int fd, const char *buf, int n, void *unused) |
45 | { | 46 | { |
46 | return os_write_file(fd, buf, n); | 47 | return write(fd, buf, n); |
47 | } | 48 | } |
48 | 49 | ||
49 | int generic_window_size(int fd, void *unused, unsigned short *rows_out, | 50 | int generic_window_size(int fd, void *unused, unsigned short *rows_out, |
50 | unsigned short *cols_out) | 51 | unsigned short *cols_out) |
51 | { | 52 | { |
52 | int rows, cols; | 53 | struct winsize size; |
53 | int ret; | 54 | int ret; |
54 | 55 | ||
55 | ret = os_window_size(fd, &rows, &cols); | 56 | if(ioctl(fd, TIOCGWINSZ, &size) < 0) |
56 | if(ret < 0) | 57 | return -errno; |
57 | return ret; | ||
58 | 58 | ||
59 | ret = ((*rows_out != rows) || (*cols_out != cols)); | 59 | ret = ((*rows_out != size.ws_row) || (*cols_out != size.ws_col)); |
60 | 60 | ||
61 | *rows_out = rows; | 61 | *rows_out = size.ws_row; |
62 | *cols_out = cols; | 62 | *cols_out = size.ws_col; |
63 | 63 | ||
64 | return ret; | 64 | return ret; |
65 | } | 65 | } |