aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 04:26:40 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:04 -0400
commit8e2d10e1e76d894ec73d66dd63b641ccf5f5fb67 (patch)
tree5ae54e7ecfd3b8fca96aa59890b0c0007c4fd242 /arch/um
parent89fe64766ab76b02c65a806b8b5a864652493bd6 (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')
-rw-r--r--arch/um/drivers/chan_user.c30
-rw-r--r--arch/um/include/os.h1
-rw-r--r--arch/um/os-Linux/file.c13
3 files changed, 15 insertions, 29 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
24void generic_close(int fd, void *unused) 24void generic_close(int fd, void *unused)
25{ 25{
26 os_close_file(fd); 26 close(fd);
27} 27}
28 28
29int generic_read(int fd, char *c_out, void *unused) 29int 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
44int generic_write(int fd, const char *buf, int n, void *unused) 45int 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
49int generic_window_size(int fd, void *unused, unsigned short *rows_out, 50int 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}
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 930b261ea483..bb6b7d9e1888 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -134,7 +134,6 @@ extern void os_print_error(int error, const char* str);
134extern int os_get_exec_close(int fd, int *close_on_exec); 134extern int os_get_exec_close(int fd, int *close_on_exec);
135extern int os_set_exec_close(int fd, int close_on_exec); 135extern int os_set_exec_close(int fd, int close_on_exec);
136extern int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg); 136extern int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg);
137extern int os_window_size(int fd, int *rows, int *cols);
138extern int os_new_tty_pgrp(int fd, int pid); 137extern int os_new_tty_pgrp(int fd, int pid);
139extern int os_get_ifname(int fd, char *namebuf); 138extern int os_get_ifname(int fd, char *namebuf);
140extern int os_set_slip(int fd); 139extern int os_set_slip(int fd);
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index c3ecc2a84e0c..f52006ee70e8 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -101,19 +101,6 @@ int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg)
101 return err; 101 return err;
102} 102}
103 103
104int os_window_size(int fd, int *rows, int *cols)
105{
106 struct winsize size;
107
108 if(ioctl(fd, TIOCGWINSZ, &size) < 0)
109 return -errno;
110
111 *rows = size.ws_row;
112 *cols = size.ws_col;
113
114 return 0;
115}
116
117int os_new_tty_pgrp(int fd, int pid) 104int os_new_tty_pgrp(int fd, int pid)
118{ 105{
119 if(ioctl(fd, TIOCSCTTY, 0) < 0) 106 if(ioctl(fd, TIOCSCTTY, 0) < 0)