summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2002-04-10 01:13:57 +0000
committerbrian <brian@FreeBSD.org>2002-04-10 01:13:57 +0000
commit8ad55476a0c93a0bcb9e3363b8a11bd9a5c02883 (patch)
tree09baefc08667f2a69a2232e92a34ddae0120a2f3 /sys/kern
parentbb6d0ad1874d4e5dc01d944e588782bb11194dba (diff)
downloadFreeBSD-src-8ad55476a0c93a0bcb9e3363b8a11bd9a5c02883.zip
FreeBSD-src-8ad55476a0c93a0bcb9e3363b8a11bd9a5c02883.tar.gz
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.
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 bad5e1e..a88d636 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
OpenPOWER on IntegriCloud