Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Dec 2017 04:05:55 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326961 - in head/stand: common efi/loader i386/loader mips/beri/loader ofw/common powerpc/kboot powerpc/ps3 sparc64/loader uboot/common userboot/userboot
Message-ID:  <201712190405.vBJ45tiR086905@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Tue Dec 19 04:05:55 2017
New Revision: 326961
URL: https://svnweb.freebsd.org/changeset/base/326961

Log:
  Interact is always called with NULL. Simplify code a little by
  removing this argument, and expanding when rc is NULL. This
  effectively completes the back out of custom scripts for tftp booted
  loaders from r269153 that was started in r292344 with the new path
  tricks that obsoleted it.
  
  Submitted by: Netflix

Modified:
  head/stand/common/bootstrap.h
  head/stand/common/interp.c
  head/stand/common/interp_forth.c
  head/stand/efi/loader/main.c
  head/stand/i386/loader/main.c
  head/stand/mips/beri/loader/main.c
  head/stand/ofw/common/main.c
  head/stand/powerpc/kboot/main.c
  head/stand/powerpc/ps3/main.c
  head/stand/sparc64/loader/main.c
  head/stand/uboot/common/main.c
  head/stand/userboot/userboot/main.c

Modified: head/stand/common/bootstrap.h
==============================================================================
--- head/stand/common/bootstrap.h	Tue Dec 19 04:05:43 2017	(r326960)
+++ head/stand/common/bootstrap.h	Tue Dec 19 04:05:55 2017	(r326961)
@@ -45,7 +45,7 @@ extern char	command_errbuf[COMMAND_ERRBUFSZ];
 #define CMD_FATAL	4
 
 /* interp.c */
-void	interact(const char *rc);
+void	interact(void);
 int	include(const char *filename);
 
 /* interp_backslash.c */
@@ -55,7 +55,7 @@ char	*backslash(const char *str);
 int	parse(int *argc, char ***argv, const char *str);
 
 /* interp_forth.c */
-void	bf_init(const char *rc);
+void	bf_init(void);
 int	bf_run(char *line);
 
 /* boot.c */

Modified: head/stand/common/interp.c
==============================================================================
--- head/stand/common/interp.c	Tue Dec 19 04:05:43 2017	(r326960)
+++ head/stand/common/interp.c	Tue Dec 19 04:05:55 2017	(r326961)
@@ -84,7 +84,7 @@ perform(int argc, char *argv[])
  * Interactive mode
  */
 void
-interact(const char *rc)
+interact(void)
 {
     static char	input[256];			/* big enough? */
 #ifndef BOOT_FORTH
@@ -93,14 +93,11 @@ interact(const char *rc)
 #endif
 
 #ifdef BOOT_FORTH
-    bf_init((rc) ? "" : NULL);
+    bf_init();
 #endif
 
-    if (rc == NULL) {
-	/* Read our default configuration. */
-	include("/boot/loader.rc");
-    } else if (*rc != '\0')
-	include(rc);
+    /* Read our default configuration. */
+    include("/boot/loader.rc");
 
     printf("\n");
 

Modified: head/stand/common/interp_forth.c
==============================================================================
--- head/stand/common/interp_forth.c	Tue Dec 19 04:05:43 2017	(r326960)
+++ head/stand/common/interp_forth.c	Tue Dec 19 04:05:55 2017	(r326961)
@@ -250,7 +250,7 @@ bf_command(FICL_VM *vm)
  * Initialise the Forth interpreter, create all our commands as words.
  */
 void
-bf_init(const char *rc)
+bf_init(void)
 {
     struct bootblk_command	**cmdp;
     char create_buf[41];	/* 31 characters-long builtins */
@@ -280,14 +280,9 @@ bf_init(const char *rc)
     ficlSetEnv(bf_sys, "loader_version", bootprog_rev);
 
     /* try to load and run init file if present */
-    if (rc == NULL)
-	rc = "/boot/boot.4th";
-    if (*rc != '\0') {
-	fd = open(rc, O_RDONLY);
-	if (fd != -1) {
-	    (void)ficlExecFD(bf_vm, fd);
-	    close(fd);
-	}
+    if ((fd = open("/boot/boot.4th", O_RDONLY)) != -1) {
+	(void)ficlExecFD(bf_vm, fd);
+	close(fd);
     }
 }
 

Modified: head/stand/efi/loader/main.c
==============================================================================
--- head/stand/efi/loader/main.c	Tue Dec 19 04:05:43 2017	(r326960)
+++ head/stand/efi/loader/main.c	Tue Dec 19 04:05:55 2017	(r326961)
@@ -501,7 +501,7 @@ main(int argc, CHAR16 *argv[])
 #endif
 	}
 
-	interact(NULL);			/* doesn't return */
+	interact();			/* doesn't return */
 
 	return (EFI_SUCCESS);		/* keep compiler happy */
 }

