boot loader: Fix find_unique_check_sums()

Comparing the complete disk_identifer structure isn't helpful as long as
we don't (can't) compare it in the kernel as well. ATM we only check the
check sums there, so that's what we need to do here as well. This fixes
potential mix-ups when booting off one of multiple equally sized disks.
This commit is contained in:
Ingo Weinhold
2013-10-26 02:48:18 +02:00
parent 63d56be3d9
commit 7b1dee3929
@@ -451,11 +451,24 @@ find_unique_check_sums(NodeList *devices)
|| compareDrive->Identifier().device_type != UNKNOWN_DEVICE)
continue;
// TODO: Until we can actually get and compare *all* fields of the disk
// identifier in the kernel, we cannot compare the whole structure (we also
// should be more careful zeroing the structure before we fill it).
#if 0
if (!memcmp(&drive->Identifier(), &compareDrive->Identifier(),
sizeof(disk_identifier))) {
clash = true;
break;
}
#else
const disk_identifier& ourId = drive->Identifier();
const disk_identifier& otherId = compareDrive->Identifier();
if (memcmp(&ourId.device.unknown.check_sums,
&otherId.device.unknown.check_sums,
sizeof(ourId.device.unknown.check_sums)) == 0) {
clash = true;
}
#endif
}
if (clash)