[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/4] raw-posix: add a raw_open_common helper
From: |
Christoph Hellwig |
Subject: |
Re: [Qemu-devel] [PATCH 2/4] raw-posix: add a raw_open_common helper |
Date: |
Thu, 11 Jun 2009 18:00:30 +0200 |
User-agent: |
Mutt/1.3.28i |
On Tue, Jun 09, 2009 at 04:54:49PM -0300, Glauber Costa wrote:
> > -
> > + s->fd = -1;
> > fd = open(filename, s->open_flags, 0644);
> > if (fd < 0) {
> > ret = -errno;
> it is not equivalent to the current code, while you claim it is.
> this one will return EROFS to the external world, while old code
> would return EACCES. If there is any user relying on that return value,
> we're screwed. And as a matter of fact, it appears to be (bdrv_open2)
The code to turn -EROFS into -EACCES is also present in raw_open (and
thus the new raw_open_common), it just didn't make it into the visible
patch hunk.
> > - s->open_flags |= O_BINARY;
> > - if ((flags & BDRV_O_ACCESS) == O_RDWR) {
> > - s->open_flags |= O_RDWR;
> > - } else {
> > - s->open_flags |= O_RDONLY;
> > - bs->read_only = 1;
> > - }
> > - /* Use O_DSYNC for write-through caching, no flags for write-back
> > caching,
> > - * and O_DIRECT for no caching. */
> > - if ((flags & BDRV_O_NOCACHE))
> > - s->open_flags |= O_DIRECT;
> > - else if (!(flags & BDRV_O_CACHE_WB))
> > - s->open_flags |= O_DSYNC;
> >
> What happened to those flags? Are you just throwing them away?
raw_open_common deals with those, we just consolidated those to one
single site.