On Mon, Feb 11, 2008 at 07:40:17PM -0500, lanas wrote:
> I'm afraid I'll ask a simplistic question but what is that commit ... ?

Below is the actual patch.

> > Or you could get a newer kernel, as this hit mainline last July.
> 
> I'm using Fedora 8 which is:
> 
> Linux f8-32 2.6.23.14-107.fc8 #1 SMP Mon Jan 14 21:37:30 EST 2008 i686 athlon 
> i386 GNU/Linux

I meant a newer UML kernel.

                                Jeff

commit da3e30e78ed9652322dccb49fa149e7b4e985f74
Author: Jeff Dike <[EMAIL PROTECTED]>
Date:   Mon Jul 23 18:43:47 2007 -0700

    uml: fix aio compilation bug
    
    Restructure do_aio thanks to commments from Ulrich and Al.
    
    Uli started this by seeing that UML's initialization of a struct iocb
    initialized fields that it shouldn't.
    
    Al followed up by adding the following cleanups:
        eliminating a variable by just using an anonymous structure in
    its place.
        hoisting a duplicated line out of the switch.
        simplifying the error checking at the end.
    
    I added a severity to the printk.
    
    Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
    Cc: Al Viro <[EMAIL PROTECTED]>
    Cc: Ulrich Drepper <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index b126df4..5934835 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -14,6 +14,7 @@
 #include "init.h"
 #include "user.h"
 #include "mode.h"
+#include "kern_constants.h"
 
 struct aio_thread_req {
        enum aio_type type;
@@ -65,47 +66,33 @@ static long io_getevents(aio_context_t ctx_id, long min_nr, 
long nr,
 static int do_aio(aio_context_t ctx, enum aio_type type, int fd, char *buf,
                  int len, unsigned long long offset, struct aio_context *aio)
 {
-       struct iocb iocb, *iocbp = &iocb;
+       struct iocb *iocbp = & ((struct iocb) {
+                                   .aio_data       = (unsigned long) aio,
+                                   .aio_fildes     = fd,
+                                   .aio_buf        = (unsigned long) buf,
+                                   .aio_nbytes     = len,
+                                   .aio_offset     = offset
+                            });
        char c;
-       int err;
 
-       iocb = ((struct iocb) { .aio_data       = (unsigned long) aio,
-                               .aio_reqprio    = 0,
-                               .aio_fildes     = fd,
-                               .aio_buf        = (unsigned long) buf,
-                               .aio_nbytes     = len,
-                               .aio_offset     = offset,
-                               .aio_reserved1  = 0,
-                               .aio_reserved2  = 0,
-                               .aio_reserved3  = 0 });
-
-       switch(type){
+       switch (type) {
        case AIO_READ:
-               iocb.aio_lio_opcode = IOCB_CMD_PREAD;
-               err = io_submit(ctx, 1, &iocbp);
+               iocbp->aio_lio_opcode = IOCB_CMD_PREAD;
                break;
        case AIO_WRITE:
-               iocb.aio_lio_opcode = IOCB_CMD_PWRITE;
-               err = io_submit(ctx, 1, &iocbp);
+               iocbp->aio_lio_opcode = IOCB_CMD_PWRITE;
                break;
        case AIO_MMAP:
-               iocb.aio_lio_opcode = IOCB_CMD_PREAD;
-               iocb.aio_buf = (unsigned long) &c;
-               iocb.aio_nbytes = sizeof(c);
-               err = io_submit(ctx, 1, &iocbp);
+               iocbp->aio_lio_opcode = IOCB_CMD_PREAD;
+               iocbp->aio_buf = (unsigned long) &c;
+               iocbp->aio_nbytes = sizeof(c);
                break;
        default:
-               printk("Bogus op in do_aio - %d\n", type);
-               err = -EINVAL;
-               break;
+               printk(UM_KERN_ERR "Bogus op in do_aio - %d\n", type);
+               return -EINVAL;
        }
 
-       if(err > 0)
-               err = 0;
-       else
-               err = -errno;
-
-       return err;
+       return (io_submit(ctx, 1, &iocbp) > 0) ? 0 : -errno;
 }
 
 /* Initialized in an initcall and unchanged thereafter */

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to