From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MEmhp-0005I1-Dv for qemu-devel@nongnu.org; Thu, 11 Jun 2009 12:00:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MEmhk-0005Gq-EY for qemu-devel@nongnu.org; Thu, 11 Jun 2009 12:00:44 -0400 Received: from [199.232.76.173] (port=51976 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MEmhk-0005Gl-Bf for qemu-devel@nongnu.org; Thu, 11 Jun 2009 12:00:40 -0400 Received: from verein.lst.de ([213.95.11.210]:50201) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1MEmhj-0005TI-CQ for qemu-devel@nongnu.org; Thu, 11 Jun 2009 12:00:40 -0400 Date: Thu, 11 Jun 2009 18:00:30 +0200 From: Christoph Hellwig Subject: Re: [Qemu-devel] [PATCH 2/4] raw-posix: add a raw_open_common helper Message-ID: <20090611160030.GA3099@lst.de> References: <20090525075922.GB2936@lst.de> <20090609195449.GE19375@poweredge.glommer> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090609195449.GE19375@poweredge.glommer> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Glauber Costa Cc: Christoph Hellwig , qemu-devel@nongnu.org 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.