From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KOYgo-0000zw-3a for qemu-devel@nongnu.org; Thu, 31 Jul 2008 09:59:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KOYgm-0000wZ-Ge for qemu-devel@nongnu.org; Thu, 31 Jul 2008 09:59:33 -0400 Received: from [199.232.76.173] (port=52202 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KOYgm-0000wU-9C for qemu-devel@nongnu.org; Thu, 31 Jul 2008 09:59:32 -0400 Received: from mx1.redhat.com ([66.187.233.31]:60143) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KOYgk-00038q-Pt for qemu-devel@nongnu.org; Thu, 31 Jul 2008 09:59:31 -0400 Date: Thu, 31 Jul 2008 14:55:12 +0100 From: "Daniel P. Berrange" Subject: Re: [Qemu-devel] PATCH: Control over drive open modes for backing file Message-ID: <20080731135512.GF18548@redhat.com> References: <20080731113120.GJ23888@redhat.com> <20080731133420.GD18548@redhat.com> <200807311446.56381.paul@codesourcery.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <200807311446.56381.paul@codesourcery.com> Content-Transfer-Encoding: quoted-printable Reply-To: "Daniel P. Berrange" , qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: qemu-devel@nongnu.org On Thu, Jul 31, 2008 at 02:46:55PM +0100, Paul Brook wrote: > > +#define BDRV_O_RDONLY =A0 =A0 =A00x0001 /* Force read-only */ > > +#define BDRV_O_WRONLY =A0 =A0 =A00x0002 /* Force writeable, no fallb= ack */ > > +#define BDRV_O_RDWR =A0 =A0 =A0 =A00x0003 /* Try writeable, fallback= to read-only > > */ >=20 > This is IMHO really misleading. Normal O_* are not bitflags. The code = uses=20 > these as bitflags sometimes, which means your descriptions are contradi= ctory. 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... Daniel --=20 |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange= / :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.or= g :| |: http://autobuild.org -o- http://search.cpan.org/~danberr= / :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 950= 5 :|