* Apparently, a drive's size is not always reported the same; at least I have
a drive (which had its MBR created on Linux) report a smaller size than the size of its first partition. * Since other operating systems seem to ignore this, we now relax our validity checks and always adjust the size of a child partition to fit into its parent. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34381 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -6,11 +6,13 @@
|
||||
* Ingo Weinhold, [email protected]
|
||||
*/
|
||||
|
||||
|
||||
/*! \file PartitionMap.cpp
|
||||
\brief Definitions for "intel" style partitions and implementation
|
||||
of related classes.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -356,19 +358,6 @@ Partition::Unset()
|
||||
}
|
||||
|
||||
|
||||
#ifdef _BOOT_MODE
|
||||
void
|
||||
Partition::AdjustSize(off_t sessionSize)
|
||||
{
|
||||
// To work around buggy (or older) BIOS, we shrink the partition size to
|
||||
// always fit into its session - this should improve detection of boot
|
||||
// partitions (see bug #238 for more information)
|
||||
if (sessionSize < fOffset + fSize && sessionSize > fOffset)
|
||||
fSize = sessionSize - fOffset;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool
|
||||
Partition::CheckLocation(off_t sessionSize) const
|
||||
{
|
||||
@@ -410,6 +399,20 @@ Partition::CheckLocation(off_t sessionSize) const
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Partition::FitSizeToSession(off_t sessionSize)
|
||||
{
|
||||
// To work around buggy (or older) BIOS, we shrink the partition size to
|
||||
// always fit into its session - this should improve detection of boot
|
||||
// partitions (see bug #238 for more information).
|
||||
// Also, the drive size is obviously reported differently sometimes; this
|
||||
// should let us read problematic drives - let the file system figure out
|
||||
// if something is wrong.
|
||||
if (sessionSize < fOffset + fSize && sessionSize > fOffset)
|
||||
fSize = sessionSize - fOffset;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - PrimaryPartition
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user