aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/drivers
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/drivers
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/drivers')
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index fd6cfa5b4a78..acba30161287 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -48,9 +48,9 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,
48 change.what = op; 48 change.what = op;
49 memcpy(change.addr, addr, sizeof(change.addr)); 49 memcpy(change.addr, addr, sizeof(change.addr));
50 memcpy(change.netmask, netmask, sizeof(change.netmask)); 50 memcpy(change.netmask, netmask, sizeof(change.netmask));
51 n = os_write_file(fd, &change, sizeof(change)); 51 CATCH_EINTR(n = write(fd, &change, sizeof(change)));
52 if(n != sizeof(change)){ 52 if(n != sizeof(change)){
53 printk("etap_change - request failed, err = %d\n", -n); 53 printk("etap_change - request failed, err = %d\n", errno);
54 return; 54 return;
55 } 55 }
56 56
@@ -123,10 +123,11 @@ static int etap_tramp(char *dev, char *gate, int control_me,
123 err = pid; 123 err = pid;
124 os_close_file(data_remote); 124 os_close_file(data_remote);
125 os_close_file(control_remote); 125 os_close_file(control_remote);
126 n = os_read_file(control_me, &c, sizeof(c)); 126 CATCH_EINTR(n = read(control_me, &c, sizeof(c)));
127 if(n != sizeof(c)){ 127 if(n != sizeof(c)){
128 printk("etap_tramp : read of status failed, err = %d\n", -n); 128 err = -errno;
129 return -EINVAL; 129 printk("etap_tramp : read of status failed, err = %d\n", -err);
130 return err;
130 } 131 }
131 if(c != 1){ 132 if(c != 1){
132 printk("etap_tramp : uml_net failed\n"); 133 printk("etap_tramp : uml_net failed\n");