PERFORCE change 97832 for review
John Baldwin
jhb at FreeBSD.org
Thu May 25 15:42:12 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=97832
Change 97832 by jhb at jhb_mutex on 2006/05/25 22:33:49
linker_file_unload() is now only called by the linker class
implementations, so move it over into that semi-private API and
axe the wrapper making the internal function the real one as it
is always called with the linker lock held.
Affected files ...
.. //depot/projects/smpng/sys/kern/kern_linker.c#61 edit
.. //depot/projects/smpng/sys/sys/linker.h#23 edit
Differences ...
==== //depot/projects/smpng/sys/kern/kern_linker.c#61 (text+ko) ====
@@ -127,7 +127,6 @@
linker_file_t dep);
static caddr_t linker_file_lookup_symbol_internal(linker_file_t file,
const char* name, int deps);
-static int linker_file_unload_internal(linker_file_t _file, int flags);
static int linker_load_module(const char *kldname,
const char *modname, struct linker_file *parent,
struct mod_depend *verinfo, struct linker_file **lfpp);
@@ -389,8 +388,7 @@
if (lf) {
error = linker_file_register_modules(lf);
if (error == EEXIST) {
- linker_file_unload_internal(lf,
- LINKER_UNLOAD_FORCE);
+ linker_file_unload(lf, LINKER_UNLOAD_FORCE);
return (error);
}
linker_file_register_sysctls(lf);
@@ -461,7 +459,7 @@
} else
KASSERT(modname == NULL && verinfo == NULL,
("linker_release_module: both file and name"));
- error = linker_file_unload_internal(lf, LINKER_UNLOAD_NORMAL);
+ error = linker_file_unload(lf, LINKER_UNLOAD_NORMAL);
KLD_UNLOCK();
return (error);
}
@@ -540,23 +538,9 @@
return (lf);
}
-int
+static int
linker_file_unload(linker_file_t file, int flags)
{
- int error, locked;
-
- locked = KLD_LOCKED();
- if (!locked)
- KLD_LOCK();
- error = linker_file_unload_internal(file, flags);
- if (!locked)
- KLD_UNLOCK();
- return (error);
-}
-
-static int
-linker_file_unload_internal(linker_file_t file, int flags)
-{
module_t mod, next;
modlist_t ml, nextml;
struct common_symbol *cp;
@@ -624,7 +608,7 @@
if (file->deps) {
for (i = 0; i < file->ndeps; i++)
- linker_file_unload_internal(file->deps[i], flags);
+ linker_file_unload(file->deps[i], flags);
free(file->deps, M_LINKER);
file->deps = NULL;
}
@@ -957,7 +941,7 @@
pkm.pm_size = lf->size;
#endif
lf->userrefs--;
- error = linker_file_unload_internal(lf, flags);
+ error = linker_file_unload(lf, flags);
if (error)
lf->userrefs++;
}
@@ -1399,7 +1383,7 @@
nver) != NULL) {
printf("module %s already"
" present!\n", modname);
- linker_file_unload_internal(lf,
+ linker_file_unload(lf,
LINKER_UNLOAD_FORCE);
TAILQ_REMOVE(&loaded_files,
lf, loaded);
@@ -1426,7 +1410,7 @@
*/
TAILQ_FOREACH(lf, &loaded_files, loaded) {
printf("KLD file %s is missing dependencies\n", lf->filename);
- linker_file_unload_internal(lf, LINKER_UNLOAD_FORCE);
+ linker_file_unload(lf, LINKER_UNLOAD_FORCE);
TAILQ_REMOVE(&loaded_files, lf, loaded);
}
@@ -1469,7 +1453,7 @@
if (error) {
printf("KLD file %s - could not finalize loading\n",
lf->filename);
- linker_file_unload_internal(lf, LINKER_UNLOAD_FORCE);
+ linker_file_unload(lf, LINKER_UNLOAD_FORCE);
continue;
}
linker_file_register_modules(lf);
@@ -1893,7 +1877,7 @@
break;
if (modname && verinfo &&
modlist_lookup2(modname, verinfo) == NULL) {
- linker_file_unload_internal(lfdep, LINKER_UNLOAD_FORCE);
+ linker_file_unload(lfdep, LINKER_UNLOAD_FORCE);
error = ENOENT;
break;
}
==== //depot/projects/smpng/sys/sys/linker.h#23 (text+ko) ====
@@ -119,11 +119,6 @@
linker_file_t _file);
/*
- * Unload a file, freeing up memory.
- */
-int linker_file_unload(linker_file_t _file, int flags);
-
-/*
* Iterate over all of the currently loaded linker files calling the
* predicate function while the function returns 0. Returns the value
* returned by the last predicate function.
@@ -149,6 +144,7 @@
* Functions soley for use by the linker class handlers.
*/
int linker_add_class(linker_class_t _cls);
+int linker_file_unload(linker_file_t _file, int flags);
int linker_load_dependencies(linker_file_t _lf);
linker_file_t linker_make_file(const char* _filename, linker_class_t _cls);
More information about the p4-projects
mailing list