aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>2002-04-10 01:13:57 +0000
committerBrian Somers <brian@FreeBSD.org>2002-04-10 01:13:57 +0000
commit96987c74d66bbaf822f59d550460259611a7ed1d (patch)
tree09baefc08667f2a69a2232e92a34ddae0120a2f3 /sys/kern
parenta1b85c51bbe734c7635be4a4b8ead833009c703f (diff)
downloadsrc-96987c74d66bbaf822f59d550460259611a7ed1d.tar.gz
src-96987c74d66bbaf822f59d550460259611a7ed1d.zip
Change linker_reference_module() so that it's passed a struct
mod_depend * (which may be NULL). The only consumer of this function at the moment is digi_loadmoduledata(), and that passes a NULL mod_depend *. In linker_reference_module(), check to see if we've already got the required module loaded. If we have, bump the reference count and return that, otherwise continue the module search as normal.
Notes
Notes: svn path=/head/; revision=94321
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_linker.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index bad5e1ef648a..a88d636d6b71 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -98,6 +98,9 @@ struct modlist {
typedef struct modlist *modlist_t;
static modlisthead_t found_modules;
+static modlist_t modlist_lookup2(const char *name,
+ struct mod_depend *verinfo);
+
static char *
linker_strdup(const char *str)
{
@@ -345,11 +348,19 @@ out:
return (error);
}
-/* XXX: function parameters are incomplete */
int
-linker_reference_module(const char *modname, linker_file_t *result)
+linker_reference_module(const char *modname, struct mod_depend *verinfo,
+ linker_file_t *result)
{
- return (linker_load_module(NULL, modname, NULL, NULL, result));
+ modlist_t mod;
+
+ if ((mod = modlist_lookup2(modname, verinfo)) != NULL) {
+ *result = mod->container;
+ (*result)->refs++;
+ return (0);
+ }
+
+ return (linker_load_module(NULL, modname, NULL, verinfo, result));
}
linker_file_t