aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/aio.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-05-06 17:51:33 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:13:03 -0400
commitef0470c053274c343b2be8737e0146d65e17f9be (patch)
tree68809a8af1da35e3bb3530a667eea080e086fae0 /arch/um/os-Linux/aio.c
parent3d564047a5f45cb628ec72514f68076e532988f3 (diff)
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>
Diffstat (limited to 'arch/um/os-Linux/aio.c')
-rw-r--r--arch/um/os-Linux/aio.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index 6ff12743a0bd..c1f0f76291cf 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -146,28 +146,21 @@ static int aio_thread(void *arg)
146static int do_not_aio(struct aio_thread_req *req) 146static int do_not_aio(struct aio_thread_req *req)
147{ 147{
148 char c; 148 char c;
149 unsigned long long actual;
149 int err; 150 int err;
150 151
152 actual = lseek64(req->io_fd, req->offset, SEEK_SET);
153 if(actual != req->offset)
154 return -errno;
155
151 switch(req->type){ 156 switch(req->type){
152 case AIO_READ: 157 case AIO_READ:
153 err = os_seek_file(req->io_fd, req->offset);
154 if(err)
155 goto out;
156
157 err = os_read_file(req->io_fd, req->buf, req->len); 158 err = os_read_file(req->io_fd, req->buf, req->len);
158 break; 159 break;
159 case AIO_WRITE: 160 case AIO_WRITE:
160 err = os_seek_file(req->io_fd, req->offset);
161 if(err)
162 goto out;
163
164 err = os_write_file(req->io_fd, req->buf, req->len); 161 err = os_write_file(req->io_fd, req->buf, req->len);
165 break; 162 break;
166 case AIO_MMAP: 163 case AIO_MMAP:
167 err = os_seek_file(req->io_fd, req->offset);
168 if(err)
169 goto out;
170
171 err = os_read_file(req->io_fd, &c, sizeof(c)); 164 err = os_read_file(req->io_fd, &c, sizeof(c));
172 break; 165 break;
173 default: 166 default:
@@ -176,7 +169,6 @@ static int do_not_aio(struct aio_thread_req *req)
176 break; 169 break;
177 } 170 }
178 171
179out:
180 return err; 172 return err;
181} 173}
182 174
@@ -207,7 +199,7 @@ static int not_aio_thread(void *arg)
207 } 199 }
208 err = do_not_aio(&req); 200 err = do_not_aio(&req);
209 reply = ((struct aio_thread_reply) { .data = req.aio, 201 reply = ((struct aio_thread_reply) { .data = req.aio,
210 .err = err }); 202 .err = err });
211 err = os_write_file(req.aio->reply_fd, &reply, sizeof(reply)); 203 err = os_write_file(req.aio->reply_fd, &reply, sizeof(reply));
212 if(err != sizeof(reply)) 204 if(err != sizeof(reply))
213 printk("not_aio_thread - write failed, fd = %d, " 205 printk("not_aio_thread - write failed, fd = %d, "