[haiku-commits] r34381 - haiku/trunk/src/add-ons/kernel/partitioning_systems/intel

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 30 Nov 2009 16:56:37 +0100 (CET)

Author: axeld
Date: 2009-11-30 16:56:37 +0100 (Mon, 30 Nov 2009)
New Revision: 34381
Changeset: http://dev.haiku-os.org/changeset/34381/haiku

Modified:
   haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/Jamfile
   haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp
   haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.h
   
haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp
Log:
* 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.


Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/Jamfile
===================================================================
--- haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/Jamfile   
2009-11-30 15:42:21 UTC (rev 34380)
+++ haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/Jamfile   
2009-11-30 15:56:37 UTC (rev 34381)
@@ -11,18 +11,3 @@
        PartitionMapWriter.cpp
        write_support.cpp
 ;
-
-# Also build a userland version
-# ToDo: it's probably not a good idea to build them into the same directory
-#Addon <partitioning_system>intel :
-#      intel.cpp
-#      PartitionLocker.cpp
-#      PartitionMap.cpp
-#      PartitionMapParser.cpp
-#      PartitionMapWriter.cpp
-#;
-
-#LinkAgainst <partitioning_system>intel :
-#      libkernelland_emu.so
-#      libdisk_device_manager.so
-#;

Modified: 
haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp  
2009-11-30 15:42:21 UTC (rev 34380)
+++ haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp  
2009-11-30 15:56:37 UTC (rev 34381)
@@ -6,11 +6,13 @@
  *             Ingo Weinhold, bonefish@xxxxxxxxxxxxxxx
  */
 
+
 /*!    \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 @@
 }
 
 
-#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 @@
 }
 
 
+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
 
 

Modified: 
haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.h
===================================================================
--- haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.h    
2009-11-30 15:42:21 UTC (rev 34380)
+++ haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMap.h    
2009-11-30 15:56:37 UTC (rev 34381)
@@ -182,9 +182,7 @@
                                                                        { 
fBlockSize = blockSize; }
 
                        bool                            CheckLocation(off_t 
sessionSize) const;
-#ifdef _BOOT_MODE
-                       void                            AdjustSize(off_t 
sessionSize);
-#endif
+                       void                            FitSizeToSession(off_t 
sessionSize);
 
 private:
                        off_t                           fPartitionTableOffset;

Modified: 
haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp
===================================================================
--- 
haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp
    2009-11-30 15:42:21 UTC (rev 34380)
+++ 
haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp
    2009-11-30 15:56:37 UTC (rev 34381)
@@ -110,10 +110,9 @@
                PrimaryPartition* partition = fMap->PrimaryPartitionAt(i);
                partition->SetTo(descriptor, 0, fBlockSize);
 
-#ifdef _BOOT_MODE
-               // work-around potential BIOS problems
-               partition->AdjustSize(fSessionSize);
-#endif
+               // work-around potential BIOS/OS problems
+               partition->FitSizeToSession(fSessionSize);
+
                // ignore, if location is bad
                if (!partition->CheckLocation(fSessionSize)) {
                        TRACE(("intel: _ParsePrimary(): partition %ld: bad 
location, "


Other related posts:

  • » [haiku-commits] r34381 - haiku/trunk/src/add-ons/kernel/partitioning_systems/intel - axeld