summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2014-08-06 00:06:25 +0000
committermarcel <marcel@FreeBSD.org>2014-08-06 00:06:25 +0000
commit7ecc74a225ebaa88f5ce1b85a323e3e58fbfa364 (patch)
tree121c827830e3985f1b4a321f5813be75b8d94e31
parent237efaa08a34535aa220ff24bea823d667c4bb1d (diff)
downloadFreeBSD-src-7ecc74a225ebaa88f5ce1b85a323e3e58fbfa364.zip
FreeBSD-src-7ecc74a225ebaa88f5ce1b85a323e3e58fbfa364.tar.gz
Rename command_unload() to unload() and re-implement command_unload()
in terms of unload() This allows unloading all files by the loader itself. Obtained from: Juniper Networks, Inc.
-rw-r--r--sys/boot/common/bootstrap.h1
-rw-r--r--sys/boot/common/module.c18
2 files changed, 13 insertions, 6 deletions
diff --git a/sys/boot/common/bootstrap.h b/sys/boot/common/bootstrap.h
index 3d76540..eec1b3b 100644
--- a/sys/boot/common/bootstrap.h
+++ b/sys/boot/common/bootstrap.h
@@ -229,6 +229,7 @@ extern struct preloaded_file *preloaded_files;
int mod_load(char *name, struct mod_depend *verinfo, int argc, char *argv[]);
int mod_loadkld(const char *name, int argc, char *argv[]);
+void unload(void);
struct preloaded_file *file_alloc(void);
struct preloaded_file *file_findfile(char *name, char *type);
diff --git a/sys/boot/common/module.c b/sys/boot/common/module.c
index dd14c76..e1170bb 100644
--- a/sys/boot/common/module.c
+++ b/sys/boot/common/module.c
@@ -192,13 +192,11 @@ command_load_geli(int argc, char *argv[])
return(file_loadraw(argv[2], typestr) ? CMD_OK : CMD_ERROR);
}
-COMMAND_SET(unload, "unload", "unload all modules", command_unload);
-
-static int
-command_unload(int argc, char *argv[])
+void
+unload(void)
{
- struct preloaded_file *fp;
-
+ struct preloaded_file *fp;
+
while (preloaded_files != NULL) {
fp = preloaded_files;
preloaded_files = preloaded_files->f_next;
@@ -206,6 +204,14 @@ command_unload(int argc, char *argv[])
}
loadaddr = 0;
unsetenv("kernelname");
+}
+
+COMMAND_SET(unload, "unload", "unload all modules", command_unload);
+
+static int
+command_unload(int argc, char *argv[])
+{
+ unload();
return(CMD_OK);
}
OpenPOWER on IntegriCloud