[parted-devel] [PATCH] When comparing use the same type of formats.

Jim Meyering jim at meyering.net
Fri Feb 20 17:08:03 UTC 2009


Jim Meyering <jim at meyering.net> writes:
> Joel Granados Moreno <jgranado at redhat.com> writes:
>> * libparted/labels/gpt.c (_parse_header()) : The problem is that
>> last_usable_if_grown and last_usable_min_default should be both CPU
>> format, but last_usable_if_grown is converted to LE64.  Patch taken from
>> parted mailing list, author (petr.uzel at suse.cz).
>> ---
>>  libparted/labels/gpt.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
>> index ae74123..df7a597 100644
>> --- a/libparted/labels/gpt.c
>> +++ b/libparted/labels/gpt.c
>> @@ -676,10 +676,10 @@ _parse_header (PedDisk* disk, GuidPartitionTableHeader_t* gpt,
>>  */
>>
>>  	last_usable_if_grown
>> -		= PED_CPU_TO_LE64 (disk->dev->length - 2 -
>> +		= disk->dev->length - 2 -
>>  		((PedSector)(PED_LE32_TO_CPU(gpt->NumberOfPartitionEntries)) *
>>  		(PedSector)(PED_LE32_TO_CPU(gpt->SizeOfPartitionEntry)) /
>> -		disk->dev->sector_size));
>> +		disk->dev->sector_size);
>>
>>  	last_usable_min_default = disk->dev->length - 2 -
>>  		GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / disk->dev->sector_size;
>
> Ok, I see now that the existing gpt tests might already cover this case
> when run on a big-endian system.
>
> I've adjusted the patch not to remove parentheses (generally good
> to keep around multi-line expressions so automatic indenters can
> do the right thing).  Of course, they're not much use right now,
> but I'm optimistic.  Also adjusted the commit log.
>
> Petr, let me know if this is ok with you, and I'll push it.

I figure it's ok, so have just pushed it.



More information about the parted-devel mailing list