partitioning_system: get the correct parameter editor

When editing a partition parameters, we want to get the editor from the
parent partition. This will be the editor used to set the active
partition on Intel partition map, for example. The code testing if this
is supported and the code to apply the parameters did this, but the code
to get the parameter editor didn't.

Fixes the remaining part of #11641.

Change-Id: I25a6cf11fe315b8f6e118529f2395816101b7fe1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3766
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Adrien Destugues 2021-03-08 23:13:09 +01:00 committed by Adrien Destugues
parent 76fc09c0b9
commit 8f5c5225da
2 changed files with 7 additions and 5 deletions

View File

@ -237,6 +237,7 @@ PartitionMapHandle::SupportedChildOperations(const BMutablePartition* child,
return B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD
| B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD
| B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE
| B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS
| B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD;
}

View File

@ -1001,7 +1001,7 @@ status_t
BPartition::ValidateSetType(const char* type) const
{
BPartition* parent = Parent();
if (parent == NULL || fDelegate == NULL)
if (parent == NULL || parent->fDelegate == NULL || fDelegate == NULL)
return B_NO_INIT;
return parent->fDelegate->ValidateSetType(fDelegate, type);
@ -1012,7 +1012,7 @@ status_t
BPartition::SetType(const char* type)
{
BPartition* parent = Parent();
if (parent == NULL || fDelegate == NULL)
if (parent == NULL || parent->fDelegate == NULL || fDelegate == NULL)
return B_NO_INIT;
return parent->fDelegate->SetType(fDelegate, type);
@ -1035,10 +1035,11 @@ status_t
BPartition::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
BPartitionParameterEditor** editor)
{
if (fDelegate == NULL)
BPartition* parent = Parent();
if (parent == NULL || parent->fDelegate == NULL)
return B_NO_INIT;
return fDelegate->GetParameterEditor(type, editor);
return parent->fDelegate->GetParameterEditor(type, editor);
}
@ -1046,7 +1047,7 @@ status_t
BPartition::SetParameters(const char* parameters)
{
BPartition* parent = Parent();
if (parent == NULL || fDelegate == NULL)
if (parent == NULL || parent->fDelegate == NULL || fDelegate == NULL)
return B_NO_INIT;
return parent->fDelegate->SetParameters(fDelegate, parameters);