コード例 #1
0
Directory *
get_boot_file_system(stage2_args *args)
{
    Node *device;
    if (platform_add_boot_device(args, &gBootDevices) < B_OK)
        return NULL;

    // the boot device must be the first device in the list
    device = gBootDevices.First();

    if (add_partitions_for(device, false, true) < B_OK)
        return NULL;

    Partition *partition;
    if (platform_get_boot_partition(args, device, &gPartitions, &partition) < B_OK)
        return NULL;

    Directory *fileSystem;
    status_t status = partition->Mount(&fileSystem, true);

    if (status < B_OK) {
        // this partition doesn't contain any known file system; we
        // don't need it anymore
        gPartitions.Remove(partition);
        delete partition;
        return NULL;
    }

    sBootDevice = device;
    return fileSystem;
}
コード例 #2
0
ファイル: vfs.cpp プロジェクト: jessicah/haiku-private
/*! Gets the boot device, scans all of its partitions, gets the
	boot partition, and mounts its file system.

	\param args The stage 2 arguments.
	\param _bootVolume On success set to the boot volume.
	\return \c B_OK on success, another error code otherwise.
*/
status_t
get_boot_file_system(stage2_args* args, BootVolume& _bootVolume)
{
	Node *device;
	status_t error = platform_add_boot_device(args, &gBootDevices);
	if (error != B_OK)
		return error;

	// the boot device must be the first device in the list
	device = gBootDevices.First();

	error = add_partitions_for(device, false, true);
	if (error != B_OK)
		return error;

	Partition *partition;
	error = platform_get_boot_partition(args, device, &gPartitions, &partition);
	if (error != B_OK)
		return error;

	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;
		return error;
	}

	// init the BootVolume
	error = _bootVolume.SetTo(fileSystem);
	if (error != B_OK)
		return error;

	sBootDevice = device;
	return B_OK;
}