From 0fbba5d7214682fdf4339c52d7e41f2f398eca1b Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 23 Jan 2021 17:39:58 +0100 Subject: [PATCH] disk_system add-ons: fix initialization We never told the disk system that the partition had been initialized. As a result, the disk device jobs to clean and reinit the partition table were not run. This would lead to: - The bootloader code not being replaced with our MBR code - Old partitions not being removed from the disk This would maybe solve itself when creating a partition, but it's better to do these changes immediately when the user asks to initialize the disk. Fixes #9108. Change-Id: Icc8ebe3830d948367852a57cf46d034b0f1c6c19 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3673 Reviewed-by: Niels Sascha Reedijk --- src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp | 1 + src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp | 1 + src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp b/src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp index 1903f84dea..f0ac78d925 100644 --- a/src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp +++ b/src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp @@ -139,6 +139,7 @@ GPTDiskAddOn::Initialize(BMutablePartition* partition, const char* name, partition->SetContentParameters(NULL); partition->SetContentSize( round_down(partition->Size(), partition->BlockSize())); + partition->Changed(B_PARTITION_CHANGED_INITIALIZATION); *_handle = handle; return B_OK; diff --git a/src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp b/src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp index 3145d8cc99..88923bb32d 100644 --- a/src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp +++ b/src/add-ons/disk_systems/intel/ExtendedPartitionAddOn.cpp @@ -141,6 +141,7 @@ ExtendedPartitionAddOn::Initialize(BMutablePartition* partition, partition->SetContentParameters(NULL); partition->SetContentSize( sector_align(partition->Size(), partition->BlockSize())); + partition->Changed(B_PARTITION_CHANGED_INITIALIZATION); *_handle = handleDeleter.Detach(); diff --git a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp index f75ee09d02..22a80326e3 100644 --- a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp +++ b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp @@ -140,6 +140,7 @@ PartitionMapAddOn::Initialize(BMutablePartition* partition, const char* name, partition->SetContentParameters(NULL); partition->SetContentSize( sector_align(partition->Size(), partition->BlockSize())); + partition->Changed(B_PARTITION_CHANGED_INITIALIZATION); *_handle = handleDeleter.Detach();