[haiku-bugs] Re: [Haiku] #8823: DriveSetup won't let you repartition GPT drives to MBR (intel)

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Thu, 18 Jun 2015 23:20:28 -0000

#8823: DriveSetup won't let you repartition GPT drives to MBR (intel)
---------------------------------------+----------------------------
Reporter: kallisti5 | Owner: stippi
Type: bug | Status: new
Priority: normal | Milestone: R1
Component: Applications/DriveSetup | Version: R1/Development
Resolution: | Keywords: GPT, MBR
Blocked By: 8991 | Blocking:
Has a Patch: 0 | Platform: All
---------------------------------------+----------------------------

Comment (by bonefish):

Replying to [comment:11 kallisti5]:

One reason this one is so rough is that we likely need a DiskSystem
destroy call added to the API.

Then DriveSetup can call currentDiskSystem->Destroy();
newDiskSystem->Create(Intel) (that's all mumbo-jumbo pseudo code btw :-))

Most of the required infrastructure is already implemented, with a few
pieces missing:

* [http://cgit.haiku-

os.org/haiku/tree/src/kits/storage/disk_device/Partition.cpp?id=5bca1dd7af5c6c7a0cb10ee528b47ae52ab6fbd4#n1149
BPartition::Uninitialize()]: not implemented yet, but should be straight-
forward
* [http://cgit.haiku-

os.org/haiku/tree/src/kits/storage/disk_device/PartitionDelegate.cpp?id=5bca1dd7af5c6c7a0cb10ee528b47ae52ab6fbd4#n470
BPartition::Delegate::Uninitialize()]: looks complete
* [http://cgit.haiku-

os.org/haiku/tree/src/kits/storage/disk_device/MutablePartition.cpp?id=5bca1dd7af5c6c7a0cb10ee528b47ae52ab6fbd4#n25
BMutablePartition::UninitializeContents()]: looks complete
* [http://cgit.haiku-

os.org/haiku/tree/src/kits/storage/disk_device/DiskDeviceJobGenerator.cpp?id=5bca1dd7af5c6c7a0cb10ee528b47ae52ab6fbd4#n195
DiskDeviceJobGenerator::_GenerateCleanupJobs()] and [http://cgit.haiku-

os.org/haiku/tree/src/kits/storage/disk_device/DiskDeviceJobGenerator.cpp?id=5bca1dd7af5c6c7a0cb10ee528b47ae52ab6fbd4#n518
DiskDeviceJobGenerator::_GenerateUninitializeJob()]: look complete
* [http://cgit.haiku-

os.org/haiku/tree/src/kits/storage/disk_device/jobs/UninitializeJob.cpp?id=5bca1dd7af5c6c7a0cb10ee528b47ae52ab6fbd4#n27
UninitializeJob::Do()]: looks complete
* [http://cgit.haiku-

os.org/haiku/tree/src/system/kernel/disk_device_manager/ddm_userland_interface.cpp?id=5bca1dd7af5c6c7a0cb10ee528b47ae52ab6fbd4#n1220
_user_uninitialize_partition()]: looks complete
* [http://cgit.haiku-

os.org/haiku/tree/src/system/kernel/disk_device_manager/KFileSystem.cpp?id=5bca1dd7af5c6c7a0cb10ee528b47ae52ab6fbd4#n224
KFileSystem::Uninitialize()] and [http://cgit.haiku-

os.org/haiku/tree/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp?id=5bca1dd7af5c6c7a0cb10ee528b47ae52ab6fbd4#n421
KPartitioningSystem::Uninitialize()]: look complete
* The `uninitialize()` hook needs to be implemented for all file and
partition system modules. Some (like [http://cgit.haiku-
os.org/haiku/tree/src/add-

ons/kernel/file_systems/bfs/kernel_interface.cpp?id=5bca1dd7af5c6c7a0cb10ee528b47ae52ab6fbd4#n2343
bfs]) do that already, but others (like [http://cgit.haiku-
os.org/haiku/tree/src/add-

ons/kernel/partitioning_systems/gpt/efi_gpt.cpp?id=5bca1dd7af5c6c7a0cb10ee528b47ae52ab6fbd4#n914
gpt]) don't.

The stuff up to `BMutablePartition::UninitializeContents()`) is actually
only needed for explicit uninitializing. When initializing a partition
already initialized with another disk system the subsequent part should
already be executed as a preparatory measure. I believe that's why the bfs
module already implements the hook and I'd expect that this part works. So
I suppose all that's needed for your use case to work is a proper
implementation of the `uninitialize()` hook in the gpt module.

--
Ticket URL: <https://dev.haiku-os.org/ticket/8823#comment:12>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: