parted/0089-libparted-Use-common-function-to-calculate-PTE-secto.patch
Brian C. Lane 0b7af917e2 - Rebase on new upstream master commit cc382c3
- Drop patches incorporated into upstream
- Still adds the various DASD patches
2014-04-08 11:46:37 -07:00

48 lines
1.8 KiB
Diff

From e64081878775a6f34b5206dd066a47ed2496cbab 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 89/91] 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.0