haiku/headers/private/kernel/kmodule.h

41 lines
883 B
C
Raw Normal View History

/*
* Copyright 2005-2008, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_MODULE_H
#define _KERNEL_MODULE_H
#include <drivers/module.h>
#include <kernel.h>
struct kernel_args;
#ifdef __cplusplus
// C++ only part
class NotificationListener;
extern status_t start_watching_modules(const char *prefix,
NotificationListener &listener);
extern status_t stop_watching_modules(const char *prefix,
NotificationListener &listener);
extern "C" {
#endif
extern status_t unload_module(const char *path);
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);
* Call module_init_post_boot_device() right after the boot volume has been mounted, before anyone could try to load any modules from it. Also pass it a flag whether the boot volume is where the boot loader pre-loaded the modules from. * module_init_post_boot_device() changes the pre-loaded module image paths to normalized boot volume paths, now. Got rid of the code in register_preloaded_module_image() which tried something like this. * Changed module image ref counting. A referenced module has single reference to its image, which is released when the module becomes unreferenced. * get_module() for a reference module will not try to re-get and re-set the module's image anymore. That could lead to a similar module (from different paths) being loaded at the same time. A module from a new file can only be loaded when the old one has been put completely. * Simplified B_KEEP_ALIVE module handling a bit. When the module is initialized, we add another reference, which we'll never free. Thus the module remains loaded without special handling. Removed module_image::keep_loaded. A B_KEEP_ALIVE module remains referenced and thus its image remains referenced, too. * Removed module::file, a cached path to the module's image. An optimization that wouldn't work with multiple root directories for modules (/boot/beos/..., /boot/common/...) or when module files were moved. get_module() does now always search the image file, when the module is still unreferenced. This should be a bit slower than before, but I didn't notice any difference in VMware at least. If it turns out to be a problem we could introduce a more intelligent cache that stays up to date by using node monitoring. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27752 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-27 03:59:53 +04:00
extern status_t module_init_post_boot_device(bool bootingFromBootLoaderVolume);
#ifdef __cplusplus
}
#endif
#endif /* _KRENEL_MODULE_H */