[haiku-commits] haiku: hrev47279 - src/system/boot/platform/bios_ia32

  • From: pdziepak@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 29 May 2014 22:36:37 +0200 (CEST)

hrev47279 adds 1 changeset to branch 'master'
old head: 44ec21c3ff3eb22693333ad429b1972206223754
new head: 679ad262e91e4e88e7a87943dd94fef6c57094be
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=679ad26+%5E44ec21c

----------------------------------------------------------------------------

679ad26: haiku_loader now ignores unusable drives reported by BIOS.
  
  This fixes the problem with find_unique_check_sums() taking a very long
  time to complete when one or more drives report read errors.
  
  Fixes #10880.
  
  [Paweł: minor style issue]
  Signed-off-by: Paweł Dziepak <pdziepak@xxxxxxxxxxx>

                                        [ Michał Siejak <michal@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev47279
Commit:      679ad262e91e4e88e7a87943dd94fef6c57094be
URL:         http://cgit.haiku-os.org/haiku/commit/?id=679ad26
Author:      Michał Siejak <michal@xxxxxxxxx>
Date:        Thu May 29 20:11:47 2014 UTC
Committer:   Paweł Dziepak <pdziepak@xxxxxxxxxxx>
Commit-Date: Thu May 29 20:32:15 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/10880

----------------------------------------------------------------------------

1 file changed, 18 insertions(+), 1 deletion(-)
src/system/boot/platform/bios_ia32/devices.cpp | 19 ++++++++++++++++++-

----------------------------------------------------------------------------

diff --git a/src/system/boot/platform/bios_ia32/devices.cpp 
b/src/system/boot/platform/bios_ia32/devices.cpp
index 9612578..cdb6cc9 100644
--- a/src/system/boot/platform/bios_ia32/devices.cpp
+++ b/src/system/boot/platform/bios_ia32/devices.cpp
@@ -409,6 +409,16 @@ compute_check_sum(BIOSDrive *drive, off_t offset)
        return sum;
 }
 
+/**    Checks if the specified drive is usable for reading.
+ */
+
+static bool
+is_drive_readable(BIOSDrive *drive)
+{
+       char buffer;
+       return drive->ReadAt(NULL, 0, &buffer, sizeof(buffer)) > 0;
+}
+
 
 static void
 find_unique_check_sums(NodeList *devices)
@@ -532,7 +542,14 @@ add_block_devices(NodeList *devicesList, bool 
identifierMissing)
                        continue;
                }
 
-               devicesList->Add(drive);
+               // Only add usable drives
+               if (is_drive_readable(drive))
+                       devicesList->Add(drive);
+               else {
+                       dprintf("could not read from drive %" B_PRIu8 ", not 
adding\n", driveID);
+                       delete drive;
+                       continue;
+               }
 
                if (drive->FillIdentifier() != B_OK)
                        identifierMissing = true;


Other related posts: