[haiku-commits] haiku: hrev45194 - src/add-ons/disk_systems/gpt src/apps/drivesetup headers/private/system

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 24 Jan 2013 01:15:42 +0100 (CET)

hrev45194 adds 3 changesets to branch 'master'
old head: 0a8ba3708e11f8b75b7e1a5a81cd197c381778d4
new head: e26ef5524c955533cf47a148e8157c74090cc794
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=e26ef55+%5E0a8ba37

----------------------------------------------------------------------------

7f33c9c: Lost the "EFI" in front of "GUID Partition Map" name.
  
  * This is how other systems refer to it as well, and is shorter, too.

f142407: DriveSetup: improved error reporting when deleting a partition.

e26ef55: gpt: the disk system now correctly maintains free space.
  
  * Ie. the BPartitioningInfo should now be correctly filled.

                                   [ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

3 files changed, 15 insertions(+), 8 deletions(-)
headers/private/system/disk_device_types.h          |  2 +-
src/add-ons/disk_systems/gpt/GPTPartitionHandle.cpp | 17 ++++++++++++-----
src/apps/drivesetup/MainWindow.cpp                  |  4 ++--

############################################################################

Commit:      7f33c9cda3deee16c34a91d1d4274a785b62f40e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7f33c9c
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Thu Jan 24 00:11:27 2013 UTC

Lost the "EFI" in front of "GUID Partition Map" name.

* This is how other systems refer to it as well, and is shorter, too.

----------------------------------------------------------------------------

diff --git a/headers/private/system/disk_device_types.h 
b/headers/private/system/disk_device_types.h
index e428769..40ce1a5 100644
--- a/headers/private/system/disk_device_types.h
+++ b/headers/private/system/disk_device_types.h
@@ -25,7 +25,7 @@
 
 #define AMIGA_PARTITION_NAME                   "Amiga Partition Map"
 #define APPLE_PARTITION_NAME                   "Apple Partition Map"
-#define EFI_PARTITION_NAME                             "EFI GUID Partition Map"
+#define EFI_PARTITION_NAME                             "GUID Partition Map"
 #define INTEL_PARTITION_NAME                   "Intel Partition Map"
 #define INTEL_EXTENDED_PARTITION_NAME  "Intel Extended Partition"
 #define VMDK_PARTITION_NAME                            "VMDK Partition"

############################################################################

Commit:      f142407b03b984b38e7600f4de527d4a8b6a4e4e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f142407
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Thu Jan 24 00:12:47 2013 UTC

DriveSetup: improved error reporting when deleting a partition.

----------------------------------------------------------------------------

diff --git a/src/apps/drivesetup/MainWindow.cpp 
b/src/apps/drivesetup/MainWindow.cpp
index 8850b59..e0cc9ff 100644
--- a/src/apps/drivesetup/MainWindow.cpp
+++ b/src/apps/drivesetup/MainWindow.cpp
@@ -1145,7 +1145,7 @@ MainWindow::_Delete(BDiskDevice* disk, partition_id 
selectedPartition)
        ret = parent->DeleteChild(partition->Index());
        if (ret != B_OK) {
                _DisplayPartitionError(
-                       B_TRANSLATE("Could not delete the selected 
partition."));
+                       B_TRANSLATE("Could not delete the selected 
partition."), NULL, ret);
                return;
        }
 
@@ -1153,7 +1153,7 @@ MainWindow::_Delete(BDiskDevice* disk, partition_id 
selectedPartition)
 
        if (ret != B_OK) {
                _DisplayPartitionError(B_TRANSLATE("Failed to delete the 
partition. "
-                       "No changes have been written to disk."));
+                       "No changes have been written to disk."), NULL, ret);
                return;
        }
 

############################################################################

Revision:    hrev45194
Commit:      e26ef5524c955533cf47a148e8157c74090cc794
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e26ef55
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Thu Jan 24 00:13:46 2013 UTC

gpt: the disk system now correctly maintains free space.

* Ie. the BPartitioningInfo should now be correctly filled.

----------------------------------------------------------------------------

diff --git a/src/add-ons/disk_systems/gpt/GPTPartitionHandle.cpp 
b/src/add-ons/disk_systems/gpt/GPTPartitionHandle.cpp
index abff127..8efba51 100644
--- a/src/add-ons/disk_systems/gpt/GPTPartitionHandle.cpp
+++ b/src/add-ons/disk_systems/gpt/GPTPartitionHandle.cpp
@@ -102,12 +102,19 @@ 
GPTPartitionHandle::GetPartitioningInfo(BPartitioningInfo* info)
 {
        // init to the full size (minus the first sector)
        off_t size = Partition()->ContentSize();
-       status_t error = info->SetTo(Partition()->BlockSize(),
+       status_t status = info->SetTo(Partition()->BlockSize(),
                size - Partition()->BlockSize());
-       if (error != B_OK)
-               return error;
-
-       // TODO: exclude the space of the existing partitions
+       if (status != B_OK)
+               return status;
+
+       // Exclude the space of the existing partitions
+       size_t count = Partition()->CountChildren();
+       for (size_t index = 0; index < count; index++) {
+               BMutablePartition* child = Partition()->ChildAt(index);
+               status = info->ExcludeOccupiedSpace(child->Offset(), 
child->Size());
+               if (status != B_OK)
+                       return status;
+       }
 
        return B_OK;
 }


Other related posts: