From 20c33ce79bbbb3802fb5841802eb9e39fa9cd4c8 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 21 Sep 2003 19:13:54 +0000 Subject: [PATCH] Added syscall for uninitialization. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4778 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../ddm_userland_interface.h | 2 ++ .../ddm_userland_interface.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) 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,