diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-05-06 17:51:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:13:03 -0400 |
commit | a6ea4cceed18edebe1eb6001cb9e0f88cd741a6c (patch) | |
tree | 4a747a92c9bd7a8703004603ee9e91f8bfb7e95a /arch/um/os-Linux/file.c | |
parent | a263672424e591067e42e1d8371e56927fe73af8 (diff) |
uml: rename os_{read_write}_file_k back to os_{read_write}_file
Rename os_{read_write}_file_k back to os_{read_write}_file, delete
the originals and their bogus infrastructure, and fix all the callers.
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/os-Linux/file.c')
-rw-r--r-- | arch/um/os-Linux/file.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index 5e9b8dcf34d4..6f92f732d253 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) | |||
290 | return 0; | 290 | return 0; |
291 | } | 291 | } |
292 | 292 | ||
293 | static int fault_buffer(void *start, int len, | ||
294 | int (*copy_proc)(void *addr, void *buf, int len)) | ||
295 | { | ||
296 | int page = getpagesize(), i; | ||
297 | char c; | ||
298 | |||
299 | for(i = 0; i < len; i += page){ | ||
300 | if((*copy_proc)(start + i, &c, sizeof(c))) | ||
301 | return -EFAULT; | ||
302 | } | ||
303 | if((len % page) != 0){ | ||
304 | if((*copy_proc)(start + len - 1, &c, sizeof(c))) | ||
305 | return -EFAULT; | ||
306 | } | ||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | static int file_io(int fd, void *buf, int len, | ||
311 | int (*io_proc)(int fd, void *buf, int len), | ||
312 | int (*copy_user_proc)(void *addr, void *buf, int len)) | ||
313 | { | ||
314 | int n, err; | ||
315 | |||
316 | do { | ||
317 | n = (*io_proc)(fd, buf, len); | ||
318 | if((n < 0) && (errno == EFAULT)){ | ||
319 | err = fault_buffer(buf, len, copy_user_proc); | ||
320 | if(err) | ||
321 | return err; | ||
322 | n = (*io_proc)(fd, buf, len); | ||
323 | } | ||
324 | } while((n < 0) && (errno == EINTR)); | ||
325 | |||
326 | if(n < 0) | ||
327 | return -errno; | ||
328 | return n; | ||
329 | } | ||
330 | |||
331 | int os_read_file(int fd, void *buf, int len) | 293 | int os_read_file(int fd, void *buf, int len) |
332 | { | 294 | { |
333 | return file_io(fd, buf, len, (int (*)(int, void *, int)) read, | ||
334 | copy_from_user_proc); | ||
335 | } | ||
336 | |||
337 | int os_read_file_k(int fd, void *buf, int len) | ||
338 | { | ||
339 | int n = read(fd, buf, len); | 295 | int n = read(fd, buf, len); |
340 | 296 | ||
341 | if(n < 0) | 297 | if(n < 0) |
@@ -345,12 +301,6 @@ int os_read_file_k(int fd, void *buf, int len) | |||
345 | 301 | ||
346 | int os_write_file(int fd, const void *buf, int len) | 302 | int os_write_file(int fd, const void *buf, int len) |
347 | { | 303 | { |
348 | return file_io(fd, (void *) buf, len, | ||
349 | (int (*)(int, void *, int)) write, copy_to_user_proc); | ||
350 | } | ||
351 | |||
352 | int os_write_file_k(int fd, const void *buf, int len) | ||
353 | { | ||
354 | int n = write(fd, (void *) buf, len); | 304 | int n = write(fd, (void *) buf, len); |
355 | 305 | ||
356 | if(n < 0) | 306 | if(n < 0) |