DriveSetup:
- File system is now only displayed when the partition actually has a filesystem. - Now checks if the DiskSystem supports initializing. - Updated the *ParamsPanels, as well as, the Disk System add-ons to use the new storage api changes (see below). Storage Kit: - Simplified the parameters editor system. Now all parameter editor requests go through a single function, GetParameterEditor, and pass a B_PARAMETER_EDITOR_TYPE to request a particular parameter editor. - Moved DiskDeviceAddOnManager.h to the headers directory, as it is now required by InitParamsPanel. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39115 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -148,6 +148,13 @@ enum {
|
|||||||
B_DISK_DEVICE_JOB_CAN_PAUSE = 0x08,
|
B_DISK_DEVICE_JOB_CAN_PAUSE = 0x08,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum B_PARAMETER_EDITOR_TYPE {
|
||||||
|
B_CREATE_PARAMETER_EDITOR = 0x01,
|
||||||
|
B_INITIALIZE_PARAMETER_EDITOR = 0x04,
|
||||||
|
B_DELETE_PARAMETER_EDITOR = 0x08,
|
||||||
|
B_PROPERTIES_PARAMETER_EDITOR = 0x10
|
||||||
|
};
|
||||||
|
|
||||||
// string length constants, all of which include the NULL terminator
|
// string length constants, all of which include the NULL terminator
|
||||||
#define B_DISK_DEVICE_TYPE_LENGTH B_FILE_NAME_LENGTH
|
#define B_DISK_DEVICE_TYPE_LENGTH B_FILE_NAME_LENGTH
|
||||||
#define B_DISK_DEVICE_NAME_LENGTH B_FILE_NAME_LENGTH
|
#define B_DISK_DEVICE_NAME_LENGTH B_FILE_NAME_LENGTH
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#ifndef _DISK_SYSTEM_ADD_ON_H
|
#ifndef _DISK_SYSTEM_ADD_ON_H
|
||||||
#define _DISK_SYSTEM_ADD_ON_H
|
#define _DISK_SYSTEM_ADD_ON_H
|
||||||
|
|
||||||
|
#include <DiskDeviceDefs.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
@@ -31,9 +32,6 @@ public:
|
|||||||
|
|
||||||
virtual bool CanInitialize(
|
virtual bool CanInitialize(
|
||||||
const BMutablePartition* partition);
|
const BMutablePartition* partition);
|
||||||
virtual status_t GetInitializationParameterEditor(
|
|
||||||
const BMutablePartition* partition,
|
|
||||||
BPartitionParameterEditor** editor);
|
|
||||||
virtual status_t ValidateInitialize(
|
virtual status_t ValidateInitialize(
|
||||||
const BMutablePartition* partition,
|
const BMutablePartition* partition,
|
||||||
BString* name, const char* parameters);
|
BString* name, const char* parameters);
|
||||||
@@ -41,6 +39,9 @@ public:
|
|||||||
const char* name, const char* parameters,
|
const char* name, const char* parameters,
|
||||||
BPartitionHandle** handle);
|
BPartitionHandle** handle);
|
||||||
|
|
||||||
|
virtual status_t GetParameterEditor(
|
||||||
|
B_PARAMETER_EDITOR_TYPE type,
|
||||||
|
BPartitionParameterEditor** editor);
|
||||||
virtual status_t GetTypeForContentType(const char* contentType,
|
virtual status_t GetTypeForContentType(const char* contentType,
|
||||||
BString* type);
|
BString* type);
|
||||||
virtual bool IsSubSystemFor(const BMutablePartition* child);
|
virtual bool IsSubSystemFor(const BMutablePartition* child);
|
||||||
@@ -108,9 +109,7 @@ public:
|
|||||||
|
|
||||||
virtual status_t GetContentParameterEditor(
|
virtual status_t GetContentParameterEditor(
|
||||||
BPartitionParameterEditor** editor);
|
BPartitionParameterEditor** editor);
|
||||||
virtual status_t GetParameterEditor(
|
|
||||||
const BMutablePartition* child,
|
|
||||||
BPartitionParameterEditor** editor);
|
|
||||||
virtual status_t ValidateSetContentParameters(
|
virtual status_t ValidateSetContentParameters(
|
||||||
const char* parameters);
|
const char* parameters);
|
||||||
virtual status_t ValidateSetParameters(
|
virtual status_t ValidateSetParameters(
|
||||||
@@ -120,8 +119,8 @@ public:
|
|||||||
virtual status_t SetParameters(BMutablePartition* child,
|
virtual status_t SetParameters(BMutablePartition* child,
|
||||||
const char* parameters);
|
const char* parameters);
|
||||||
|
|
||||||
virtual status_t GetChildCreationParameterEditor(
|
virtual status_t GetParameterEditor(
|
||||||
const char* type,
|
B_PARAMETER_EDITOR_TYPE type,
|
||||||
BPartitionParameterEditor** editor);
|
BPartitionParameterEditor** editor);
|
||||||
virtual status_t ValidateCreateChild(off_t* offset,
|
virtual status_t ValidateCreateChild(off_t* offset,
|
||||||
off_t* size, const char* type,
|
off_t* size, const char* type,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Copyright 2003, Tyler Akidau, [email protected].
|
* Copyright 2003, Tyler Akidau, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _PARTITION_H
|
#ifndef _PARTITION_H
|
||||||
#define _PARTITION_H
|
#define _PARTITION_H
|
||||||
|
|
||||||
@@ -129,13 +130,12 @@ public:
|
|||||||
|
|
||||||
bool CanEditParameters() const;
|
bool CanEditParameters() const;
|
||||||
status_t GetParameterEditor(
|
status_t GetParameterEditor(
|
||||||
|
B_PARAMETER_EDITOR_TYPE type,
|
||||||
BPartitionParameterEditor** editor);
|
BPartitionParameterEditor** editor);
|
||||||
status_t SetParameters(const char* parameters);
|
status_t SetParameters(const char* parameters);
|
||||||
|
|
||||||
bool CanEditContentParameters(
|
bool CanEditContentParameters(
|
||||||
bool* whileMounted = NULL) const;
|
bool* whileMounted = NULL) const;
|
||||||
status_t GetContentParameterEditor(
|
|
||||||
BPartitionParameterEditor** editor);
|
|
||||||
status_t SetContentParameters(const char* parameters);
|
status_t SetContentParameters(const char* parameters);
|
||||||
|
|
||||||
status_t GetNextSupportedType(int32 *cookie,
|
status_t GetNextSupportedType(int32 *cookie,
|
||||||
@@ -151,9 +151,6 @@ public:
|
|||||||
bool IsSubSystem(const char* diskSystem) const;
|
bool IsSubSystem(const char* diskSystem) const;
|
||||||
|
|
||||||
bool CanInitialize(const char* diskSystem) const;
|
bool CanInitialize(const char* diskSystem) const;
|
||||||
status_t GetInitializationParameterEditor(
|
|
||||||
const char* system,
|
|
||||||
BPartitionParameterEditor** editor) const;
|
|
||||||
status_t ValidateInitialize(const char* diskSystem,
|
status_t ValidateInitialize(const char* diskSystem,
|
||||||
BString* name, const char* parameters);
|
BString* name, const char* parameters);
|
||||||
status_t Initialize(const char* diskSystem,
|
status_t Initialize(const char* diskSystem,
|
||||||
@@ -163,9 +160,6 @@ public:
|
|||||||
// Modification of child partitions
|
// Modification of child partitions
|
||||||
|
|
||||||
bool CanCreateChild() const;
|
bool CanCreateChild() const;
|
||||||
status_t GetChildCreationParameterEditor(
|
|
||||||
const char* type,
|
|
||||||
BPartitionParameterEditor** editor) const;
|
|
||||||
status_t ValidateCreateChild(off_t* start, off_t* size,
|
status_t ValidateCreateChild(off_t* start, off_t* size,
|
||||||
const char* type, BString* name,
|
const char* type, BString* name,
|
||||||
const char* parameters) const;
|
const char* parameters) const;
|
||||||
|
|||||||
@@ -95,21 +95,6 @@ BFSAddOn::CanInitialize(const BMutablePartition* partition)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BFSAddOn::GetInitializationParameterEditor(const BMutablePartition* partition,
|
|
||||||
BPartitionParameterEditor** editor)
|
|
||||||
{
|
|
||||||
*editor = NULL;
|
|
||||||
|
|
||||||
try {
|
|
||||||
*editor = new InitializeBFSEditor();
|
|
||||||
} catch (std::bad_alloc) {
|
|
||||||
return B_NO_MEMORY;
|
|
||||||
}
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BFSAddOn::ValidateInitialize(const BMutablePartition* partition, BString* name,
|
BFSAddOn::ValidateInitialize(const BMutablePartition* partition, BString* name,
|
||||||
const char* parameterString)
|
const char* parameterString)
|
||||||
@@ -173,6 +158,23 @@ BFSAddOn::Initialize(BMutablePartition* partition, const char* name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BFSAddOn::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
|
||||||
|
BPartitionParameterEditor** editor)
|
||||||
|
{
|
||||||
|
*editor = NULL;
|
||||||
|
if (type == B_INITIALIZE_PARAMETER_EDITOR) {
|
||||||
|
try {
|
||||||
|
*editor = new InitializeBFSEditor();
|
||||||
|
} catch (std::bad_alloc) {
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
}
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
return B_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - BFSPartitionHandle
|
// #pragma mark - BFSPartitionHandle
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ public:
|
|||||||
virtual status_t CreatePartitionHandle(
|
virtual status_t CreatePartitionHandle(
|
||||||
BMutablePartition* partition,
|
BMutablePartition* partition,
|
||||||
BPartitionHandle** handle);
|
BPartitionHandle** handle);
|
||||||
|
virtual status_t GetParameterEditor(
|
||||||
|
B_PARAMETER_EDITOR_TYPE type,
|
||||||
|
BPartitionParameterEditor** editor);
|
||||||
|
|
||||||
virtual bool CanInitialize(
|
virtual bool CanInitialize(
|
||||||
const BMutablePartition* partition);
|
const BMutablePartition* partition);
|
||||||
virtual status_t GetInitializationParameterEditor(
|
|
||||||
const BMutablePartition* partition,
|
|
||||||
BPartitionParameterEditor** editor);
|
|
||||||
virtual status_t ValidateInitialize(
|
virtual status_t ValidateInitialize(
|
||||||
const BMutablePartition* partition,
|
const BMutablePartition* partition,
|
||||||
BString* name, const char* parameters);
|
BString* name, const char* parameters);
|
||||||
|
|||||||
@@ -97,16 +97,6 @@ ExtendedPartitionAddOn::CanInitialize(const BMutablePartition* partition)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
ExtendedPartitionAddOn::GetInitializationParameterEditor(
|
|
||||||
const BMutablePartition* partition, BPartitionParameterEditor** editor)
|
|
||||||
{
|
|
||||||
// Nothing to edit, really.
|
|
||||||
*editor = NULL;
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ExtendedPartitionAddOn::ValidateInitialize(const BMutablePartition* partition,
|
ExtendedPartitionAddOn::ValidateInitialize(const BMutablePartition* partition,
|
||||||
BString* name, const char* parameters)
|
BString* name, const char* parameters)
|
||||||
@@ -317,11 +307,11 @@ ExtendedPartitionHandle::GetPartitioningInfo(BPartitioningInfo* info)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ExtendedPartitionHandle::GetChildCreationParameterEditor(const char* type,
|
ExtendedPartitionHandle::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
|
||||||
BPartitionParameterEditor** editor)
|
BPartitionParameterEditor** editor)
|
||||||
{
|
{
|
||||||
*editor = NULL;
|
*editor = NULL;
|
||||||
return B_OK;
|
return B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ public:
|
|||||||
|
|
||||||
virtual bool CanInitialize(
|
virtual bool CanInitialize(
|
||||||
const BMutablePartition* partition);
|
const BMutablePartition* partition);
|
||||||
virtual status_t GetInitializationParameterEditor(
|
|
||||||
const BMutablePartition* partition,
|
|
||||||
BPartitionParameterEditor** editor);
|
|
||||||
virtual status_t ValidateInitialize(
|
virtual status_t ValidateInitialize(
|
||||||
const BMutablePartition* partition,
|
const BMutablePartition* partition,
|
||||||
BString* name, const char* parameters);
|
BString* name, const char* parameters);
|
||||||
@@ -52,8 +49,8 @@ public:
|
|||||||
|
|
||||||
virtual status_t GetPartitioningInfo(BPartitioningInfo* info);
|
virtual status_t GetPartitioningInfo(BPartitioningInfo* info);
|
||||||
|
|
||||||
virtual status_t GetChildCreationParameterEditor(
|
virtual status_t GetParameterEditor(
|
||||||
const char* type,
|
B_PARAMETER_EDITOR_TYPE type,
|
||||||
BPartitionParameterEditor** editor);
|
BPartitionParameterEditor** editor);
|
||||||
virtual status_t ValidateCreateChild(off_t* offset,
|
virtual status_t ValidateCreateChild(off_t* offset,
|
||||||
off_t* size, const char* type,
|
off_t* size, const char* type,
|
||||||
|
|||||||
@@ -302,17 +302,19 @@ PartitionMapHandle::GetPartitioningInfo(BPartitioningInfo* info)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
PartitionMapHandle::GetChildCreationParameterEditor(const char* type,
|
PartitionMapHandle::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
|
||||||
BPartitionParameterEditor** editor)
|
BPartitionParameterEditor** editor)
|
||||||
{
|
{
|
||||||
*editor = NULL;
|
*editor = NULL;
|
||||||
|
if (type == B_CREATE_PARAMETER_EDITOR) {
|
||||||
try {
|
try {
|
||||||
*editor = new PrimaryPartitionEditor();
|
*editor = new PrimaryPartitionEditor();
|
||||||
} catch (std::bad_alloc) {
|
} catch (std::bad_alloc) {
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
}
|
||||||
|
return B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ public:
|
|||||||
|
|
||||||
virtual status_t GetPartitioningInfo(BPartitioningInfo* info);
|
virtual status_t GetPartitioningInfo(BPartitioningInfo* info);
|
||||||
|
|
||||||
virtual status_t GetChildCreationParameterEditor(
|
virtual status_t GetParameterEditor(
|
||||||
const char* type,
|
B_PARAMETER_EDITOR_TYPE type,
|
||||||
BPartitionParameterEditor** editor);
|
BPartitionParameterEditor** editor);
|
||||||
virtual status_t ValidateCreateChild(off_t* offset,
|
virtual status_t ValidateCreateChild(off_t* offset,
|
||||||
off_t* size, const char* type,
|
off_t* size, const char* type,
|
||||||
|
|||||||
@@ -265,9 +265,11 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset,
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
parent->GetChildCreationParameterEditor(NULL, &fEditor);
|
status_t err = parent->GetParameterEditor(B_CREATE_PARAMETER_EDITOR, &fEditor);
|
||||||
if (fEditor)
|
if (err == B_OK && fEditor != NULL)
|
||||||
AddChild(fEditor->View());
|
AddChild(fEditor->View());
|
||||||
|
else
|
||||||
|
fEditor = NULL;
|
||||||
|
|
||||||
BButton* okButton = new BButton(B_TRANSLATE("Create"),
|
BButton* okButton = new BButton(B_TRANSLATE("Create"),
|
||||||
new BMessage(MSG_OK));
|
new BMessage(MSG_OK));
|
||||||
@@ -281,3 +283,4 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset,
|
|||||||
AddToSubset(fWindow);
|
AddToSubset(fWindow);
|
||||||
layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
|
#include <DiskSystemAddOn.h>
|
||||||
|
#include <DiskSystemAddOnManager.h>
|
||||||
#include <GroupLayout.h>
|
#include <GroupLayout.h>
|
||||||
#include <GroupLayoutBuilder.h>
|
#include <GroupLayoutBuilder.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
@@ -96,9 +98,21 @@ InitParamsPanel::InitParamsPanel(BWindow* window, const BString& diskSystem,
|
|||||||
|
|
||||||
fOkButton = new BButton(B_TRANSLATE("Initialize"), new BMessage(MSG_OK));
|
fOkButton = new BButton(B_TRANSLATE("Initialize"), new BMessage(MSG_OK));
|
||||||
|
|
||||||
partition->GetInitializationParameterEditor(diskSystem.String(),
|
DiskSystemAddOnManager* manager = DiskSystemAddOnManager::Default();
|
||||||
&fEditor);
|
BDiskSystemAddOn* addOn = manager->GetAddOn(diskSystem);
|
||||||
|
if (addOn) {
|
||||||
|
// put the add-on
|
||||||
|
manager->PutAddOn(addOn);
|
||||||
|
|
||||||
|
status_t err = addOn->GetParameterEditor(B_INITIALIZE_PARAMETER_EDITOR, &fEditor);
|
||||||
|
if (err != B_OK) {
|
||||||
|
fEditor = NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fEditor = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: fEditor should be checked for NULL before adding.
|
||||||
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||||
const float spacing = be_control_look->DefaultItemSpacing();
|
const float spacing = be_control_look->DefaultItemSpacing();
|
||||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing)
|
AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing)
|
||||||
@@ -198,6 +212,9 @@ InitParamsPanel::Go(BString& name, BString& parameters)
|
|||||||
if (!Lock())
|
if (!Lock())
|
||||||
return GO_CANCELED;
|
return GO_CANCELED;
|
||||||
|
|
||||||
|
if (fEditor == NULL)
|
||||||
|
fReturnValue = B_BAD_VALUE;
|
||||||
|
|
||||||
if (fReturnValue == GO_SUCCESS) {
|
if (fReturnValue == GO_SUCCESS) {
|
||||||
if (fEditor->FinishedEditing()) {
|
if (fEditor->FinishedEditing()) {
|
||||||
status_t err = fEditor->GetParameters(¶meters);
|
status_t err = fEditor->GetParameters(¶meters);
|
||||||
|
|||||||
@@ -575,9 +575,13 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
|||||||
|
|
||||||
// Mount items
|
// Mount items
|
||||||
if (partition) {
|
if (partition) {
|
||||||
|
BDiskSystem partitionDiskSystem;
|
||||||
|
partition->GetDiskSystem(&partitionDiskSystem);
|
||||||
fInitMenu->SetEnabled(!partition->IsMounted()
|
fInitMenu->SetEnabled(!partition->IsMounted()
|
||||||
&& !partition->IsReadOnly()
|
&& !partition->IsReadOnly()
|
||||||
&& partition->Device()->HasMedia());
|
&& partition->Device()->HasMedia()
|
||||||
|
// Check if the current disk system allows initialzation.
|
||||||
|
&& partition->CanInitialize(partitionDiskSystem.PrettyName()));
|
||||||
|
|
||||||
fDeleteMI->SetEnabled(!partition->IsMounted()
|
fDeleteMI->SetEnabled(!partition->IsMounted()
|
||||||
&& !partition->IsDevice());
|
&& !partition->IsDevice());
|
||||||
|
|||||||
@@ -221,7 +221,10 @@ PartitionListRow::PartitionListRow(BPartition* partition)
|
|||||||
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
|
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
|
||||||
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
|
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
|
||||||
} else {
|
} else {
|
||||||
|
if (partition->ContainsFileSystem())
|
||||||
SetField(new BStringField(partition->Type()), kFilesystemColumn);
|
SetField(new BStringField(partition->Type()), kFilesystemColumn);
|
||||||
|
else
|
||||||
|
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
|
||||||
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
|
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "DiskDeviceJob.h"
|
#include "DiskDeviceJob.h"
|
||||||
#include "DiskDeviceJobGenerator.h"
|
#include "DiskDeviceJobGenerator.h"
|
||||||
#include "DiskDeviceJobQueue.h"
|
#include "DiskDeviceJobQueue.h"
|
||||||
#include "DiskSystemAddOnManager.h"
|
#include <DiskSystemAddOnManager.h>
|
||||||
|
|
||||||
|
|
||||||
//#define TRACE_DISK_DEVICE
|
//#define TRACE_DISK_DEVICE
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <DiskSystemAddOn.h>
|
#include <DiskSystemAddOn.h>
|
||||||
|
|
||||||
|
#include <DiskDeviceDefs.h>
|
||||||
#include <Errors.h>
|
#include <Errors.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -51,8 +52,8 @@ BDiskSystemAddOn::CanInitialize(const BMutablePartition* partition)
|
|||||||
|
|
||||||
// GetInitializationParameterEditor
|
// GetInitializationParameterEditor
|
||||||
status_t
|
status_t
|
||||||
BDiskSystemAddOn::GetInitializationParameterEditor(
|
BDiskSystemAddOn::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
|
||||||
const BMutablePartition* partition, BPartitionParameterEditor** editor)
|
BPartitionParameterEditor** editor)
|
||||||
{
|
{
|
||||||
return B_NOT_SUPPORTED;
|
return B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
@@ -305,7 +306,7 @@ BPartitionHandle::GetContentParameterEditor(BPartitionParameterEditor** editor)
|
|||||||
|
|
||||||
// GetParameterEditor
|
// GetParameterEditor
|
||||||
status_t
|
status_t
|
||||||
BPartitionHandle::GetParameterEditor(const BMutablePartition* child,
|
BPartitionHandle::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
|
||||||
BPartitionParameterEditor** editor)
|
BPartitionParameterEditor** editor)
|
||||||
{
|
{
|
||||||
return B_NOT_SUPPORTED;
|
return B_NOT_SUPPORTED;
|
||||||
@@ -346,15 +347,6 @@ BPartitionHandle::SetParameters(BMutablePartition* child,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GetChildCreationParameterEditor
|
|
||||||
status_t
|
|
||||||
BPartitionHandle::GetChildCreationParameterEditor(const char* type,
|
|
||||||
BPartitionParameterEditor** editor)
|
|
||||||
{
|
|
||||||
return B_NOT_SUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ValidateCreateChild
|
// ValidateCreateChild
|
||||||
status_t
|
status_t
|
||||||
BPartitionHandle::ValidateCreateChild(off_t* offset, off_t* size,
|
BPartitionHandle::ValidateCreateChild(off_t* offset, off_t* size,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "DiskSystemAddOnManager.h"
|
#include <DiskSystemAddOnManager.h>
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|||||||
@@ -1083,13 +1083,13 @@ BPartition::CanEditParameters() const
|
|||||||
|
|
||||||
// GetParameterEditor
|
// GetParameterEditor
|
||||||
status_t
|
status_t
|
||||||
BPartition::GetParameterEditor(BPartitionParameterEditor** editor)
|
BPartition::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
|
||||||
|
BPartitionParameterEditor** editor)
|
||||||
{
|
{
|
||||||
BPartition* parent = Parent();
|
if (!fDelegate)
|
||||||
if (!parent || !fDelegate)
|
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return parent->fDelegate->GetParameterEditor(fDelegate, editor);
|
return fDelegate->GetParameterEditor(type, editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1115,17 +1115,6 @@ BPartition::CanEditContentParameters(bool* whileMounted) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GetContentParameterEditor
|
|
||||||
status_t
|
|
||||||
BPartition::GetContentParameterEditor(BPartitionParameterEditor** editor)
|
|
||||||
{
|
|
||||||
if (!fDelegate)
|
|
||||||
return B_NO_INIT;
|
|
||||||
|
|
||||||
return fDelegate->GetContentParameterEditor(editor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// SetContentParameters
|
// SetContentParameters
|
||||||
status_t
|
status_t
|
||||||
BPartition::SetContentParameters(const char* parameters)
|
BPartition::SetContentParameters(const char* parameters)
|
||||||
@@ -1190,18 +1179,6 @@ BPartition::CanInitialize(const char* diskSystem) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GetInitializationParameterEditor
|
|
||||||
status_t
|
|
||||||
BPartition::GetInitializationParameterEditor(const char* diskSystem,
|
|
||||||
BPartitionParameterEditor** editor) const
|
|
||||||
{
|
|
||||||
if (!fDelegate)
|
|
||||||
return B_NO_INIT;
|
|
||||||
|
|
||||||
return fDelegate->GetInitializationParameterEditor(diskSystem, editor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ValidateInitialize
|
// ValidateInitialize
|
||||||
status_t
|
status_t
|
||||||
BPartition::ValidateInitialize(const char* diskSystem, BString* name,
|
BPartition::ValidateInitialize(const char* diskSystem, BString* name,
|
||||||
@@ -1243,18 +1220,6 @@ BPartition::CanCreateChild() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GetChildCreationParameterEditor
|
|
||||||
status_t
|
|
||||||
BPartition::GetChildCreationParameterEditor(const char* type,
|
|
||||||
BPartitionParameterEditor** editor) const
|
|
||||||
{
|
|
||||||
if (!fDelegate)
|
|
||||||
return B_NO_INIT;
|
|
||||||
|
|
||||||
return fDelegate->GetChildCreationParameterEditor(type, editor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ValidateCreateChild
|
// ValidateCreateChild
|
||||||
status_t
|
status_t
|
||||||
BPartition::ValidateCreateChild(off_t* offset, off_t* size, const char* type,
|
BPartition::ValidateCreateChild(off_t* offset, off_t* size, const char* type,
|
||||||
|
|||||||
@@ -8,9 +8,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <DiskSystemAddOn.h>
|
#include <DiskSystemAddOn.h>
|
||||||
|
#include <DiskSystemAddOnManager.h>
|
||||||
#include "DiskSystemAddOnManager.h"
|
|
||||||
|
|
||||||
|
|
||||||
//#define TRACE_PARTITION_DELEGATE
|
//#define TRACE_PARTITION_DELEGATE
|
||||||
#undef TRACE
|
#undef TRACE
|
||||||
@@ -336,31 +334,6 @@ BPartition::Delegate::SetType(Delegate* child, const char* type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GetContentParameterEditor
|
|
||||||
status_t
|
|
||||||
BPartition::Delegate::GetContentParameterEditor(
|
|
||||||
BPartitionParameterEditor** editor) const
|
|
||||||
{
|
|
||||||
if (!fPartitionHandle)
|
|
||||||
return B_NO_INIT;
|
|
||||||
|
|
||||||
return fPartitionHandle->GetContentParameterEditor(editor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// GetParameterEditor
|
|
||||||
status_t
|
|
||||||
BPartition::Delegate::GetParameterEditor(Delegate* child,
|
|
||||||
BPartitionParameterEditor** editor) const
|
|
||||||
{
|
|
||||||
if (!fPartitionHandle || !child)
|
|
||||||
return B_NO_INIT;
|
|
||||||
|
|
||||||
return fPartitionHandle->GetParameterEditor(&child->fMutablePartition,
|
|
||||||
editor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// SetContentParameters
|
// SetContentParameters
|
||||||
status_t
|
status_t
|
||||||
BPartition::Delegate::SetContentParameters(const char* parameters)
|
BPartition::Delegate::SetContentParameters(const char* parameters)
|
||||||
@@ -425,6 +398,12 @@ BPartition::Delegate::IsSubSystem(Delegate* child, const char* diskSystem) const
|
|||||||
bool
|
bool
|
||||||
BPartition::Delegate::CanInitialize(const char* diskSystem) const
|
BPartition::Delegate::CanInitialize(const char* diskSystem) const
|
||||||
{
|
{
|
||||||
|
// HACK TO HELP BLANK PARTITION'S BECOME INITIALIZED.
|
||||||
|
if (diskSystem == NULL)
|
||||||
|
return true;
|
||||||
|
if (strlen(diskSystem) < 1)
|
||||||
|
return true;
|
||||||
|
|
||||||
// get the disk system add-on
|
// get the disk system add-on
|
||||||
DiskSystemAddOnManager* manager = DiskSystemAddOnManager::Default();
|
DiskSystemAddOnManager* manager = DiskSystemAddOnManager::Default();
|
||||||
BDiskSystemAddOn* addOn = manager->GetAddOn(diskSystem);
|
BDiskSystemAddOn* addOn = manager->GetAddOn(diskSystem);
|
||||||
@@ -440,27 +419,6 @@ BPartition::Delegate::CanInitialize(const char* diskSystem) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GetInitializationParameterEditor
|
|
||||||
status_t
|
|
||||||
BPartition::Delegate::GetInitializationParameterEditor(
|
|
||||||
const char* diskSystem, BPartitionParameterEditor** editor) const
|
|
||||||
{
|
|
||||||
// get the disk system add-on
|
|
||||||
DiskSystemAddOnManager* manager = DiskSystemAddOnManager::Default();
|
|
||||||
BDiskSystemAddOn* addOn = manager->GetAddOn(diskSystem);
|
|
||||||
if (!addOn)
|
|
||||||
return B_ENTRY_NOT_FOUND;
|
|
||||||
|
|
||||||
status_t result = addOn->GetInitializationParameterEditor(
|
|
||||||
&fMutablePartition, editor);
|
|
||||||
|
|
||||||
// put the add-on
|
|
||||||
manager->PutAddOn(addOn);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ValidateInitialize
|
// ValidateInitialize
|
||||||
status_t
|
status_t
|
||||||
BPartition::Delegate::ValidateInitialize(const char* diskSystem,
|
BPartition::Delegate::ValidateInitialize(const char* diskSystem,
|
||||||
@@ -537,15 +495,15 @@ BPartition::Delegate::GetPartitioningInfo(BPartitioningInfo* info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GetChildCreationParameterEditor
|
// GetParameterEditor
|
||||||
status_t
|
status_t
|
||||||
BPartition::Delegate::GetChildCreationParameterEditor(const char* type,
|
BPartition::Delegate::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
|
||||||
BPartitionParameterEditor** editor) const
|
BPartitionParameterEditor** editor) const
|
||||||
{
|
{
|
||||||
if (!fPartitionHandle)
|
if (!fPartitionHandle)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return fPartitionHandle->GetChildCreationParameterEditor(type, editor);
|
return fPartitionHandle->GetParameterEditor(type, editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#ifndef _PARTITION_DELEGATE_H
|
#ifndef _PARTITION_DELEGATE_H
|
||||||
#define _PARTITION_DELEGATE_H
|
#define _PARTITION_DELEGATE_H
|
||||||
|
|
||||||
|
#include <DiskSystemAddOn.h>
|
||||||
#include <MutablePartition.h>
|
#include <MutablePartition.h>
|
||||||
#include <Partition.h>
|
#include <Partition.h>
|
||||||
|
|
||||||
@@ -66,23 +67,19 @@ public:
|
|||||||
const char* type) const;
|
const char* type) const;
|
||||||
status_t SetType(Delegate* child, const char* type);
|
status_t SetType(Delegate* child, const char* type);
|
||||||
|
|
||||||
status_t GetContentParameterEditor(
|
|
||||||
BPartitionParameterEditor** editor) const;
|
|
||||||
status_t GetParameterEditor(Delegate* child,
|
|
||||||
BPartitionParameterEditor** editor) const;
|
|
||||||
status_t SetContentParameters(const char* parameters);
|
status_t SetContentParameters(const char* parameters);
|
||||||
status_t SetParameters(Delegate* child,
|
status_t SetParameters(Delegate* child,
|
||||||
const char* parameters);
|
const char* parameters);
|
||||||
|
|
||||||
|
status_t GetParameterEditor(
|
||||||
|
B_PARAMETER_EDITOR_TYPE type,
|
||||||
|
BPartitionParameterEditor** editor) const;
|
||||||
status_t GetNextSupportedChildType(Delegate* child,
|
status_t GetNextSupportedChildType(Delegate* child,
|
||||||
int32 *cookie, BString* type) const;
|
int32 *cookie, BString* type) const;
|
||||||
bool IsSubSystem(Delegate* child,
|
bool IsSubSystem(Delegate* child,
|
||||||
const char* diskSystem) const;
|
const char* diskSystem) const;
|
||||||
|
|
||||||
bool CanInitialize(const char* diskSystem) const;
|
bool CanInitialize(const char* diskSystem) const;
|
||||||
status_t GetInitializationParameterEditor(
|
|
||||||
const char* system,
|
|
||||||
BPartitionParameterEditor** editor) const;
|
|
||||||
status_t ValidateInitialize(const char* diskSystem,
|
status_t ValidateInitialize(const char* diskSystem,
|
||||||
BString* name, const char* parameters);
|
BString* name, const char* parameters);
|
||||||
status_t Initialize(const char* diskSystem,
|
status_t Initialize(const char* diskSystem,
|
||||||
@@ -94,9 +91,6 @@ public:
|
|||||||
|
|
||||||
status_t GetPartitioningInfo(BPartitioningInfo* info);
|
status_t GetPartitioningInfo(BPartitioningInfo* info);
|
||||||
|
|
||||||
status_t GetChildCreationParameterEditor(
|
|
||||||
const char* system,
|
|
||||||
BPartitionParameterEditor** editor) const;
|
|
||||||
status_t ValidateCreateChild(off_t* start, off_t* size,
|
status_t ValidateCreateChild(off_t* start, off_t* size,
|
||||||
const char* type, BString* name,
|
const char* type, BString* name,
|
||||||
const char* parameters) const;
|
const char* parameters) const;
|
||||||
@@ -118,3 +112,4 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
#endif // _PARTITION_DELEGATE_H
|
#endif // _PARTITION_DELEGATE_H
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ BPartitionParameterEditor::View()
|
|||||||
bool
|
bool
|
||||||
BPartitionParameterEditor::FinishedEditing()
|
BPartitionParameterEditor::FinishedEditing()
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ BPartitionParameterEditor::GetParameters(BString* parameters)
|
|||||||
status_t
|
status_t
|
||||||
BPartitionParameterEditor::PartitionTypeChanged(const char* type)
|
BPartitionParameterEditor::PartitionTypeChanged(const char* type)
|
||||||
{
|
{
|
||||||
return B_OK;
|
return B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -105,5 +105,6 @@ BPartitionParameterEditor::PartitionTypeChanged(const char* type)
|
|||||||
status_t
|
status_t
|
||||||
BPartitionParameterEditor::PartitionNameChanged(const char* name)
|
BPartitionParameterEditor::PartitionNameChanged(const char* name)
|
||||||
{
|
{
|
||||||
return B_OK;
|
return B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user