uml: tidy libc code

This patch lays some groundwork for the next one, which converts calls to
os_{read,write}_file into {read,write}, by doing some tidying in the affected
areas.

do_not_aio gets restructured to make the final result a bit cleaner.

There are also whitespace and other formatting fixes, fixes in error messages,
and a typo fix.

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:33 -07:00
committed by Linus Torvalds
parent 3d564047a5
commit ef0470c053
7 changed files with 47 additions and 46 deletions

View File

@ -146,28 +146,21 @@ static int aio_thread(void *arg)
static int do_not_aio(struct aio_thread_req *req)
{
char c;
unsigned long long actual;
int err;
actual = lseek64(req->io_fd, req->offset, SEEK_SET);
if(actual != req->offset)
return -errno;
switch(req->type){
case AIO_READ:
err = os_seek_file(req->io_fd, req->offset);
if(err)
goto out;
err = os_read_file(req->io_fd, req->buf, req->len);
break;
case AIO_WRITE:
err = os_seek_file(req->io_fd, req->offset);
if(err)
goto out;
err = os_write_file(req->io_fd, req->buf, req->len);
break;
case AIO_MMAP:
err = os_seek_file(req->io_fd, req->offset);
if(err)
goto out;
err = os_read_file(req->io_fd, &c, sizeof(c));
break;
default:
@ -176,7 +169,6 @@ static int do_not_aio(struct aio_thread_req *req)
break;
}
out:
return err;
}
@ -207,7 +199,7 @@ static int not_aio_thread(void *arg)
}
err = do_not_aio(&req);
reply = ((struct aio_thread_reply) { .data = req.aio,
.err = err });
.err = err });
err = os_write_file(req.aio->reply_fd, &reply, sizeof(reply));
if(err != sizeof(reply))
printk("not_aio_thread - write failed, fd = %d, "