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>
This commit is contained in:
Jeff Dike
2007-05-06 14:51:35 -07:00
committed by Linus Torvalds
parent ef0470c053
commit a61f334fd2
9 changed files with 71 additions and 57 deletions

View File

@ -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");