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_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_add_block_devices(struct stage2_args *args, NodeList *devicesList);
|
||||||
extern status_t platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
|
extern status_t platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
|
||||||
NodeList *partitions, NodeList *bootPartitions);
|
NodeList *partitions, boot::Partition **_partition);
|
||||||
extern status_t platform_register_boot_device(Node *device);
|
extern status_t platform_register_boot_device(Node *device);
|
||||||
extern void platform_cleanup_devices();
|
extern void platform_cleanup_devices();
|
||||||
|
|
||||||
|
|||||||
@@ -659,33 +659,28 @@ get_boot_file_system(stage2_args* args, BootVolume& _bootVolume)
|
|||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
NodeList bootPartitions;
|
Partition *partition;
|
||||||
error = platform_get_boot_partitions(args, device, &gPartitions, &bootPartitions);
|
error = platform_get_boot_partition(args, device, &gPartitions, &partition);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
NodeIterator partitionIterator = bootPartitions.GetIterator();
|
Directory *fileSystem;
|
||||||
while (partitionIterator.HasNext()) {
|
error = partition->Mount(&fileSystem, true);
|
||||||
Partition *partition = (Partition*)partitionIterator.Next();
|
if (error != B_OK) {
|
||||||
|
// this partition doesn't contain any known file system; we
|
||||||
Directory *fileSystem;
|
// don't need it anymore
|
||||||
error = partition->Mount(&fileSystem, true);
|
gPartitions.Remove(partition);
|
||||||
if (error != B_OK) {
|
delete partition;
|
||||||
// this partition doesn't contain any known file system; we
|
continue;
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// init the BootVolume
|
||||||
|
error = _bootVolume.SetTo(fileSystem);
|
||||||
|
if (error != B_OK)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
sBootDevice = device;
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|||||||
@@ -168,8 +168,8 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
|
platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
|
||||||
NodeList *list, NodeList *partitions)
|
NodeList *list, boot::Partition **_partition)
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|||||||
@@ -1189,8 +1189,8 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
|
platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
|
||||||
NodeList *list, NodeList *partitionList)
|
NodeList *list, boot::Partition **_partition)
|
||||||
{
|
{
|
||||||
BlockHandle *drive = static_cast<BlockHandle *>(bootDevice);
|
BlockHandle *drive = static_cast<BlockHandle *>(bootDevice);
|
||||||
off_t offset = (off_t)gBootPartitionOffset * drive->BlockSize();
|
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
|
// offset as reported by the BFS boot block
|
||||||
if (offset >= partition->offset
|
if (offset >= partition->offset
|
||||||
&& offset < partition->offset + partition->size) {
|
&& offset < partition->offset + partition->size) {
|
||||||
partitionList->Insert(partition);
|
*_partition = partition;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -877,8 +877,8 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
|
platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
|
||||||
NodeList *list, NodeList *bootList)
|
NodeList *list, boot::Partition **_partition)
|
||||||
{
|
{
|
||||||
BIOSDrive *drive = static_cast<BIOSDrive *>(bootDevice);
|
BIOSDrive *drive = static_cast<BIOSDrive *>(bootDevice);
|
||||||
off_t offset = (off_t)gBootPartitionOffset * drive->BlockSize();
|
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
|
// offset as reported by the BFS boot block
|
||||||
if (offset >= partition->offset
|
if (offset >= partition->offset
|
||||||
&& offset < partition->offset + partition->size) {
|
&& offset < partition->offset + partition->size) {
|
||||||
bootList->Insert(partition);
|
*_partition = partition;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -474,7 +474,7 @@ device_contains_partition(EfiDevice *device, boot::Partition *partition)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((partition->offset + partition->size) <= device->Size())
|
if ((partition->offset + partition->size) <= device->Size())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -516,19 +516,19 @@ platform_add_block_devices(struct stage2_args *args, NodeList *devicesList)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
|
platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
|
||||||
NodeList *partitions, NodeList *bootPartitions)
|
NodeList *partitions, boot::Partition **_partition)
|
||||||
{
|
{
|
||||||
NodeIterator iterator = partitions->GetIterator();
|
NodeIterator iterator = partitions->GetIterator();
|
||||||
boot::Partition *partition = NULL;
|
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)) {
|
if (device_contains_partition((EfiDevice*)bootDevice, partition)) {
|
||||||
iterator.Remove();
|
*_partition = partition;
|
||||||
bootPartitions->Insert(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
|
status_t
|
||||||
platform_get_boot_partitions(struct stage2_args *args, Node *device,
|
platform_get_boot_partition(struct stage2_args *args, Node *device,
|
||||||
NodeList *list, NodeList *partitionList)
|
NodeList *list, boot::Partition **_partition)
|
||||||
{
|
{
|
||||||
NodeIterator iterator = list->GetIterator();
|
NodeIterator iterator = list->GetIterator();
|
||||||
boot::Partition *partition = NULL;
|
boot::Partition *partition = NULL;
|
||||||
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
|
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
|
||||||
// ToDo: just take the first partition for now
|
// ToDo: just take the first partition for now
|
||||||
partitionList->Insert(partition);
|
*_partition = partition;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,15 +118,15 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
platform_get_boot_partitions(struct stage2_args *args, Node *device,
|
platform_get_boot_partition(struct stage2_args *args, Node *device,
|
||||||
NodeList *list, NodeList *partitionList)
|
NodeList *list, boot::Partition **_partition)
|
||||||
{
|
{
|
||||||
TRACE("platform_get_boot_partition\n");
|
TRACE("platform_get_boot_partition\n");
|
||||||
NodeIterator iterator = list->GetIterator();
|
NodeIterator iterator = list->GetIterator();
|
||||||
boot::Partition *partition = NULL;
|
boot::Partition *partition = NULL;
|
||||||
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
|
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
|
||||||
// ToDo: just take the first partition for now
|
// ToDo: just take the first partition for now
|
||||||
partitionList->Insert(partition);
|
*_partition = partition;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
platform_get_boot_partitions(struct stage2_args *args, Node *device,
|
platform_get_boot_partition(struct stage2_args *args, Node *device,
|
||||||
NodeList *list, NodeList *partitionList)
|
NodeList *list, boot::Partition **_partition)
|
||||||
{
|
{
|
||||||
TRACE("platform_get_boot_partition\n");
|
TRACE("platform_get_boot_partition\n");
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ platform_get_boot_partitions(struct stage2_args *args, Node *device,
|
|||||||
boot::Partition *partition = NULL;
|
boot::Partition *partition = NULL;
|
||||||
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
|
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
|
||||||
// ToDo: just take the first partition for now
|
// ToDo: just take the first partition for now
|
||||||
partitionList->Insert(partition);
|
*_partition = partition;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user