diff options
author | Roderick W. Smith <rodsmith@rodsbooks.com> | 2014-02-22 12:12:32 -0500 |
---|---|---|
committer | Roderick W. Smith <rodsmith@rodsbooks.com> | 2014-02-22 12:12:32 -0500 |
commit | a345a922606a88447d2d89e28189d5372a75ea07 (patch) | |
tree | a3a7293c901ee8b1d0f17cec8ececc5f2be045da /gptpart.cc | |
parent | 820d1d04a3a76fb7699063597aac55742cc28d4a (diff) | |
download | sgdisk-a345a922606a88447d2d89e28189d5372a75ea07.tar.gz |
Refinements to new treatment of hybrid MBR and MBR conversions that
span the 2TiB boundary.
Diffstat (limited to 'gptpart.cc')
-rw-r--r-- | gptpart.cc | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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 |