[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

GPT parted patch ... [Matt_Domsch@dell.com: [PATCH] GPT PMBR disk >2TB fix]



Hello,

Could someone with knowledge in architectures that use the GPT disk labels
please have a look at this, and tell me if it is worthwhile to add this patch ? 

Friendly,

Sven Luther

----- Forwarded message from Matt Domsch <Matt_Domsch@dell.com> -----

Envelope-to: luther@localhost
Delivery-date: Mon, 08 Nov 2004 18:05:59 +0100
X-Sieve: Server Sieve 2.2
From: Matt Domsch <Matt_Domsch@dell.com>
To: bug-parted@gnu.org
Subject: [PATCH] GPT PMBR disk >2TB fix
X-BeenThere: bug-parted@gnu.org
X-Mailman-Version: 2.1.5
List-Id: Bug reports for the GNU Parted disk partition editor
	<bug-parted.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-parted>,
	<mailto:bug-parted-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/bug-parted>
List-Post: <mailto:bug-parted@gnu.org>
List-Help: <mailto:bug-parted-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-parted>,
	<mailto:bug-parted-request@gnu.org?subject=subscribe>
X-Spam: no; 0.00; fix:01 mbr:01 xffffffff:01 efi:01 overflowing:01 2.6.10:01 linux:01 kernel:01 partitioning:01 xffffffff:01 linux:01 parted-:01 libparted:01 wed:01 parted-:01 

Patch below (applies against 1.6.11 and 1.6.16 at least) sets the
SizeInLBA field in the Protective MBR on GPT disks to be 0xFFFFFFFF if
the disk size is really larger than that.  This is to be consistent
with the EFI Specification.

Necessary to prevent overflowing this field on really large disks.
The 2.6.10 Linux kernel partitioning code will start checking
this value for sanity, and 0xFFFFFFFF is a special value there now.


-- 
Matt Domsch
Sr. Software Engineer, Lead Engineer
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com


--- parted-1.6.11/libparted/disk_gpt.c~	Wed Mar 10 16:11:42 2004
+++ parted-1.6.11/libparted/disk_gpt.c	Mon Nov  8 09:37:17 2004
@@ -689,7 +689,10 @@ _write_pmbr(PedDevice * dev)
 	pmbr.PartitionRecord[0].EndSector   = 0xFF;
 	pmbr.PartitionRecord[0].EndTrack    = 0xFF;
 	pmbr.PartitionRecord[0].StartingLBA = PED_CPU_TO_LE32(1);
-	pmbr.PartitionRecord[0].SizeInLBA   = PED_CPU_TO_LE32(dev->length - 1);
+	if ((dev->length - 1ULL) > 0xFFFFFFFFULL) 
+		pmbr.PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32(0xFFFFFFFF);
+	else
+		pmbr.PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32(dev->length - 1UL);
 
 	return ped_device_write(dev, &pmbr, GPT_PMBR_LBA, GPT_PMBR_SECTORS);
 }


_______________________________________________
Bug-parted mailing list
Bug-parted@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-parted

----- End forwarded message -----



Reply to: