vfs_mount_boot_file_system() now at least checks for the right partition

offset to recognize the boot volume.
This should work well enough for now (as long as you don't have too many
disks in your system).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9965 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-11-15 20:02:04 +00:00
parent 06db250916
commit abb0fbc167
+41 -12
View File
@@ -1,10 +1,10 @@
/* /*
** Copyright 2002-2004, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2002-2004, Axel Dörfler, [email protected].
** Distributed under the terms of the Haiku License. * Distributed under the terms of the MIT License.
** *
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License. * Distributed under the terms of the NewOS License.
*/ */
/* Virtual File System and File System Interface Layer */ /* Virtual File System and File System Interface Layer */
@@ -2217,7 +2217,7 @@ vfs_bootstrap_file_systems(void)
status_t status_t
vfs_mount_boot_file_system() vfs_mount_boot_file_system(kernel_args *args)
{ {
// make the boot partition (and probably others) available // make the boot partition (and probably others) available
KDiskDeviceManager::CreateDefault(); KDiskDeviceManager::CreateDefault();
@@ -2238,11 +2238,40 @@ vfs_mount_boot_file_system()
if ((bootfs = get_file_system("bootfs")) == NULL) { if ((bootfs = get_file_system("bootfs")) == NULL) {
// no bootfs there, yet // no bootfs there, yet
// ToDo: do this for real! // ToDo: do this for real! It will currently only use the partition offset;
status_t status = _kern_mount("/boot", "/dev/disk/scsi/0/0/0/raw", // it does not yet use the disk_identifier information.
"bfs", 0, NULL); // It does also only search the first level.
if (status < B_OK)
panic("could not get boot device: %s!\n", strerror(status)); KPartition *bootPartition = NULL;
KDiskDevice *device;
int32 cookie = 0;
while ((device = manager->NextDevice(&cookie)) != NULL) {
if (device->ContainsFileSystem()
&& device->Offset() == args->boot_disk.partition_offset) {
bootPartition = device;
break;
}
for (int32 i = device->CountChildren(); i-- > 0; ) {
KPartition *partition = device->ChildAt(i);
if (partition->Offset() == args->boot_disk.partition_offset
&& partition->ContainsFileSystem()) {
bootPartition = partition;
break;
}
}
if (bootPartition != NULL)
break;
}
KPath path;
if (bootPartition == NULL
|| bootPartition->GetPath(&path) != B_OK
|| _kern_mount("/boot", path.Path(), "bfs", 0, NULL) < B_OK)
panic("could not get boot device!\n");
} else } else
put_file_system(bootfs); put_file_system(bootfs);