* When the initialization of a B_KEEP_LOADED module failed, it was kept
loaded anyway, causing bug #2776. * Removed temporary debug output. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27767 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -431,7 +431,6 @@ load_module_image(const char* path, module_image** _moduleImage)
|
|||||||
moduleImage->image = image;
|
moduleImage->image = image;
|
||||||
moduleImage->ref_count = 0;
|
moduleImage->ref_count = 0;
|
||||||
|
|
||||||
TRACE(("load_module_image() inserting image %p, %s\n", moduleImage, moduleImage->path));
|
|
||||||
hash_insert(sModuleImagesHash, moduleImage);
|
hash_insert(sModuleImagesHash, moduleImage);
|
||||||
|
|
||||||
TRACE(("load_module_image(\"%s\"): image loaded: %p\n", path, moduleImage));
|
TRACE(("load_module_image(\"%s\"): image loaded: %p\n", path, moduleImage));
|
||||||
@@ -464,10 +463,7 @@ unload_module_image(module_image* moduleImage, bool remove)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (remove)
|
if (remove)
|
||||||
{
|
|
||||||
TRACE(("unload_module_image() removing image %p, %s\n", moduleImage, moduleImage->path));
|
|
||||||
hash_remove(sModuleImagesHash, moduleImage);
|
hash_remove(sModuleImagesHash, moduleImage);
|
||||||
}
|
|
||||||
|
|
||||||
unload_kernel_add_on(moduleImage->image);
|
unload_kernel_add_on(moduleImage->image);
|
||||||
free(moduleImage->path);
|
free(moduleImage->path);
|
||||||
@@ -1135,7 +1131,6 @@ register_preloaded_module_image(struct preloaded_image* image)
|
|||||||
moduleImage->image = image->id;
|
moduleImage->image = image->id;
|
||||||
moduleImage->ref_count = 0;
|
moduleImage->ref_count = 0;
|
||||||
|
|
||||||
TRACE(("register_preloaded_module_image() inserting image %p, %s\n", moduleImage, moduleImage->path));
|
|
||||||
hash_insert(sModuleImagesHash, moduleImage);
|
hash_insert(sModuleImagesHash, moduleImage);
|
||||||
|
|
||||||
for (info = moduleImage->info; *info; info++) {
|
for (info = moduleImage->info; *info; info++) {
|
||||||
@@ -1841,9 +1836,6 @@ module_init_post_boot_device(bool bootingFromBootLoaderVolume)
|
|||||||
// When the boot volume is also where the boot loader pre-loaded the images
|
// When the boot volume is also where the boot loader pre-loaded the images
|
||||||
// from, we get the actual paths for those images.
|
// from, we get the actual paths for those images.
|
||||||
TRACE(("module_init_post_boot_device(%d)\n", bootingFromBootLoaderVolume));
|
TRACE(("module_init_post_boot_device(%d)\n", bootingFromBootLoaderVolume));
|
||||||
#ifdef TRACE_MODULE
|
|
||||||
hash_dump_table(sModuleImagesHash);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RecursiveLocker _(sModulesLock);
|
RecursiveLocker _(sModulesLock);
|
||||||
|
|
||||||
@@ -1949,13 +1941,9 @@ hash_dump_table(sModuleImagesHash);
|
|||||||
// re-insert the images that have got a new path
|
// re-insert the images that have got a new path
|
||||||
while (module_image* image = imagesToReinsert) {
|
while (module_image* image = imagesToReinsert) {
|
||||||
imagesToReinsert = image->next;
|
imagesToReinsert = image->next;
|
||||||
TRACE(("module_init_post_boot_device() re-inserting image %p, %s\n", image, image->path));
|
|
||||||
hash_insert(sModuleImagesHash, image);
|
hash_insert(sModuleImagesHash, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRACE_MODULE
|
|
||||||
hash_dump_table(sModuleImagesHash);
|
|
||||||
#endif
|
|
||||||
TRACE(("module_init_post_boot_device() done\n"));
|
TRACE(("module_init_post_boot_device() done\n"));
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -2217,8 +2205,8 @@ get_module(const char* path, module_info** _info)
|
|||||||
if (module->ref_count == 0) {
|
if (module->ref_count == 0) {
|
||||||
status = init_module(module);
|
status = init_module(module);
|
||||||
// For "keep loaded" modules we increment the ref count here. That will
|
// For "keep loaded" modules we increment the ref count here. That will
|
||||||
// cause it never to get unloaded.
|
// cause them never to get unloaded.
|
||||||
if ((module->flags & B_KEEP_LOADED) != 0)
|
if (status == B_OK && (module->flags & B_KEEP_LOADED) != 0)
|
||||||
module->ref_count++;
|
module->ref_count++;
|
||||||
} else
|
} else
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user