From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KOaaj-00046x-DV for qemu-devel@nongnu.org; Thu, 31 Jul 2008 12:01:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KOaaf-00044Q-Vq for qemu-devel@nongnu.org; Thu, 31 Jul 2008 12:01:24 -0400 Received: from [199.232.76.173] (port=42971 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KOaae-000447-V1 for qemu-devel@nongnu.org; Thu, 31 Jul 2008 12:01:21 -0400 Received: from mail2.shareable.org ([80.68.89.115]:48474) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KOaae-0002sc-Pu for qemu-devel@nongnu.org; Thu, 31 Jul 2008 12:01:20 -0400 Date: Thu, 31 Jul 2008 17:01:13 +0100 From: Jamie Lokier Subject: Re: [Qemu-devel] PATCH: Control over drive open modes for backing file Message-ID: <20080731160113.GA22997@shareable.org> References: <20080731113120.GJ23888@redhat.com> <20080731133420.GD18548@redhat.com> <200807311446.56381.paul@codesourcery.com> <20080731135512.GF18548@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paul Brook Blue Swirl wrote: > 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. You can't write to most formats unless you can read the metadata. Flat is the exception, but WRONLY doesn't seem particularly useful. Whereas read-only floppy images, for example, resemble real hardware. I would suggest: read-only, read-write, and try-write (traditional behaviour). Or maybe get rid of the last one. -- Jamie