Re: Disk Device API: Some semantical questions

Tyler Dauwalder <tyler-cyCl/[email protected]>
Newsgroups gmane.os.openbeos.storage
Message-ID <[email protected]>
> > On 2003-07-08 at 10:28:25 [-0700], Ingo Weinhold wrote:
> > [...determining BDiskDevice::IsReadOnly()...]
> > > Mmh, our
> > > DriveSetup would have no way of checking whether it can work on 
> > > the
> > > device (i.e. initialize partitions or the device itself) -- other
> > > than
> > > opening the device manually and do a B_GET_DEVICE_GEOMETRY ioctl,
> > > of
> > > course.
> > 
> > Couldn't it just try to open the device read-write?
> 
> I'm not sure, what the policy for opening devices is. E.g. a read-only
> device could allow to be opened for writing as well, but may fail 
> only,
> when one actually tries to write something to it. But anyway, the 
> point
> is, that you would have to use another API to get the information.

Gotcha.

> > On 2003-07-08 at 10:28:25 [-0700], Ingo Weinhold wrote:
> > > I would at least add a BDiskDevice::DeviceFlags() (we already
> > > have BPartition::Flags()), which would comprise this and other
> > > flags.
> > 
> > Which other flags?
> 
> Like whether the media is removable and/or write once.

Okay, my bad, I read that as BDiskSystem::Flags() for some reason. 
BDiskDevice::DeviceFlags() makes sense. :-)

> > On 2003-07-08 at 14:35:43 [-0700], Ingo Weinhold wrote:
> > > On Tue, 08 Jul 2003 22:31:07 +0200 CEST "Axel Dörfler" 
> > > <axeld@pinc-
> > > > BTW my question originally aimed at the "OR" part of the first
> > > > quoted
> > > > paragraph. If it's interesting for the user if the disk system
> > > > has
> > > > write capabilities or not, it should not be ORed with
> > > > IsReadOnlyMedia()
> > > > but be separately accessible.
> > > 
> > > Mmh, I guess, I find it more convenient, if
> > > BPartition::IsReadOnly()
> > > does the OR. The information the caller is interested in, is
> > > probably
> > > whether they can modify the partition's contents. The info whether
> > > the
> > > disk system in general does support writing or not is perhaps
> > > better
> > > provided via something like BDiskSystem::IsReadOnly().
> > 
> > That's why I suggested it 4 replies ago. :-) :-P
> 
> I have the vague memory of indeed having read something like this from
> you. :-)
> 
> > At any rate, I like
> > the OR-semantics for BPartition::ReadOnly() as well.
> 
> Cool. So I won't change it.

Sounds good.

> BTW, what kind of partitions does
> BDiskDeviceRoster::VisitEachInitializablePartition() visit, i.e. what
> is an initializable partition? Something like the device is not read-
> only and there exists a disk system for which the partition's
> CanInitialize() would return true? Sounds a bit complicated.

I think something more along the lines of "the device is not read-only 
and partition->Parent()->DiskSystem()->SupportsChildSystem() returns 
true for some available disk system and there exists an available disk 
system such that 
system->SupportsParentSystem(partition->Parent()->DiskSystem()) returns 
true", again pretending BPartition::DiskSystem() exists instead of 
BPartition::GetDiskSystem(). I guess the question is how useful it is. 
If we want to give a complete overview in DriveSetup of which partitions 
are initializable, we'll have to do something similar anyway. If we want 
to make the user check on a partition by partition basis if a given 
partition is initializable (i.e. by right-clicking and seeing if an 
"initialize" item is avaliable or something similar), then the 
Visit...() function may not be all that necessary. I kind of like the 
first ides better though.

-Tyler
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.