Revert "loader: fetch all potential boot partitions for boot device."
This reverts commit e888217124.
Change-Id: I06be82ac863f615796d9edc86f5ef903b8123a9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2231
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
2b19786285
commit
0d932a49ad
@@ -58,8 +58,8 @@ namespace boot {
|
||||
|
||||
extern status_t platform_add_boot_device(struct stage2_args *args, NodeList *devicesList);
|
||||
extern status_t platform_add_block_devices(struct stage2_args *args, NodeList *devicesList);
|
||||
extern status_t platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
|
||||
NodeList *partitions, NodeList *bootPartitions);
|
||||
extern status_t platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
|
||||
NodeList *partitions, boot::Partition **_partition);
|
||||
extern status_t platform_register_boot_device(Node *device);
|
||||
extern void platform_cleanup_devices();
|
||||
|
||||
|
||||
@@ -659,33 +659,28 @@ get_boot_file_system(stage2_args* args, BootVolume& _bootVolume)
|
||||
if (error != B_OK)
|
||||
continue;
|
||||
|
||||
NodeList bootPartitions;
|
||||
error = platform_get_boot_partitions(args, device, &gPartitions, &bootPartitions);
|
||||
Partition *partition;
|
||||
error = platform_get_boot_partition(args, device, &gPartitions, &partition);
|
||||
if (error != B_OK)
|
||||
continue;
|
||||
|
||||
NodeIterator partitionIterator = bootPartitions.GetIterator();
|
||||
while (partitionIterator.HasNext()) {
|
||||
Partition *partition = (Partition*)partitionIterator.Next();
|
||||
|
||||
Directory *fileSystem;
|
||||
error = partition->Mount(&fileSystem, true);
|
||||
if (error != B_OK) {
|
||||
// this partition doesn't contain any known file system; we
|
||||
// don't need it anymore
|
||||
gPartitions.Remove(partition);
|
||||
delete partition;
|
||||
continue;
|
||||
}
|
||||
|
||||
// init the BootVolume
|
||||
error = _bootVolume.SetTo(fileSystem);
|
||||
if (error != B_OK)
|
||||
continue;
|
||||
|
||||
sBootDevice = device;
|
||||
return B_OK;
|
||||
Directory *fileSystem;
|
||||
error = partition->Mount(&fileSystem, true);
|
||||
if (error != B_OK) {
|
||||
// this partition doesn't contain any known file system; we
|
||||
// don't need it anymore
|
||||
gPartitions.Remove(partition);
|
||||
delete partition;
|
||||
continue;
|
||||
}
|
||||
|
||||
// init the BootVolume
|
||||
error = _bootVolume.SetTo(fileSystem);
|
||||
if (error != B_OK)
|
||||
continue;
|
||||
|
||||
sBootDevice = device;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
return B_ERROR;
|
||||
|
||||
@@ -168,8 +168,8 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
||||
|
||||
|
||||
status_t
|
||||
platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
|
||||
NodeList *list, NodeList *partitions)
|
||||
platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
|
||||
NodeList *list, boot::Partition **_partition)
|
||||
{
|
||||
|
||||
//TODO
|
||||
|
||||
@@ -1189,8 +1189,8 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
||||
|
||||
|
||||
status_t
|
||||
platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
|
||||
NodeList *list, NodeList *partitionList)
|
||||
platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
|
||||
NodeList *list, boot::Partition **_partition)
|
||||
{
|
||||
BlockHandle *drive = static_cast<BlockHandle *>(bootDevice);
|
||||
off_t offset = (off_t)gBootPartitionOffset * drive->BlockSize();
|
||||
@@ -1205,7 +1205,7 @@ platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
|
||||
// offset as reported by the BFS boot block
|
||||
if (offset >= partition->offset
|
||||
&& offset < partition->offset + partition->size) {
|
||||
partitionList->Insert(partition);
|
||||
*_partition = partition;
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -877,8 +877,8 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
||||
|
||||
|
||||
status_t
|
||||
platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
|
||||
NodeList *list, NodeList *bootList)
|
||||
platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
|
||||
NodeList *list, boot::Partition **_partition)
|
||||
{
|
||||
BIOSDrive *drive = static_cast<BIOSDrive *>(bootDevice);
|
||||
off_t offset = (off_t)gBootPartitionOffset * drive->BlockSize();
|
||||
@@ -893,7 +893,7 @@ platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
|
||||
// offset as reported by the BFS boot block
|
||||
if (offset >= partition->offset
|
||||
&& offset < partition->offset + partition->size) {
|
||||
bootList->Insert(partition);
|
||||
*_partition = partition;
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ device_contains_partition(EfiDevice *device, boot::Partition *partition)
|
||||
}
|
||||
|
||||
if ((partition->offset + partition->size) <= device->Size())
|
||||
return true;
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -516,19 +516,19 @@ platform_add_block_devices(struct stage2_args *args, NodeList *devicesList)
|
||||
|
||||
|
||||
status_t
|
||||
platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
|
||||
NodeList *partitions, NodeList *bootPartitions)
|
||||
platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
|
||||
NodeList *partitions, boot::Partition **_partition)
|
||||
{
|
||||
NodeIterator iterator = partitions->GetIterator();
|
||||
boot::Partition *partition = NULL;
|
||||
while ((partition = (boot::Partition*)iterator.Next()) != NULL) {
|
||||
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
|
||||
if (device_contains_partition((EfiDevice*)bootDevice, partition)) {
|
||||
iterator.Remove();
|
||||
bootPartitions->Insert(partition);
|
||||
*_partition = partition;
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return bootPartitions->Count() > 0 ? B_OK : B_ENTRY_NOT_FOUND;
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -117,14 +117,14 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
||||
|
||||
|
||||
status_t
|
||||
platform_get_boot_partitions(struct stage2_args *args, Node *device,
|
||||
NodeList *list, NodeList *partitionList)
|
||||
platform_get_boot_partition(struct stage2_args *args, Node *device,
|
||||
NodeList *list, boot::Partition **_partition)
|
||||
{
|
||||
NodeIterator iterator = list->GetIterator();
|
||||
boot::Partition *partition = NULL;
|
||||
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
|
||||
// ToDo: just take the first partition for now
|
||||
partitionList->Insert(partition);
|
||||
*_partition = partition;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,15 +118,15 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
||||
|
||||
|
||||
status_t
|
||||
platform_get_boot_partitions(struct stage2_args *args, Node *device,
|
||||
NodeList *list, NodeList *partitionList)
|
||||
platform_get_boot_partition(struct stage2_args *args, Node *device,
|
||||
NodeList *list, boot::Partition **_partition)
|
||||
{
|
||||
TRACE("platform_get_boot_partition\n");
|
||||
NodeIterator iterator = list->GetIterator();
|
||||
boot::Partition *partition = NULL;
|
||||
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
|
||||
// ToDo: just take the first partition for now
|
||||
partitionList->Insert(partition);
|
||||
*_partition = partition;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
||||
|
||||
|
||||
status_t
|
||||
platform_get_boot_partitions(struct stage2_args *args, Node *device,
|
||||
NodeList *list, NodeList *partitionList)
|
||||
platform_get_boot_partition(struct stage2_args *args, Node *device,
|
||||
NodeList *list, boot::Partition **_partition)
|
||||
{
|
||||
TRACE("platform_get_boot_partition\n");
|
||||
|
||||
@@ -57,7 +57,7 @@ platform_get_boot_partitions(struct stage2_args *args, Node *device,
|
||||
boot::Partition *partition = NULL;
|
||||
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
|
||||
// ToDo: just take the first partition for now
|
||||
partitionList->Insert(partition);
|
||||
*_partition = partition;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user