Go to the FreeLists Home Page Home Signup Help Login
 



[openbeosstorage] || [Date Prev] [07-2003 Date Index] [Date Next] || [Thread Prev] [07-2003 Thread Index] [Thread Next]

[openbeosstorage] Re: Disk Device API: Some semantical questions

  • From: Tyler Dauwalder <tyler@xxxxxxxxxxxxx>
  • To: openbeosstorage@xxxxxxxxxxxxx
  • Date: Sat, 12 Jul 2003 12:44:55 -0700
On 2003-07-11 at 11:42:47 [-0700], Ingo Weinhold wrote:
> > > I wonder whether we cross the line of what should be provided by
> > > the
> > > API and what can be implemented in DriveSetup here. The method 
> > > will
> > > be
> > > relatively expensive if all these checks are done and DriveSetup
> > > will
> > > have to implement the functionality to get all disk systems a
> > > partition
> > > can be initialized with, anyway.
> > 
> > That's a good point. I would say we could probably do without the
> > "InitializablePartion" and "PartitionablePartition" versions. I 
> > think
> > the mounting related ones make sense, and the other three are
> > certainly
> > reasonable.
> 
> OK, then I'll remove the former ones.

Sounds good.

> > What is the "device" parameter to VisitEachDevice() for? Is it
> > intended
> > to actually be a BDiskDevice** output parameter, a la the partition
> > parameter for VisitEachPartition(), instead of BDiskDevice* as my
> > copy
> > is labeled?
> 
> No, it is a BDiskDevice* output parameter. You (can) supply a pointer
> to an uninitialized BDiskDevice and when the visitor requested to stop
> at a particular device, the supplied object is initialized to 
> represent
> this disk device.

Gotcha.

> > For VisitEachPartition(), the "device" parameter allows you
> > to specify a single device on which to visit all partitions, IIRC,
> > but
> > that doesn't make much sense for VisitEachDevice().
> 
> The BDiskDevice* parameter passed to the partition visiting methods is
> an output parameter as well. Since a BPartition object can only exist,
> if it belongs to a BDiskDevice, there must also be a BDiskDevice, if 
> we
> want to return a BPartition*. And that's the function of the device
> parameter; it is set to the device that contains the found partition.
> 
> If that is confusing, we can still change the visiting methods to just
> return a partition_id (all of them) instead of a bool and have no
> further parameters. Then the caller can get a device/partition object
> via Get{DiskDevice,Partition}WithID().

The only confusing part is that one is * and one is a **; that's what 
threw me off originally. Wouldn't using the partition_id be a bit more 
expensive, since you'd have to look up the appropriate partition again? 
Or are you hashing the ids? Regardless, I think the way it's set up 
currently is fine as long as it's properly documented, which it will 
be. :-)

-Tyler





[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.