Go to the FreeLists Home Page Home Signup Help Login
 



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

[openbeosstorage] Re: DiskDevice API v2.1

  • From: "Ingo Weinhold" <bonefish@xxxxxxxxxxxxxxx>
  • To: openbeosstorage@xxxxxxxxxxxxx
  • Date: Sat, 05 Apr 2003 18:47:08 +0200 CEST
Tyler Dauwalder <tyler@xxxxxxxxxxxxx> wrote:
> 
> > > > Okay, that seemed to be a stupid idea :)
> > > > But we should make sure that the user can see which tasks still
> > > > have
> > > > to be carried out
> > > We could add methods to BDiskDeviceRoster to provide support for
> > > that.
> > > The typical iteration methods (GetNextActiveJob(BDiskDeviceJob*),
> > > RewindActiveJobs()) and watching support (StartWatchingJobs(),
> > > StopWatchingJobs()). BDiskDeviceJob (or better name=3D3D3F) would 
> > > feature
> > > methods for returning general information about the job, as well 
> > > as
> > > its
> > > current progress.
> > 
> > Sounds good.
> 
> I added:
> 
> // disk device job types
> enum {
>       B=5FDISK=5FDEVICE=5FJOB=5FCREATE,
>       B=5FDISK=5FDEVICE=5FJOB=5FDELETE,
>       B=5FDISK=5FDEVICE=5FJOB=5FINITIALIZE,
>       B=5FDISK=5FDEVICE=5FJOB=5FRESIZE,
>       B=5FDISK=5FDEVICE=5FJOB=5FMOVE,
>       B=5FDISK=5FDEVICE=5FJOB=5FDEFRAGMENT,
>       B=5FDISK=5FDEVICE=5FJOB=5FREPAIR,
> }
> 
> class BDiskDeviceJob {
> public:
>       int32 ID() const;
>       uint32 Type() const;    
>       uint8 Progress() const;         // 0 to 100

Maybe better float with range 0 - 1.0=3F That would be more compatible 
with BStatusBar and is also easier to calculate.

>       bool Finished() const;  
>       const char *Description() const;
>       
>       BPartition* Partition() const;
> private:
>       int32 fPartitionID;
>       int32 fJobID;
> };
> 
> // watchable events
> enum {
>       B=5FDEVICE=5FREQUEST=5FMOUNT=5FPOINT    =3D 0x01,       // mount point 
> changes
>       B=5FDEVICE=5FREQUEST=5FMOUNTING         =3D 0x02,       // 
> mounting/unmounting
>       B=5FDEVICE=5FREQUEST=5FPARTITION                =3D 0x04,       // 
> partition changes 
>       B=5FDEVICE=5FREQUEST=5FDEVICE                   =3D 0x10,       // 
> device changes (media 
> changes)
>       B=5FDEVICE=5FREQUEST=5FDEVICE=5FLIST    =3D 0x20,       // device 
> additions/
> removals
>       B=5FDEVICE=5FREQUEST=5FJOBS                     =3D 0x40, // job 
> addition/initiation/
> completion
>       B=5FDEVICE=5FREQUEST=5FALL                      =3D 0xff,       // all 
> events
> };
> 
> // notification message "event" field values
> enum {
>       B=5FDEVICE=5FMOUNT=5FPOINT=5FMOVED,                     // mount point 
> moved/renamed
>       B=5FDEVICE=5FPARTITION=5FMOUNTED,                       // partition 
> mounted
>       B=5FDEVICE=5FPARTITION=5FUNMOUNTED,             // partition unmounted
>       B=5FDEVICE=5FPARTITION=5FINITIALIZED,           // partition initialized
>       B=5FDEVICE=5FPARTITION=5FRESIZED,                       // partition 
> resized
>       B=5FDEVICE=5FPARTITION=5FMOVED,                 // partition moved
>       B=5FDEVICE=5FPARTITION=5FCREATED,                       // partition 
> created
>       B=5FDEVICE=5FPARTITION=5FDELETED,                       // partition 
> deleted
>       B=5FDEVICE=5FPARTITION=5FDEFRAGMENTED,  // partition defragmented
>       B=5FDEVICE=5FPARTITION=5FREPAIRED,              // partition repaired
>       B=5FDEVICE=5FMEDIA=5FCHANGED,                           // media changed
>       B=5FDEVICE=5FADDED,                                             // 
> device added
>       B=5FDEVICE=5FREMOVED,                                   // device 
> removed
>       B=5FDEVICE=5FJOB=5FADDED,                                       // job 
> added
>       B=5FDEVICE=5FJOB=5FINITIATED,                           // job initiated
>       B=5FDEVICE=5FJOB=5FFINISHED,                            // job finished
> };

        B=5FDEVICE=5FJOB=5FPROGRESS,                            // job progress

Good idea or not=3F Another event mask flag may be sensible to be added -
- though the disk=5Fdevice=5Fmanager should filter the progress 
notifications issued by the module anyway, so that not more than 10 or 
so per second are sent.

> 
> class BDiskDeviceRoster {
> public:
>       status=5Ft GetNextActiveJob(BDiskDeviceJob *job);
>       status=5Ft RewindActiveJobs();
> };
> 
> I added job watching in with the rest of the watching codes instead 
> of 
> adding a new set of functions for it (they also have their own 
> filter). 
> I also expanded B=5FDEVICE=5FPARTITION=5FCHANGED to be a specific code for 
> each type of change (initialize, resize, move, defrag, repair), since 
> we have specific functions for those everywhere else. And as you now 
> see, I added defragging and repairing to the API, too. So there are 
> also these additions:
> 
> class BPartition {
> public:
>       bool CanDefragment() const;
>       status=5Ft Defragment() const;
>       
>       bool CanRepair(bool checkOnly) const;
>       status=5Ft Repair(bool checkOnly) const;
> };
> 
> class BDiskSystem {
> public:
>       bool SupportsDefragmenting(BPartition *partition) const;
>       bool SupportsRepairing(BPartition *partition, bool checkOnly) 
> const;
> };
> 
> Sound okay=3F

I suppose `repair' means something like chkbfs=3F Parameters might be 
useful in this case, i.e. a parameter editor method could be added.

CU, Ingo






[ 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.