[parted-devel] [PATCH 1/4] libparted: Remove the prompt to fix the backup GPT header.

Phillip Susi psusi at ubuntu.com
Mon Mar 31 14:42:06 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 3/28/2014 11:46 PM, Brian C. Lane wrote:
> If the header is in the wrong place it will be caught by the code
> to detect unused space, so remove the prompt completely. This also
> fixes a comparison that would have resulted in using a PTE area
> that was smaller than the default instead of the larger.

We don't want to remove it completely.  If the header really is in a
totally wrong location ( like inside an allocated partition ), we *do*
want to complain about that.

> diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c index
> 42b0360..26ec755 100644 --- a/libparted/labels/gpt.c +++
> b/libparted/labels/gpt.c @@ -737,7 +737,8 @@ _parse_header (PedDisk
> *disk, const GuidPartitionTableHeader_t *gpt, 
> 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) +  /* Use
> the LARGER PTE area */ +  if (last_usable_if_grown <
> last_usable_min_default) last_usable_if_grown =
> last_usable_min_default;

This existing code seems to be broken on its face.  It looks like it
computes where LastUsableLBA actually should be based on the actual
size of the partition table, and the where it should be if the
partition table were 128 entries.  Before this patch, if the table is
smaller than 128, then it leaves room for a 128 entry table anyhow,
leaving some sectors wasted.  After this patch, it gets rid of the
wasted space for a smaller table, but if the table is larger than 128
entries, then it does not leave enough room for it, which is even worse.

That whole last_usable_min_default just needs removed.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTOX6+AAoJEI5FoCIzSKrwxGgIAJ8XVQmreCPjV9bkkBdafpdY
lzIQUH76NTESdGsvDnGcs84NXZGAJHJBFzlUDQ2BKWLpHFsL1dHhP6NA5aJQKnk0
P8xXLU8Y9DZCM2SknUR9M8UUtXceht2IEayE8L4o9vwJdlO/1JYxkReNslW/2CSw
PDf/U0OUgUfVpHKInhgLWEC+lpYY3hchxDA6kbPMGOU5673X2Xdo0b4JvL2ObHdS
OFd4NpPSakJXc2HliZjbnfro6OC/FaEpN+sj2gAseuw5TSx7MzkcSrT5CHPCxEfJ
OH8fI/2lCHMqdI+djDuflbfY1TodLYB892paoNTMQ3xVLqIZlnr/SbEhzxXiD48=
=l2mH
-----END PGP SIGNATURE-----



More information about the parted-devel mailing list