Modified: head/stand/i386/loader/main.c
==============================================================================
--- head/stand/i386/loader/main.c	Tue Dec 19 04:05:43 2017	(r326960)
+++ head/stand/i386/loader/main.c	Tue Dec 19 04:05:55 2017	(r326961)
@@ -232,7 +232,7 @@ main(void)
     
     bios_getsmap();
 
-    interact(NULL);
+    interact();
 
     /* if we ever get here, it is an error */
     return (1);

Modified: head/stand/mips/beri/loader/main.c
==============================================================================
--- head/stand/mips/beri/loader/main.c	Tue Dec 19 04:05:43 2017	(r326960)
+++ head/stand/mips/beri/loader/main.c	Tue Dec 19 04:05:55 2017	(r326961)
@@ -149,7 +149,7 @@ main(int argc, char *argv[], char *envv[], struct boot
 	printf("bootpath=\"%s\"\n", bootpath);
 #endif
 
-	interact(NULL);
+	interact();
 	return (0);
 }
 

Modified: head/stand/ofw/common/main.c
==============================================================================
--- head/stand/ofw/common/main.c	Tue Dec 19 04:05:43 2017	(r326960)
+++ head/stand/ofw/common/main.c	Tue Dec 19 04:05:55 2017	(r326961)
@@ -157,7 +157,7 @@ main(int (*openfirm)(void *))
 	archsw.arch_readin = ofw_readin;
 	archsw.arch_autoload = ofw_autoload;
 
-	interact(NULL);				/* doesn't return */
+	interact();				/* doesn't return */
 
 	OF_exit();
 

Modified: head/stand/powerpc/kboot/main.c
==============================================================================
--- head/stand/powerpc/kboot/main.c	Tue Dec 19 04:05:43 2017	(r326960)
+++ head/stand/powerpc/kboot/main.c	Tue Dec 19 04:05:55 2017	(r326961)
@@ -122,7 +122,7 @@ main(int argc, const char **argv)
 	setenv("loaddev", bootdev, 1);
 	setenv("LINES", "24", 1);
 
-	interact(NULL);			/* doesn't return */
+	interact();			/* doesn't return */
 
 	return (0);
 }

Modified: head/stand/powerpc/ps3/main.c
==============================================================================
--- head/stand/powerpc/ps3/main.c	Tue Dec 19 04:05:43 2017	(r326960)
+++ head/stand/powerpc/ps3/main.c	Tue Dec 19 04:05:55 2017	(r326961)
@@ -140,7 +140,7 @@ main(void)
 	setenv("LINES", "24", 1);
 	setenv("hw.platform", "ps3", 1);
 
-	interact(NULL);			/* doesn't return */
+	interact();			/* doesn't return */
 
 	return (0);
 }

Modified: head/stand/sparc64/loader/main.c
==============================================================================
--- head/stand/sparc64/loader/main.c	Tue Dec 19 04:05:43 2017	(r326960)
+++ head/stand/sparc64/loader/main.c	Tue Dec 19 04:05:55 2017	(r326961)
@@ -902,7 +902,7 @@ main(int (*openfirm)(void *))
 	printf("bootpath=\"%s\"\n", bootpath);
 
 	/* Give control to the machine independent loader code. */
-	interact(NULL);
+	interact();
 	return (1);
 }
 

Modified: head/stand/uboot/common/main.c
==============================================================================
--- head/stand/uboot/common/main.c	Tue Dec 19 04:05:43 2017	(r326960)
+++ head/stand/uboot/common/main.c	Tue Dec 19 04:05:55 2017	(r326961)
@@ -500,7 +500,7 @@ main(int argc, char **argv)
 	archsw.arch_readin = uboot_readin;
 	archsw.arch_autoload = uboot_autoload;
 
-	interact(NULL);				/* doesn't return */
+	interact();				/* doesn't return */
 
 	return (0);
 }

Modified: head/stand/userboot/userboot/main.c
==============================================================================
--- head/stand/userboot/userboot/main.c	Tue Dec 19 04:05:43 2017	(r326960)
+++ head/stand/userboot/userboot/main.c	Tue Dec 19 04:05:55 2017	(r326961)
@@ -142,7 +142,7 @@ loader_main(struct loader_callbacks *cb, void *arg, in
 	if (setjmp(jb))
 		return;
 
-	interact(NULL);			/* doesn't return */
+	interact();			/* doesn't return */
 
 	exit(0);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712190405.vBJ45tiR086905>