Refinements to new treatment of hybrid MBR and MBR conversions that

span the 2TiB boundary.
This commit is contained in:
Roderick W. Smith
2014-02-22 12:12:32 -05:00
parent 820d1d04a3
commit a345a92260
7 changed files with 68 additions and 18 deletions

View File

@@ -138,9 +138,17 @@ int GPTPart::IsUsed(void) {
return (partitionType != GUIDData("0x00"));
} // GPTPart::IsUsed()
// Returns 1 if the partition's end point is under (2^32 - 1) sectors, 0 if it's over that value.
// Returns MBR_SIZED_GOOD, MBR_SIZED_IFFY, or MBR_SIZED_BAD; see comments
// in header file for details.
int GPTPart::IsSizedForMBR(void) {
return (lastLBA < UINT32_MAX);
int retval = MBR_SIZED_GOOD;
if ((firstLBA > UINT32_MAX) || ((lastLBA - firstLBA) > UINT32_MAX) || (firstLBA > lastLBA))
retval = MBR_SIZED_BAD;
else if (lastLBA > UINT32_MAX)
retval = MBR_SIZED_IFFY;
return (retval);
} // GPTPart::IsSizedForMBR()
// Set the type code to the specified one. Also changes the partition