[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] PATCH: Control over drive open modes for backing file
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-devel] PATCH: Control over drive open modes for backing file |
Date: |
Thu, 31 Jul 2008 17:10:36 +0100 |
User-agent: |
Mutt/1.4.1i |
On Thu, Jul 31, 2008 at 05:01:13PM +0100, Jamie Lokier wrote:
> Blue Swirl wrote:
> > On 7/31/08, Daniel P. Berrange <address@hidden> 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).
Functionally, that's what the implementation actually does - its just bad
flag naming that's confusing things here.
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Re: [Qemu-devel] PATCH: Control over drive open modes for backing file, Anthony Liguori, 2008/07/31