* Added a post boot device module init function that unloads all unused modules,

as they aren't unloaded when there is no boot device yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27136 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-08-22 09:41:10 +00:00
parent dcd8c085ed
commit 5a123e3591
3 changed files with 25 additions and 0 deletions
+1
View File
@@ -31,6 +31,7 @@ extern status_t load_module(const char *path, module_info ***_modules);
extern status_t module_init(struct kernel_args *args);
extern status_t module_init_post_threads(void);
extern status_t module_init_post_boot_device(void);
#ifdef __cplusplus
}
+2
View File
@@ -294,6 +294,8 @@ main2(void *unused)
TRACE("device_manager_init_post_modules\n");
device_manager_init_post_modules(&sKernelArgs);
module_init_post_boot_device();
boot_splash_set_stage(BOOT_SPLASH_STAGE_7_RUN_BOOT_SCRIPT);
boot_splash_uninit();
// NOTE: We could introduce a syscall to draw more icons indicating
+22
View File
@@ -1836,6 +1836,28 @@ module_init_post_threads(void)
}
status_t
module_init_post_boot_device(void)
{
RecursiveLocker locker(sModulesLock);
hash_iterator iterator;
hash_open(sModuleImagesHash, &iterator);
while (true) {
struct module_image* image
= (struct module_image*)hash_next(sModuleImagesHash, &iterator);
if (image == NULL)
break;
if (image->ref_count == 0 && !image->keep_loaded)
unload_module_image(image, NULL);
}
return B_OK;
}
// #pragma mark - Exported Kernel API (public part)