Author: ae
Date: Sun Sep 30 13:14:37 2012
New Revision: 241069
URL: http://svn.freebsd.org/changeset/base/241069

Log:
  Remember the file format of the last loaded module and try to use it for
  next files.

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

Modified: head/sys/boot/common/module.c
==============================================================================
--- head/sys/boot/common/module.c       Sun Sep 30 12:24:15 2012        
(r241068)
+++ head/sys/boot/common/module.c       Sun Sep 30 13:14:37 2012        
(r241069)
@@ -271,6 +271,7 @@ command_lsmod(int argc, char *argv[])
 int
 file_load(char *filename, vm_offset_t dest, struct preloaded_file **result)
 {
+    static int last_file_format = 0;
     struct preloaded_file *fp;
     int error;
     int i;
@@ -279,12 +280,18 @@ file_load(char *filename, vm_offset_t de
        dest = archsw.arch_loadaddr(LOAD_RAW, filename, dest);
 
     error = EFTYPE;
-    for (i = 0, fp = NULL; file_formats[i] && fp == NULL; i++) {
+    for (i = last_file_format, fp = NULL;
+       file_formats[i] && fp == NULL; i++) {
        error = (file_formats[i]->l_load)(filename, dest, &fp);
        if (error == 0) {
-           fp->f_loader = i;           /* remember the loader */
+           fp->f_loader = last_file_format = i; /* remember the loader */
            *result = fp;
            break;
+       } else if (last_file_format == i && i != 0) {
+               /* Restart from the beginning */
+               last_file_format = i = 0;
+               fp = NULL;
+               continue;
        }
        if (error == EFTYPE)
            continue;           /* Unknown to this handler? */
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to