added disk systems rescan to DiskDeviceManager, and called it in the post init phase

the next step would be to rescan the partition tree with a job to recognize unrecognized partitions (asynchronously ?)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18737 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2006-09-04 12:37:56 +00:00
parent 5b0f7b1b1e
commit d564275ba7
5 changed files with 55 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
/*
* Copyright 2006, Jerome Duval. All rights reserved.
* Distributed under the terms of the MIT License.
*
*/
#ifndef _KERNEL_DDM_H
#define _KERNEL_DDM_H
#ifdef __cplusplus
extern "C" {
#endif
status_t ddm_init_post_modules(struct kernel_args *args);
#ifdef __cplusplus
}
#endif
#endif /* _KERNEL_DDM_H */
@@ -120,6 +120,7 @@ public:
// by the registrar.
status_t InitialDeviceScan();
status_t RescanDiskSystems();
private:
status_t _AddPartitioningSystem(const char *name);
@@ -929,6 +929,31 @@ KDiskDeviceManager::InitialDeviceScan()
return error;
}
//RescanDiskSystems
status_t
KDiskDeviceManager::RescanDiskSystems()
{
// load file systems list
void *cookie = open_module_list(kFileSystemPrefix);
while (true) {
char name[B_FILE_NAME_LENGTH];
size_t nameLength = sizeof(name);
module_info *module;
if (read_next_module_name(cookie, name, &nameLength) != B_OK)
break;
if (FindDiskSystem(name))
continue;
_AddFileSystem(name);
}
close_module_list(cookie);
// TODO rescan partition tree for unrecognized partitions
return B_OK;
}
// _AddPartitioningSystem
status_t
KDiskDeviceManager::_AddPartitioningSystem(const char *name)
@@ -3,6 +3,7 @@
#include <KernelExport.h>
#include <stdio.h>
#include "ddm.h"
#include "disk_device_manager.h"
#include "KDiskDevice.h"
#include "KDiskDeviceJob.h"
@@ -273,3 +274,10 @@ update_disk_device_job_interrupt_properties(disk_job_id jobID,
return B_DISK_DEVICE_JOB_CONTINUE;
}
status_t
ddm_init_post_modules(kernel_args *args)
{
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
return manager->RescanDiskSystems();
}
+2
View File
@@ -16,6 +16,7 @@
#include <cbuf.h>
#include <cpu.h>
#include <debug.h>
#include <ddm.h>
#include <elf.h>
#include <int.h>
#include <kdevice_manager.h>
@@ -227,6 +228,7 @@ main2(void *unused)
cpu_init_post_modules(&sKernelArgs);
vm_init_post_modules(&sKernelArgs);
debug_init_post_modules(&sKernelArgs);
ddm_init_post_modules(&sKernelArgs);
// start the init process
{