From d976d8c942acb831f9e69432090ec2354954299e Mon Sep 17 00:00:00 2001
From: kushalsingh007 <kushal.spiderman.singh@gmail.com>
Date: Mon, 26 Jan 2015 12:44:15 +0530
Subject: [PATCH] - Previously intel add-on allowed creation of partition
with size > 2TB, now it allows partition size and offset to be less
than 2TB. - Fixes #8990
---
src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp
index d9c1450..ae61ff0 100644
a
|
b
|
PartitionMapAddOn::CreatePartitionHandle(BMutablePartition* partition,
|
90 | 90 | bool |
91 | 91 | PartitionMapAddOn::CanInitialize(const BMutablePartition* partition) |
92 | 92 | { |
| 93 | const off_t kMBRLimit = ((off_t)1 <<32) * 512; |
| 94 | // Limit on size is (max_sector_count)*(sector size)=(2^32)*(512)=2TB. |
| 95 | |
93 | 96 | // If it's big enough, but not too big (ie. larger than 2^32 blocks) we can |
94 | | // initialize it. |
| 97 | // initialize it. Also, the highest offset of a partition should be lesser |
| 98 | // than 2TB. |
95 | 99 | return partition->Size() >= 2 * partition->BlockSize() |
96 | | && partition->Size() / partition->BlockSize() < UINT32_MAX; |
| 100 | && partition->Size() <= kMBRLimit |
| 101 | && partition->Offset() < kMBRLimit; |
97 | 102 | } |
98 | 103 | |
99 | 104 | |