[openbeosstorage] DiskDevice API v2.1

  • From: Tyler Dauwalder <tyler@xxxxxxxxxxxxx>
  • To: openbeosstorage@xxxxxxxxxxxxx
  • Date: Tue, 01 Apr 2003 00:49:05 -0800

Howdy,

I had the time, so here are some proposed changes for better 
partition management support. BPartitions would maintain lists of 
BEmptySpace objects, each of which represents the largest contiguous 
space between child BPartitions that could be filled with a new 
BPartition. 

The ValidateXYZ() functions would be used to bounds/error check 
modifications before actually solidifying said modification with the 
corresponding XYZ() function. The BDiskDevice::CommitUpdates() 
function would then actually perform the device's batched physical 
updates.

The BDiskSystem class provides info about supported child and parent 
systems for each disk system (i.e. intel extended would require an 
intel parent).

Only public interfaces are listed, and only modifications are listed 
for existing classes. 

Let me know what you think. :-)

-Tyler

class BEmptySpace {
public:
        off_t Offset() const;           
        off_t Size() const;
        int32 Index() const;            

        BPartition* Parent() const;

        bool CanCreatePartition() const;
        status_t ValidateCreatePartition(
                   off_t *start, 
                   off_t *size) const;
        BPartition* CreatePartition(off_t start, off_t size);
                // Partition creation this way would always create an
                // unformatted partition. Does this seem reasonable?
};

class BPartition {
public:
        BEmptySpace* EmptySpaceAt(int32 index) const;

// I have resize and move separated because move could be filesystem 
// independent, whereas resize could not

        bool CanResize() const;
        bool CanMove() const;
        status_t ValidateResize(off_t*) const;
        status_t ValidateMove(off_t*) const;
        status_t Resize(off_t);
        status_t Move(off_t);

        bool CanEditParameters() const;
        status_t GetParameterEditor(
           BDiskScannerParameterEditor **editor,
           BDiskScannerParameterEditor **parentEditor);

// Perhaps we should have something for checking a partition is
// large/small enough for initialization with a given system? The
// parameter editor could alternately check for this.

        bool CanInitialize() const;
        status_t GetInitializationParameterEditor(const char *system,       
               BDiskScannerParameterEditor **editor) const;
        status_t Initialize(const char *diskSystem,
                         const char *parameters);
        
        bool CanDelete() const;
        status_t Delete();
};

class BDiskDevice {
public:
        int32 CommitUpdates(BMessenger progressMessenger);
};

class BDiskSystem {
public:
        bool SupportsParentSystem(const char *system) const;
                // True in most cases. NULL == raw device.
        bool SupportsChildSystem(const char *system) const;
                // False for most file systems, true for most partitioning
                // systems.

        bool IsPartitioningSystem() const;
        bool IsFileSystem() const;
};


class BDiskSystemList {
public:
        // To be similar to BDiskDeviceList, offering updates as
        // systems are added and removed.
};

class BDiskDeviceRoster {
public:
        status_t GetDiskSystems(BDiskSystemList *list) const;
};


Other related posts: