summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_module.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2000-04-29 13:19:31 +0000
committerpeter <peter@FreeBSD.org>2000-04-29 13:19:31 +0000
commit8de950a22b47f2a5a632e462ab0d4818247b2bdf (patch)
tree38b4753b3c3b977d419f65254cb442749845de6e /sys/kern/kern_module.c
parentc3e5d07abf2d42fb40aaf24a4fe6f2216e01b35c (diff)
downloadFreeBSD-src-8de950a22b47f2a5a632e462ab0d4818247b2bdf.zip
FreeBSD-src-8de950a22b47f2a5a632e462ab0d4818247b2bdf.tar.gz
First round implementation of a fine grain enhanced module to module
version dependency system. This isn't quite finished, but it is at a useful stage to do a functional checkpoint. Highlights: - version and dependency metadata is gathered via linker sets, so things are handled the same for static kernels and code built to live in a kld. - The dependencies are at module level (versus at file level). - Dependencies determine kld symbol search order - this means that you cannot link against symbols in another file unless you depend on it. This is so that you cannot accidently unload the target out from underneath the ones referencing it. - It is flexible enough that we can put tags in #include files and macros so that we can get decent hooks for enforcing recompiles on incompatable ABI changes. eg: if we change struct proc, we could force a recompile for all kld's that reference the proc struct. - Tangled dependency references at boot time are sorted. Files are relocated once all their dependencies are already relocated. Caveats: - Loader support is incomplete, but has been worked on seperately. - Actual enforcement of the version number tags is not active yet - just the module dependencies are live. The actual structure of versioning hasn't been agreed on yet. (eg: major.minor, or whatever) - There is some backwards compatability for old modules without metadata but I'm not sure how good it is. This is based on work originally done by Boris Popov (bp@freebsd.org), but I'm not sure he'd recognize much of it now. Don't blame him. :-) Also, ideas have been borrowed from Mike Smith.
Diffstat (limited to 'sys/kern/kern_module.c')
-rw-r--r--sys/kern/kern_module.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c
index e451b97..46c3d14 100644
--- a/sys/kern/kern_module.c
+++ b/sys/kern/kern_module.c
@@ -37,7 +37,7 @@
#include <sys/linker.h>
#include <sys/proc.h>
-#define M_MODULE M_TEMP /* XXX */
+MALLOC_DEFINE(M_MODULE, "module", "module data structures");
typedef TAILQ_HEAD(, module) modulelist_t;
struct module {
@@ -93,19 +93,8 @@ module_register_init(const void *arg)
module_t mod;
mod = module_lookupbyname(data->name);
- if (mod == NULL) {
-#if 0
+ if (mod == NULL)
panic("module_register_init: module named %s not found\n", data->name);
-#else
- /* temporary kludge until kernel `file' attachment registers modules */
- error = module_register(data, linker_kernel_file);
- if (error)
- panic("module_register_init: register of module failed! %d", error);
- mod = module_lookupbyname(data->name);
- if (mod == NULL)
- panic("module_register_init: module STILL not found!");
-#endif
- }
error = MOD_EVENT(mod, MOD_LOAD);
if (error) {
MOD_EVENT(mod, MOD_UNLOAD);
@@ -141,8 +130,6 @@ module_register(const moduledata_t *data, linker_file_t container)
bzero(&newmod->data, sizeof(newmod->data));
TAILQ_INSERT_TAIL(&modules, newmod, link);
- if (container == NULL)
- container = linker_current_file;
if (container)
TAILQ_INSERT_TAIL(&container->modules, newmod, flink);
newmod->file = container;
OpenPOWER on IntegriCloud