From dbfaf3080764f263ea2f32d9fcbd5d0505867807 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Siejak?= <michal@siejak.pl>
Date: Thu, 29 May 2014 22:11:47 +0200
Subject: [PATCH] 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.
---
src/system/boot/platform/bios_ia32/devices.cpp | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
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
|
b
|
compute_check_sum(BIOSDrive *drive, off_t offset)
|
409 | 409 | return sum; |
410 | 410 | } |
411 | 411 | |
| 412 | /** Checks if the specified drive is usable for reading. |
| 413 | */ |
| 414 | |
| 415 | static bool |
| 416 | is_drive_readable(BIOSDrive *drive) |
| 417 | { |
| 418 | char buffer; |
| 419 | return drive->ReadAt(NULL, 0, &buffer, sizeof(buffer)) > 0; |
| 420 | } |
| 421 | |
412 | 422 | |
413 | 423 | static void |
414 | 424 | find_unique_check_sums(NodeList *devices) |
… |
… |
add_block_devices(NodeList *devicesList, bool identifierMissing)
|
532 | 542 | continue; |
533 | 543 | } |
534 | 544 | |
535 | | devicesList->Add(drive); |
| 545 | // Only add usable drives |
| 546 | if (is_drive_readable(drive)) |
| 547 | devicesList->Add(drive); |
| 548 | else { |
| 549 | dprintf("could not read from drive %" B_PRIu8 ", not adding\n", driveID); |
| 550 | delete drive; |
| 551 | continue; |
| 552 | } |
536 | 553 | |
537 | 554 | if (drive->FillIdentifier() != B_OK) |
538 | 555 | identifierMissing = true; |