From 8f5c5225da78da8a3003f8c48c33f5d7eedba843 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 8 Mar 2021 23:13:09 +0100 Subject: [PATCH] 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 --- src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp | 1 + src/kits/storage/disk_device/Partition.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp index 22a80326e3..913bf3c38c 100644 --- a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp +++ b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp @@ -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; } diff --git a/src/kits/storage/disk_device/Partition.cpp b/src/kits/storage/disk_device/Partition.cpp index 5964a8ae5b..5c5ff53477 100644 --- a/src/kits/storage/disk_device/Partition.cpp +++ b/src/kits/storage/disk_device/Partition.cpp @@ -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);