parted/0084-libparted-Use-common-function-to-calculate-PTE-secto.patch
Brian C. Lane 73aa139585 - Rebase on parted master commit 1da239e2ebd2
- libparted: Fix bug with dupe and empty name
2014-06-13 09:52:56 -07:00

49 lines
1.8 KiB
Diff

From 3398e82af3d26cc1ab938f2e0896204f11bce4ca Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 8 Apr 2014 11:12:17 -0700
Subject: [PATCH 084/131] libparted: Use common function to calculate PTE
sectors
Use _ptes_sectors in _parse_header's calculation to determine if the
disk has been grown.
* libparted/labels/gpt.c (_parse_header): use _ptes_sectors
---
libparted/labels/gpt.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index c5dea2f..6eff38a 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -751,17 +751,7 @@ _parse_header (PedDisk *disk, const GuidPartitionTableHeader_t *gpt,
space or continue with the current usable area. Only ask once per
parted invocation. */
- last_usable_if_grown
- = (disk->dev->length - 2 -
- ((PedSector) (PED_LE32_TO_CPU (gpt->NumberOfPartitionEntries)) *
- (PedSector) (PED_LE32_TO_CPU (gpt->SizeOfPartitionEntry)) /
- disk->dev->sector_size));
-
- last_usable_min_default = disk->dev->length - 2 -
- GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / disk->dev->sector_size;
-
- if (last_usable_if_grown > last_usable_min_default)
- last_usable_if_grown = last_usable_min_default;
+ last_usable_if_grown = disk->dev->length - 2 - _ptes_sectors(disk, gpt);
if (last_usable <= first_usable
|| disk->dev->length < last_usable)
@@ -791,7 +781,6 @@ _parse_header (PedDisk *disk, const GuidPartitionTableHeader_t *gpt,
ptt_clear_sectors (disk->dev,
gpt_disk_data->AlternateLBA, 1);
gpt_disk_data->AlternateLBA = disk->dev->length - 1;
- last_usable = last_usable_if_grown;
*update_needed = 1;
}
else if (q != PED_EXCEPTION_UNHANDLED)
--
1.9.3