Some improvements to the previous changes made to vfs_boot.cpp suggested by Ingo.
This commit is contained in:
parent
d8efc6caf6
commit
5915eeb461
@ -54,8 +54,6 @@ static struct {
|
||||
{NULL}
|
||||
};
|
||||
|
||||
static int32 sBootMethodType;
|
||||
|
||||
// This can be used by other code to see if there is a boot file system already
|
||||
dev_t gBootDevice = -1;
|
||||
bool gReadOnlyBootDevice = false;
|
||||
@ -322,30 +320,27 @@ DiskBootMethod::SortPartitions(KPartition** partitions, int32 count)
|
||||
The boot code should then just try them one by one.
|
||||
*/
|
||||
static status_t
|
||||
get_boot_partitions(kernel_args* args, PartitionStack& partitions)
|
||||
get_boot_partitions(KMessage &bootVolume, PartitionStack& partitions)
|
||||
{
|
||||
KMessage bootVolume;
|
||||
bootVolume.SetTo(args->boot_volume, args->boot_volume_size);
|
||||
|
||||
dprintf("get_boot_partitions(): boot volume message:\n");
|
||||
bootVolume.Dump(&dprintf);
|
||||
|
||||
// create boot method
|
||||
sBootMethodType = bootVolume.GetInt32(BOOT_METHOD, BOOT_METHOD_DEFAULT);
|
||||
int32 bootMethodType = bootVolume.GetInt32(BOOT_METHOD, BOOT_METHOD_DEFAULT);
|
||||
dprintf("get_boot_partitions(): boot method type: %" B_PRId32 "\n",
|
||||
sBootMethodType);
|
||||
bootMethodType);
|
||||
|
||||
BootMethod* bootMethod = NULL;
|
||||
switch (sBootMethodType) {
|
||||
switch (bootMethodType) {
|
||||
case BOOT_METHOD_NET:
|
||||
bootMethod = new(nothrow) NetBootMethod(bootVolume, sBootMethodType);
|
||||
bootMethod = new(nothrow) NetBootMethod(bootVolume, bootMethodType);
|
||||
break;
|
||||
|
||||
case BOOT_METHOD_HARD_DISK:
|
||||
case BOOT_METHOD_CD:
|
||||
default:
|
||||
bootMethod = new(nothrow) DiskBootMethod(bootVolume,
|
||||
sBootMethodType);
|
||||
bootMethodType);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -464,8 +459,11 @@ vfs_bootstrap_file_systems(void)
|
||||
void
|
||||
vfs_mount_boot_file_system(kernel_args* args)
|
||||
{
|
||||
KMessage bootVolume;
|
||||
bootVolume.SetTo(args->boot_volume, args->boot_volume_size);
|
||||
|
||||
PartitionStack partitions;
|
||||
status_t status = get_boot_partitions(args, partitions);
|
||||
status_t status = get_boot_partitions(bootVolume, partitions);
|
||||
if (status < B_OK) {
|
||||
panic("get_boot_partitions failed!");
|
||||
}
|
||||
@ -516,8 +514,9 @@ vfs_mount_boot_file_system(kernel_args* args)
|
||||
// whether the module images the boot loader has pre-loaded are the same as
|
||||
// on the boot volume. That is the case when booting from hard disk or CD,
|
||||
// but not via network.
|
||||
bool bootingFromBootLoaderVolume = sBootMethodType == BOOT_METHOD_HARD_DISK
|
||||
|| sBootMethodType == BOOT_METHOD_CD;
|
||||
int32 bootMethodType = bootVolume.GetInt32(BOOT_METHOD, BOOT_METHOD_DEFAULT);
|
||||
bool bootingFromBootLoaderVolume = bootMethodType == BOOT_METHOD_HARD_DISK
|
||||
|| bootMethodType == BOOT_METHOD_CD;
|
||||
module_init_post_boot_device(bootingFromBootLoaderVolume);
|
||||
|
||||
file_cache_init_post_boot_device();
|
||||
|
Loading…
Reference in New Issue
Block a user