aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/skas/mem.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-05-06 17:51:35 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:13:03 -0400
commita61f334fd2864b9b040f7e882726426ed7e8a317 (patch)
tree51874236a1f324a2664118f54aadd9ba3beb95ca /arch/um/os-Linux/skas/mem.c
parentef0470c053274c343b2be8737e0146d65e17f9be (diff)
uml: convert libc layer to call read and write
This patch converts calls in the os layer to os_{read,write}_file to calls directly to libc read() and write() where it is clear that the I/O buffer is in the kernel. We can do that here instead of calling os_{read,write}_file_k since we are in libc code and can call libc directly. With the change in the calls, error handling needs to be changed to refer to errno directly rather than the return value of the call. CATCH_EINTR wrappers were also added where needed. 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/skas/mem.c')
-rw-r--r--arch/um/os-Linux/skas/mem.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index 470ec531aa5d..6cdfda807b65 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -6,6 +6,7 @@
6#include <signal.h> 6#include <signal.h>
7#include <errno.h> 7#include <errno.h>
8#include <string.h> 8#include <string.h>
9#include <unistd.h>
9#include <sys/mman.h> 10#include <sys/mman.h>
10#include <sys/wait.h> 11#include <sys/wait.h>
11#include <asm/page.h> 12#include <asm/page.h>
@@ -199,9 +200,11 @@ int map(struct mm_id * mm_idp, unsigned long virt, unsigned long len,
199 .fd = phys_fd, 200 .fd = phys_fd,
200 .offset= offset 201 .offset= offset
201 } } } ); 202 } } } );
202 ret = os_write_file(fd, &map, sizeof(map)); 203 CATCH_EINTR(ret = write(fd, &map, sizeof(map)));
203 if(ret != sizeof(map)) 204 if(ret != sizeof(map)){
205 ret = -errno;
204 printk("map : /proc/mm map failed, err = %d\n", -ret); 206 printk("map : /proc/mm map failed, err = %d\n", -ret);
207 }
205 else ret = 0; 208 else ret = 0;
206 } 209 }
207 else { 210 else {
@@ -231,9 +234,11 @@ int unmap(struct mm_id * mm_idp, void *addr, unsigned long len, int done,
231 { .addr = 234 { .addr =
232 (unsigned long) addr, 235 (unsigned long) addr,
233 .len = len } } } ); 236 .len = len } } } );
234 ret = os_write_file(fd, &unmap, sizeof(unmap)); 237 CATCH_EINTR(ret = write(fd, &unmap, sizeof(unmap)));
235 if(ret != sizeof(unmap)) 238 if(ret != sizeof(unmap)){
239 ret = -errno;
236 printk("unmap - proc_mm write returned %d\n", ret); 240 printk("unmap - proc_mm write returned %d\n", ret);
241 }
237 else ret = 0; 242 else ret = 0;
238 } 243 }
239 else { 244 else {
@@ -266,9 +271,11 @@ int protect(struct mm_id * mm_idp, unsigned long addr, unsigned long len,
266 .len = len, 271 .len = len,
267 .prot = prot } } } ); 272 .prot = prot } } } );
268 273
269 ret = os_write_file(fd, &protect, sizeof(protect)); 274 CATCH_EINTR(ret = write(fd, &protect, sizeof(protect)));
270 if(ret != sizeof(protect)) 275 if(ret != sizeof(protect)){
276 ret = -errno;
271 printk("protect failed, err = %d", -ret); 277 printk("protect failed, err = %d", -ret);
278 }
272 else ret = 0; 279 else ret = 0;
273 } 280 }
274 else { 281 else {