Added an identify_file_system() hook to the FS modules. The boot loader
does no longer give partitioning systems precedence over file systems. The one with the greater identification priority wins. ATM, if a file system wins, we still mount the first file system that recognized the partition at all, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22446 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -88,6 +88,7 @@ extern partition_module_info gIntelExtendedPartitionModule;
|
|||||||
struct file_system_module_info {
|
struct file_system_module_info {
|
||||||
const char *module_name;
|
const char *module_name;
|
||||||
const char *pretty_name;
|
const char *pretty_name;
|
||||||
|
float (*identify_file_system)(boot::Partition *device);
|
||||||
status_t (*get_file_system)(boot::Partition *device, Directory **_root);
|
status_t (*get_file_system)(boot::Partition *device, Directory **_root);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -100,6 +100,15 @@ Volume::InitCheck()
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
float
|
||||||
|
amiga_ffs_identify_file_system(boot::Partition *partition)
|
||||||
|
{
|
||||||
|
Volume volume(partition);
|
||||||
|
|
||||||
|
return volume.InitCheck() < B_OK ? 0 : 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
amiga_ffs_get_file_system(boot::Partition *partition, ::Directory **_root)
|
amiga_ffs_get_file_system(boot::Partition *partition, ::Directory **_root)
|
||||||
{
|
{
|
||||||
@@ -120,6 +129,7 @@ amiga_ffs_get_file_system(boot::Partition *partition, ::Directory **_root)
|
|||||||
file_system_module_info gAmigaFFSFileSystemModule = {
|
file_system_module_info gAmigaFFSFileSystemModule = {
|
||||||
"file_systems/amiga_ffs/v1",
|
"file_systems/amiga_ffs/v1",
|
||||||
kPartitionTypeAmigaFFS,
|
kPartitionTypeAmigaFFS,
|
||||||
|
amiga_ffs_identify_file_system,
|
||||||
amiga_ffs_get_file_system
|
amiga_ffs_get_file_system
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -132,6 +132,15 @@ Volume::ToBlockRun(off_t block) const
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
float
|
||||||
|
bfs_identify_file_system(boot::Partition *partition)
|
||||||
|
{
|
||||||
|
Volume volume(partition);
|
||||||
|
|
||||||
|
return volume.InitCheck() < B_OK ? 0 : 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
bfs_get_file_system(boot::Partition *partition, ::Directory **_root)
|
bfs_get_file_system(boot::Partition *partition, ::Directory **_root)
|
||||||
{
|
{
|
||||||
@@ -152,6 +161,7 @@ bfs_get_file_system(boot::Partition *partition, ::Directory **_root)
|
|||||||
file_system_module_info gBFSFileSystemModule = {
|
file_system_module_info gBFSFileSystemModule = {
|
||||||
"file_systems/bfs/v1",
|
"file_systems/bfs/v1",
|
||||||
kPartitionTypeBFS,
|
kPartitionTypeBFS,
|
||||||
|
bfs_identify_file_system,
|
||||||
bfs_get_file_system
|
bfs_get_file_system
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ hfs_plus_get_file_system(boot::Partition *partition, ::Directory **_root)
|
|||||||
file_system_module_info gAmigaFFSFileSystemModule = {
|
file_system_module_info gAmigaFFSFileSystemModule = {
|
||||||
"file_systems/hfs_plus/v1",
|
"file_systems/hfs_plus/v1",
|
||||||
kPartitionTypeHFSPlus,
|
kPartitionTypeHFSPlus,
|
||||||
|
NULL,
|
||||||
hfs_plus_get_file_system
|
hfs_plus_get_file_system
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -813,6 +813,7 @@ tarfs_get_file_system(boot::Partition *partition, ::Directory **_root)
|
|||||||
file_system_module_info gTarFileSystemModule = {
|
file_system_module_info gTarFileSystemModule = {
|
||||||
"file_systems/tarfs/v1",
|
"file_systems/tarfs/v1",
|
||||||
kPartitionTypeTarFS,
|
kPartitionTypeTarFS,
|
||||||
|
NULL, // identify_file_system
|
||||||
tarfs_get_file_system
|
tarfs_get_file_system
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -271,8 +271,26 @@ Partition::Scan(bool mountFileSystems, bool isBootDevice)
|
|||||||
bestPriority = priority;
|
bestPriority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// find the best FS module
|
||||||
|
const file_system_module_info *bestFSModule = NULL;
|
||||||
|
float bestFSPriority = -1;
|
||||||
|
for (int32 i = 0; i < sNumFileSystemModules; i++) {
|
||||||
|
if (sFileSystemModules[i]->identify_file_system == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
float priority = sFileSystemModules[i]->identify_file_system(this);
|
||||||
|
if (priority <= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (priority > bestFSPriority) {
|
||||||
|
bestFSModule = sFileSystemModules[i];
|
||||||
|
bestFSPriority = priority;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// now let the best matching disk system scan the partition
|
// now let the best matching disk system scan the partition
|
||||||
if (bestModule) {
|
if (bestModule && bestPriority >= bestFSPriority) {
|
||||||
NodeOpener opener(this, O_RDONLY);
|
NodeOpener opener(this, O_RDONLY);
|
||||||
status_t status = bestModule->scan_partition(opener.Descriptor(), this,
|
status_t status = bestModule->scan_partition(opener.Descriptor(), this,
|
||||||
bestCookie);
|
bestCookie);
|
||||||
@@ -323,8 +341,11 @@ Partition::Scan(bool mountFileSystems, bool isBootDevice)
|
|||||||
|
|
||||||
// scan for file systems
|
// scan for file systems
|
||||||
|
|
||||||
if (mountFileSystems)
|
if (mountFileSystems) {
|
||||||
|
// TODO: Use the FS module we've got, if any. Requires to implement the
|
||||||
|
// identify_file_system() hook in every FS.
|
||||||
return Mount();
|
return Mount();
|
||||||
|
}
|
||||||
|
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user