* 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:
Ingo Weinhold
2008-09-28 13:25:43 +00:00
parent eb6a1cbc4c
commit abe717da05
+2 -14
View File
@@ -431,7 +431,6 @@ load_module_image(const char* path, module_image** _moduleImage)
moduleImage->image = image;
moduleImage->ref_count = 0;
TRACE(("load_module_image() inserting image %p, %s\n", moduleImage, moduleImage->path));
hash_insert(sModuleImagesHash, 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)
{
TRACE(("unload_module_image() removing image %p, %s\n", moduleImage, moduleImage->path));
hash_remove(sModuleImagesHash, moduleImage);
}
unload_kernel_add_on(moduleImage->image);
free(moduleImage->path);
@@ -1135,7 +1131,6 @@ register_preloaded_module_image(struct preloaded_image* image)
moduleImage->image = image->id;
moduleImage->ref_count = 0;
TRACE(("register_preloaded_module_image() inserting image %p, %s\n", moduleImage, moduleImage->path));
hash_insert(sModuleImagesHash, moduleImage);
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
// from, we get the actual paths for those images.
TRACE(("module_init_post_boot_device(%d)\n", bootingFromBootLoaderVolume));
#ifdef TRACE_MODULE
hash_dump_table(sModuleImagesHash);
#endif
RecursiveLocker _(sModulesLock);
@@ -1949,13 +1941,9 @@ hash_dump_table(sModuleImagesHash);
// re-insert the images that have got a new path
while (module_image* image = imagesToReinsert) {
imagesToReinsert = image->next;
TRACE(("module_init_post_boot_device() re-inserting image %p, %s\n", image, image->path));
hash_insert(sModuleImagesHash, image);
}
#ifdef TRACE_MODULE
hash_dump_table(sModuleImagesHash);
#endif
TRACE(("module_init_post_boot_device() done\n"));
return B_OK;
@@ -2217,8 +2205,8 @@ get_module(const char* path, module_info** _info)
if (module->ref_count == 0) {
status = init_module(module);
// For "keep loaded" modules we increment the ref count here. That will
// cause it never to get unloaded.
if ((module->flags & B_KEEP_LOADED) != 0)
// cause them never to get unloaded.
if (status == B_OK && (module->flags & B_KEEP_LOADED) != 0)
module->ref_count++;
} else
status = B_OK;