[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20070723074331.GE21668@ftp.linux.org.uk>
Date: Mon, 23 Jul 2007 08:43:31 +0100
From: Al Viro <viro@....linux.org.uk>
To: Ulrich Drepper <drepper@...hat.com>
Cc: Linux Kernel <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
jdike@...aya.com
Subject: Re: Fix compiling UML
On Sun, Jul 22, 2007 at 10:52:13PM -0700, Ulrich Drepper wrote:
> .aio_buf = (unsigned long) buf,
> .aio_nbytes = len,
> .aio_offset = offset,
> + .aio_flags = 0,
> + .aio_resfd = 0,
> .aio_reserved1 = 0,
> - - .aio_reserved2 = 0,
> - - .aio_reserved3 = 0 });
> + .aio_reserved2 = 0 });
Huh? First of all, you have a corrupted tree. No lines that would
start with " -" in that area... As for the rest, I would argue that
leaving *any* of these fields in that compound literal is no wise, since
that's just asking for future trouble of the same kind.
FWIW, why do we need that iocb at all? That compound literal already
gives us a modifiable object of the right type, with exactly the same
lifetime...
IOW, how about the following?
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 *p = & (struct iocb) {
.aio_data = (unsigned long) aio,
.aio_fildes = fd,
.aio_buf = (unsigned long) buf,
.aio_nbytes = len,
.aio_offset = offset
};
char c;
switch (type) {
case AIO_READ:
p->aio_lio_opcode = IOCB_CMD_PREAD;
break;
case AIO_WRITE:
p->aio_lio_opcode = IOCB_CMD_PWRITE;
break;
case AIO_MMAP:
p->aio_lio_opcode = IOCB_CMD_PREAD;
p->aio_buf = (unsigned long) &c;
p->aio_nbytes = sizeof(c);
break;
default:
printk("Bogus op in do_aio - %d\n", type);
return -EINVAL;
}
return (io_submit(ctx, 1, &p) > 0) ? 0 : -errno;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists