Author: marcel
Date: Wed Aug  6 00:06:25 2014
New Revision: 269618
URL: http://svnweb.freebsd.org/changeset/base/269618

Log:
  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.

Modified:
  head/sys/boot/common/bootstrap.h
  head/sys/boot/common/module.c

Modified: head/sys/boot/common/bootstrap.h
==============================================================================
--- head/sys/boot/common/bootstrap.h    Tue Aug  5 23:58:49 2014        
(r269617)
+++ head/sys/boot/common/bootstrap.h    Wed Aug  6 00:06:25 2014        
(r269618)
@@ -229,6 +229,7 @@ extern struct preloaded_file        *preloaded_
 
 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);

Modified: head/sys/boot/common/module.c
==============================================================================
--- head/sys/boot/common/module.c       Tue Aug  5 23:58:49 2014        
(r269617)
+++ head/sys/boot/common/module.c       Wed Aug  6 00:06:25 2014        
(r269618)
@@ -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);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to