summaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/chan_user.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 01:26:39 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 09:43:04 -0700
commit89fe64766ab76b02c65a806b8b5a864652493bd6 (patch)
tree7da7c84014acded2d74c8d04a3eec57de2bc7622 /arch/um/drivers/chan_user.c
parent2090ab05fe4bc6b70e7245a9d3ea37afc49150ad (diff)
downloadop-kernel-dev-89fe64766ab76b02c65a806b8b5a864652493bd6.zip
op-kernel-dev-89fe64766ab76b02c65a806b8b5a864652493bd6.tar.gz
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 4d438f3..249c877 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -19,6 +19,55 @@
#include "os.h"
#include "choose-mode.h"
#include "mode.h"
+#include "um_malloc.h"
+
+void generic_close(int fd, void *unused)
+{
+ os_close_file(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)
+ return 0;
+ else if(n == 0)
+ return -EIO;
+ return n;
+}
+
+/* XXX Trivial wrapper around os_write_file */
+
+int generic_write(int fd, const char *buf, int n, void *unused)
+{
+ return os_write_file(fd, buf, n);
+}
+
+int generic_window_size(int fd, void *unused, unsigned short *rows_out,
+ unsigned short *cols_out)
+{
+ int rows, cols;
+ int ret;
+
+ ret = os_window_size(fd, &rows, &cols);
+ if(ret < 0)
+ return ret;
+
+ ret = ((*rows_out != rows) || (*cols_out != cols));
+
+ *rows_out = rows;
+ *cols_out = cols;
+
+ return ret;
+}
+
+void generic_free(void *data)
+{
+ kfree(data);
+}
int generic_console_write(int fd, const char *buf, int n)
{
OpenPOWER on IntegriCloud