diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 01:26:40 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 09:43:04 -0700 |
commit | 8e2d10e1e76d894ec73d66dd63b641ccf5f5fb67 (patch) | |
tree | 5ae54e7ecfd3b8fca96aa59890b0c0007c4fd242 /arch/um/drivers | |
parent | 89fe64766ab76b02c65a806b8b5a864652493bd6 (diff) | |
download | linux-8e2d10e1e76d894ec73d66dd63b641ccf5f5fb67.tar.gz linux-8e2d10e1e76d894ec73d66dd63b641ccf5f5fb67.tar.bz2 linux-8e2d10e1e76d894ec73d66dd63b641ccf5f5fb67.zip |
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 @@ void generic_close(int fd, void *unused) { - os_close_file(fd); + close(fd); } int generic_read(int fd, char *c_out, void *unused) { int n; - n = os_read_file(fd, c_out, sizeof(*c_out)); - - if(n == -EAGAIN) + n = read(fd, c_out, sizeof(*c_out)); + if (n > 0) + return n; + else if (errno == EAGAIN) return 0; - else if(n == 0) + else if (n == 0) return -EIO; - return n; + return -errno; } -/* XXX Trivial wrapper around os_write_file */ +/* XXX Trivial wrapper around write */ int generic_write(int fd, const char *buf, int n, void *unused) { - return os_write_file(fd, buf, n); + return write(fd, buf, n); } int generic_window_size(int fd, void *unused, unsigned short *rows_out, unsigned short *cols_out) { - int rows, cols; + struct winsize size; int ret; - ret = os_window_size(fd, &rows, &cols); - if(ret < 0) - return ret; + if(ioctl(fd, TIOCGWINSZ, &size) < 0) + return -errno; - ret = ((*rows_out != rows) || (*cols_out != cols)); + ret = ((*rows_out != size.ws_row) || (*cols_out != size.ws_col)); - *rows_out = rows; - *cols_out = cols; + *rows_out = size.ws_row; + *cols_out = size.ws_col; return ret; } |