[openbeosstorage] API Extensions

  • From: "Ingo Weinhold" <bonefish@xxxxxxxxxxxxxxx>
  • To: "Storage Kit" <openbeosstorage@xxxxxxxxxxxxx>
  • Date: Fri, 27 Dec 2002 19:02:48 CET (+0100)

Hi,

I reconsidered the partitioning matter and came to the conclusion, that 
the functionality should indeed be provided by the partition modules. 
The argument, that GUI code for asking the user for the required 
parameters wouldn't feel very happy in kernel modules, is of course 
still valid, and therefore it should go into userland add-ons. As a 
consequence the parameters must be passed to the kernel modules, and to 
do that, there has to be a way to identify a module from userland.

For the identification an identifier string and a version number should 
be sufficient. The partition modules would need to implement the 
following additional functions:

typedef bool (*partition_identify_module_hook)(const char *identifier, 
uint32 version);
typedef status_t (*partition_partition_hook)(int deviceFD, const struct 
session_info *session, void *parameters, size_t paramLen);

For FS initialization the FS modules would need similar functions:

typedef bool (*fs_identify_module_hook)(const char *identifier, uint32 
version);
typedef status_t (*fs_initialize_hook)(int deviceFD, const struct 
partition_info *partitionInfo, const char *volumeName, void *
parameters, size_t paramLen);

The respective disk_scanner functions:

typedef status_t (*disk_scanner_partition_hook)(int deviceFD, const 
struct session_info *session, const char *identifier, uint32 version, 
void *parameters, size_t paramLen);
typedef status_t (*disk_scanner_initialize_hook)(int deviceFD, const 
struct partition_info *partitionInfo, const char *identifier, uint32 
version, char *volumeName, void *parameters, size_t paramLen);

And the user functions:

status_t partition_session(int deviceFD, int32 sessionIndex, const char 
*identifier, uint32 version, void *parameters, size_t paramLen);
status_t initialize_partition(int deviceFD, int32 sessionIndex, int32 
partitionIndex, const char *identifier, uint32 version, char *
volumeName, void *parameters, size_t paramLen);

For the userland add-on API I have something like this in mind:

// partition add-ons
extern BDiskScannerPartitionAddOn *create_ds_partition_add_on();
// fs add-ons
extern BDiskScannerFSAddOn *create_ds_fs_add_on();

class BDiskScannerAddOn {
public:
        virtual ~DiskScannerAddOn();

        virtual const char *ShortName() = 0;
        virtual const char *LongName() = 0;
        virtual const char *Identifier() = 0;
        virtual uint32 Version() = 0;
};

class BDiskScannerPartitionAddOn : public BDiskScannerAddOn {
public:
        virtual BDiskScannerParameterEditor *CreateEditor(const 
session_info *sessionInfo) = 0;
};

class BDiskScannerFSAddOn : public BDiskScannerAddOn {
public:
        virtual BDiskScannerParameterEditor *CreateEditor(const 
partition_info *partitionInfo) = 0;
};

class BDiskScannerParameterEditor {
public:
        virtual ~BDiskScannerParameterEditor();

        virtual BView *View() = 0;
        virtual status_t GetParameters(void **parameters, size_t *paramLen) 
= 0;
};

How does that sound?

CU, Ingo



Other related posts: