* 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:
@@ -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(struct kernel_args *args);
|
||||||
extern status_t module_init_post_threads(void);
|
extern status_t module_init_post_threads(void);
|
||||||
|
extern status_t module_init_post_boot_device(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,6 +294,8 @@ main2(void *unused)
|
|||||||
TRACE("device_manager_init_post_modules\n");
|
TRACE("device_manager_init_post_modules\n");
|
||||||
device_manager_init_post_modules(&sKernelArgs);
|
device_manager_init_post_modules(&sKernelArgs);
|
||||||
|
|
||||||
|
module_init_post_boot_device();
|
||||||
|
|
||||||
boot_splash_set_stage(BOOT_SPLASH_STAGE_7_RUN_BOOT_SCRIPT);
|
boot_splash_set_stage(BOOT_SPLASH_STAGE_7_RUN_BOOT_SCRIPT);
|
||||||
boot_splash_uninit();
|
boot_splash_uninit();
|
||||||
// NOTE: We could introduce a syscall to draw more icons indicating
|
// NOTE: We could introduce a syscall to draw more icons indicating
|
||||||
|
|||||||
@@ -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)
|
// #pragma mark - Exported Kernel API (public part)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user