Author: kevans
Date: Sat Jun  9 15:52:29 2018
New Revision: 334885
URL: https://svnweb.freebsd.org/changeset/base/334885

Log:
  stand: One more trivial consolidation (setting environment from howto)

Modified:
  head/stand/common/boot.c
  head/stand/common/bootstrap.h
  head/stand/efi/loader/main.c
  head/stand/i386/libi386/bootinfo.c
  head/stand/userboot/userboot/bootinfo.c

Modified: head/stand/common/boot.c
==============================================================================
--- head/stand/common/boot.c    Sat Jun  9 15:28:37 2018        (r334884)
+++ head/stand/common/boot.c    Sat Jun  9 15:52:29 2018        (r334885)
@@ -174,6 +174,16 @@ bootenv_flags()
        return (howto);
 }
 
+void
+bootenv_set(int howto)
+{
+       int i;
+
+       for (i = 0; howto_names[i].ev != NULL; i++)
+               if (howto & howto_names[i].mask)
+                       setenv(howto_names[i].ev, "YES", 1);
+}
+
 static int
 autoboot(int timeout, char *prompt)
 {

Modified: head/stand/common/bootstrap.h
==============================================================================
--- head/stand/common/bootstrap.h       Sat Jun  9 15:28:37 2018        
(r334884)
+++ head/stand/common/bootstrap.h       Sat Jun  9 15:52:29 2018        
(r334885)
@@ -64,6 +64,7 @@ int   parse(int *argc, char ***argv, const char *str);
 void   autoboot_maybe(void);
 int    getrootmount(char *rootdev);
 int    bootenv_flags(void);
+void   bootenv_set(int);
 
 /* misc.c */
 char   *unargv(int argc, char *argv[]);

Modified: head/stand/efi/loader/main.c
==============================================================================
--- head/stand/efi/loader/main.c        Sat Jun  9 15:28:37 2018        
(r334884)
+++ head/stand/efi/loader/main.c        Sat Jun  9 15:52:29 2018        
(r334885)
@@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/disk.h>
 #include <sys/param.h>
 #include <sys/reboot.h>
-#include <sys/boot.h>
 #include <stdint.h>
 #include <stand.h>
 #include <string.h>
@@ -549,9 +548,8 @@ main(int argc, CHAR16 *argv[])
                        }
                }
        }
-       for (i = 0; howto_names[i].ev != NULL; i++)
-               if (howto & howto_names[i].mask)
-                       setenv(howto_names[i].ev, "YES", 1);
+
+       bootenv_set(howto);
 
        /*
         * XXX we need fallback to this stuff after looking at the ConIn, 
ConOut and ConErr variables

Modified: head/stand/i386/libi386/bootinfo.c
==============================================================================
--- head/stand/i386/libi386/bootinfo.c  Sat Jun  9 15:28:37 2018        
(r334884)
+++ head/stand/i386/libi386/bootinfo.c  Sat Jun  9 15:52:29 2018        
(r334885)
@@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/reboot.h>
 #include <sys/linker.h>
-#include <sys/boot.h>
 #include "bootstrap.h"
 #include "libi386.h"
 #include "btxv86.h"
@@ -130,11 +129,8 @@ bi_getboothowto(char *kargs)
 void
 bi_setboothowto(int howto)
 {
-    int                i;
 
-    for (i = 0; howto_names[i].ev != NULL; i++)
-       if (howto & howto_names[i].mask)
-           setenv(howto_names[i].ev, "YES", 1);
+    bootenv_set(howto);
 }
 
 /*

Modified: head/stand/userboot/userboot/bootinfo.c
==============================================================================
--- head/stand/userboot/userboot/bootinfo.c     Sat Jun  9 15:28:37 2018        
(r334884)
+++ head/stand/userboot/userboot/bootinfo.c     Sat Jun  9 15:52:29 2018        
(r334885)
@@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/reboot.h>
 #include <sys/linker.h>
-#include <sys/boot.h>
 
 #include "bootstrap.h"
 #include "libuserboot.h"
@@ -131,11 +130,8 @@ bi_getboothowto(char *kargs)
 void
 bi_setboothowto(int howto)
 {
-    int                i;
 
-    for (i = 0; howto_names[i].ev != NULL; i++)
-       if (howto & howto_names[i].mask)
-           setenv(howto_names[i].ev, "YES", 1);
+    bootenv_set(howto);
 }
 
 /*
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to