public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	jdike@karaya.com
Subject: Re: Fix compiling UML
Date: Mon, 23 Jul 2007 08:43:31 +0100	[thread overview]
Message-ID: <20070723074331.GE21668@ftp.linux.org.uk> (raw)
In-Reply-To: <46A4420D.8070900@redhat.com>

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;
}

      reply	other threads:[~2007-07-23  7:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-23  5:52 Fix compiling UML Ulrich Drepper
2007-07-23  7:43 ` Al Viro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070723074331.GE21668@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=drepper@redhat.com \
    --cc=jdike@karaya.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox