aboutsummaryrefslogtreecommitdiff
path: root/arch/um/os-Linux
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/os-Linux')
-rw-r--r--arch/um/os-Linux/file.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index 5e9b8dcf34d..6f92f732d25 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -290,52 +290,8 @@ int os_seek_file(int fd, __u64 offset)
return 0;
}
-static int fault_buffer(void *start, int len,
- int (*copy_proc)(void *addr, void *buf, int len))
-{
- int page = getpagesize(), i;
- char c;
-
- for(i = 0; i < len; i += page){
- if((*copy_proc)(start + i, &c, sizeof(c)))
- return -EFAULT;
- }
- if((len % page) != 0){
- if((*copy_proc)(start + len - 1, &c, sizeof(c)))
- return -EFAULT;
- }
- return 0;
-}
-
-static int file_io(int fd, void *buf, int len,
- int (*io_proc)(int fd, void *buf, int len),
- int (*copy_user_proc)(void *addr, void *buf, int len))
-{
- int n, err;
-
- do {
- n = (*io_proc)(fd, buf, len);
- if((n < 0) && (errno == EFAULT)){
- err = fault_buffer(buf, len, copy_user_proc);
- if(err)
- return err;
- n = (*io_proc)(fd, buf, len);
- }
- } while((n < 0) && (errno == EINTR));
-
- if(n < 0)
- return -errno;
- return n;
-}
-
int os_read_file(int fd, void *buf, int len)
{
- return file_io(fd, buf, len, (int (*)(int, void *, int)) read,
- copy_from_user_proc);
-}
-
-int os_read_file_k(int fd, void *buf, int len)
-{
int n = read(fd, buf, len);
if(n < 0)
@@ -345,12 +301,6 @@ int os_read_file_k(int fd, void *buf, int len)
int os_write_file(int fd, const void *buf, int len)
{
- return file_io(fd, (void *) buf, len,
- (int (*)(int, void *, int)) write, copy_to_user_proc);
-}
-
-int os_write_file_k(int fd, const void *buf, int len)
-{
int n = write(fd, (void *) buf, len);
if(n < 0)