aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/chan_user.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 04:26:39 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:04 -0400
commit89fe64766ab76b02c65a806b8b5a864652493bd6 (patch)
tree7da7c84014acded2d74c8d04a3eec57de2bc7622 /arch/um/drivers/chan_user.c
parent2090ab05fe4bc6b70e7245a9d3ea37afc49150ad (diff)
uml: move userspace code to userspace file
Move some code from a kernelspace file to a userspace file where it fits better. This enables some tidying which is the subject of a later patch. 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/chan_user.c')
-rw-r--r--arch/um/drivers/chan_user.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 4d438f36ea2e..249c877410d7 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -19,6 +19,55 @@
19#include "os.h" 19#include "os.h"
20#include "choose-mode.h" 20#include "choose-mode.h"
21#include "mode.h" 21#include "mode.h"
22#include "um_malloc.h"
23
24void generic_close(int fd, void *unused)
25{
26 os_close_file(fd);
27}
28
29int generic_read(int fd, char *c_out, void *unused)
30{
31 int n;
32
33 n = os_read_file(fd, c_out, sizeof(*c_out));
34
35 if(n == -EAGAIN)
36 return 0;
37 else if(n == 0)
38 return -EIO;
39 return n;
40}
41
42/* XXX Trivial wrapper around os_write_file */
43
44int generic_write(int fd, const char *buf, int n, void *unused)
45{
46 return os_write_file(fd, buf, n);
47}
48
49int generic_window_size(int fd, void *unused, unsigned short *rows_out,
50 unsigned short *cols_out)
51{
52 int rows, cols;
53 int ret;
54
55 ret = os_window_size(fd, &rows, &cols);
56 if(ret < 0)
57 return ret;
58
59 ret = ((*rows_out != rows) || (*cols_out != cols));
60
61 *rows_out = rows;
62 *cols_out = cols;
63
64 return ret;
65}
66
67void generic_free(void *data)
68{
69 kfree(data);
70}
22 71
23int generic_console_write(int fd, const char *buf, int n) 72int generic_console_write(int fd, const char *buf, int n)
24{ 73{