diff --git a/headers/private/kernel/disk_device_manager/ddm_userland_interface.h b/headers/private/kernel/disk_device_manager/ddm_userland_interface.h index 49d36a187a..5cb9efff17 100644 --- a/headers/private/kernel/disk_device_manager/ddm_userland_interface.h +++ b/headers/private/kernel/disk_device_manager/ddm_userland_interface.h @@ -192,6 +192,8 @@ status_t _kern_initialize_partition(partition_id partitionID, int32 changeCounter, const char *diskSystemName, const char *name, const char *parameters); +status_t _kern_uninitialize_partition(partition_id partitionID, + int32 changeCounter); status_t _kern_create_child_partition(partition_id partitionID, int32 changeCounter, off_t offset, off_t size, const char *type, diff --git a/src/kernel/core/disk_device_manager/ddm_userland_interface.cpp b/src/kernel/core/disk_device_manager/ddm_userland_interface.cpp index 5f954e227e..2813a964dc 100644 --- a/src/kernel/core/disk_device_manager/ddm_userland_interface.cpp +++ b/src/kernel/core/disk_device_manager/ddm_userland_interface.cpp @@ -1614,6 +1614,23 @@ _kern_initialize_partition(partition_id partitionID, int32 changeCounter, partition, B_PARTITION_INITIALIZE); } +// _kern_uninitialize_partition +status_t +_kern_uninitialize_partition(partition_id partitionID, int32 changeCounter) +{ + KDiskDeviceManager *manager = KDiskDeviceManager::Default(); + // get the partition + KPartition *partition = manager->WriteLockPartition(partitionID); + if (!partition) + return B_ENTRY_NOT_FOUND; + PartitionRegistrar registrar1(partition, true); + PartitionRegistrar registrar2(partition->Device(), true); + DeviceWriteLocker locker(partition->Device(), true); + // unitialize the partition's contents and set the new parameters + partition->UninitializeContents(true); + return B_OK; +} + // _kern_create_child_partition status_t _kern_create_child_partition(partition_id partitionID, int32 changeCounter,