intel disk system: restrict maximum supported size.

* The MBR can only address 2^32 blocks.
* This prevents you from initializing a disk larger than 2TB with a block
  size of 512 bytes.
This commit is contained in:
Axel Dörfler
2013-01-24 00:44:26 +01:00
parent 61ba12594b
commit 2077b23f14
@@ -90,8 +90,10 @@ PartitionMapAddOn::CreatePartitionHandle(BMutablePartition* partition,
bool
PartitionMapAddOn::CanInitialize(const BMutablePartition* partition)
{
// If it's big enough, we can initialize it.
return partition->Size() >= 2 * partition->BlockSize();
// If it's big enough, but not too big (ie. larger than 2^32 blocks) we can
// initialize it.
return partition->Size() >= 2 * partition->BlockSize()
&& partition->Size() / partition->BlockSize() < UINT32_MAX;
}