diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-05-06 21:51:35 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 19:13:03 (GMT) |
commit | a61f334fd2864b9b040f7e882726426ed7e8a317 (patch) | |
tree | 51874236a1f324a2664118f54aadd9ba3beb95ca /arch/um/os-Linux/drivers | |
parent | ef0470c053274c343b2be8737e0146d65e17f9be (diff) | |
download | linux-fsl-qoriq-a61f334fd2864b9b040f7e882726426ed7e8a317.tar.xz |
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.c | 11 |
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 fd6cfa5..acba301 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, change.what = op; memcpy(change.addr, addr, sizeof(change.addr)); memcpy(change.netmask, netmask, sizeof(change.netmask)); - n = os_write_file(fd, &change, sizeof(change)); + CATCH_EINTR(n = write(fd, &change, sizeof(change))); if(n != sizeof(change)){ - printk("etap_change - request failed, err = %d\n", -n); + printk("etap_change - request failed, err = %d\n", errno); return; } @@ -123,10 +123,11 @@ static int etap_tramp(char *dev, char *gate, int control_me, err = pid; os_close_file(data_remote); os_close_file(control_remote); - n = os_read_file(control_me, &c, sizeof(c)); + CATCH_EINTR(n = read(control_me, &c, sizeof(c))); if(n != sizeof(c)){ - printk("etap_tramp : read of status failed, err = %d\n", -n); - return -EINVAL; + err = -errno; + printk("etap_tramp : read of status failed, err = %d\n", -err); + return err; } if(c != 1){ printk("etap_tramp : uml_net failed\n"); |