From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KOZiq-0002TX-DW for qemu-devel@nongnu.org; Thu, 31 Jul 2008 11:05:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KOZip-0002SB-KJ for qemu-devel@nongnu.org; Thu, 31 Jul 2008 11:05:43 -0400 Received: from [199.232.76.173] (port=53456 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KOZip-0002S4-7k for qemu-devel@nongnu.org; Thu, 31 Jul 2008 11:05:43 -0400 Received: from yw-out-1718.google.com ([74.125.46.153]:64005) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KOZip-00047g-80 for qemu-devel@nongnu.org; Thu, 31 Jul 2008 11:05:43 -0400 Received: by yw-out-1718.google.com with SMTP id 6so599659ywa.82 for ; Thu, 31 Jul 2008 08:05:42 -0700 (PDT) Message-ID: Date: Thu, 31 Jul 2008 18:05:41 +0300 From: "Blue Swirl" Subject: Re: [Qemu-devel] PATCH: Control over drive open modes for backing file In-Reply-To: <20080731135512.GF18548@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080731113120.GJ23888@redhat.com> <20080731133420.GD18548@redhat.com> <200807311446.56381.paul@codesourcery.com> <20080731135512.GF18548@redhat.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Paul Brook On 7/31/08, Daniel P. Berrange wrote: > On Thu, Jul 31, 2008 at 02:46:55PM +0100, Paul Brook wrote: > > > +#define BDRV_O_RDONLY 0x0001 /* Force read-only */ > > > +#define BDRV_O_WRONLY 0x0002 /* Force writeable, no fallback */ > > > +#define BDRV_O_RDWR 0x0003 /* Try writeable, fallback to read-only > > > */ > > > > This is IMHO really misleading. Normal O_* are not bitflags. The code uses > > these as bitflags sometimes, which means your descriptions are contradictory. > > > One alternative approach I considered would be to not have an explicit > flag for writable, and instead have a flag to explicitly indicate that > fallback to read-only shouldn't be attempted. > > > #define BDRV_O_RDONLY 0x0001 > > #define BDRV_O_NO_RO_FALLBACK 0x0002 > > This would probably make the patch smaller because I won't need to update > all the callers which assume flags of '0' gives a writable file, falling > back to RO. > > Other suggestions welcome too... Write-only should mean that only writing is allowed, read access should not be needed.