Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Dec 2017 16:18:05 +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: r326772 - in head/stand: common efi/loader i386/loader mips/beri/loader ofw/common powerpc/kboot powerpc/ps3 sparc64/loader userboot/userboot
Message-ID:  <201712111618.vBBGI5nD027945@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Mon Dec 11 16:18:05 2017
New Revision: 326772
URL: https://svnweb.freebsd.org/changeset/base/326772

Log:
  Fix regression with lua import
  
  Don't print when we can't find a file. Copy it instead to the error
  buffer. Higher level routines determine if it's appropriate to print
  the error message.
  
  Also, remove dead code (labeled bogusly lost functionality) since we
  never used that functionality. Remove unused arg from interact() too.
  
  Sponsored 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/userboot/userboot/main.c

Modified: head/stand/common/bootstrap.h
==============================================================================
--- head/stand/common/bootstrap.h	Mon Dec 11 16:17:53 2017	(r326771)
+++ head/stand/common/bootstrap.h	Mon Dec 11 16:18:05 2017	(r326772)
@@ -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 */
@@ -53,10 +53,6 @@ char	*backslash(const char *str);
 
 /* interp_parse.c */
 int	parse(int *argc, char ***argv, const char *str);
-
-/* interp_forth.c */
-void	bf_init(const char *rc);
-int	bf_run(char *line);
 
 /* boot.c */
 int	autoboot(int timeout, char *prompt);

Modified: head/stand/common/interp.c
==============================================================================
--- head/stand/common/interp.c	Mon Dec 11 16:17:53 2017	(r326771)
+++ head/stand/common/interp.c	Mon Dec 11 16:18:05 2017	(r326772)
@@ -58,7 +58,7 @@ default_load_config(void *ctx)
  * Interactive mode
  */
 void
-interact(const char * rc)
+interact(void)
 {
 	static char	input[256];			/* big enough? */
 
@@ -124,6 +124,9 @@ command_include(int argc, char *argv[])
 	for (i = 0; i < argc; i++)
 		free(argvbuf[i]);
 	free(argvbuf);
+
+	if (res != CMD_OK)
+		printf("%s", command_errbuf);
 
 	return(res);
 }

Modified: head/stand/common/interp_forth.c
==============================================================================
--- head/stand/common/interp_forth.c	Mon Dec 11 16:17:53 2017	(r326771)
+++ head/stand/common/interp_forth.c	Mon Dec 11 16:18:05 2017	(r326772)
@@ -294,21 +294,6 @@ interp_forth_init(void *ctx)
     /* Export some version numbers so that code can detect the loader/host version */
     ficlSetEnv(bf_sys, "FreeBSD_version", __FreeBSD_version);
     ficlSetEnv(bf_sys, "loader_version", bootprog_rev);
-
-#if 0 /* XXX lost functionality -- imp */
-    /* try to load and run init file if present */
-    if (rc == NULL)
-	rc = "/boot/boot.4th";
-    if (*rc != '\0') {
-        int fd;
-
-	fd = open(rc, O_RDONLY);
-	if (fd != -1) {
-	    (void)ficlExecFD(bf_vm, fd);
-	    close(fd);
-	}
-    }
-#endif
 }
 
 /*
@@ -364,10 +349,12 @@ interp_forth_incl(void *ctx, const char *filename)
 
 	fd = open(filename, O_RDONLY);
 	if (fd == -1) {
-		printf("can't open %s\n", filename);
+		/* Hihger layers print the error message */
+		snprintf(command_errbuf, sizeof(command_errbuf),
+		    "can't open %s\n", filename);
 		return (CMD_ERROR);
 	}
-	return (ficlExecFD(softc->bf_vm, fd));
+	return (ficlExecFD(softc->bf_vm, fd) == 0 ? CMD_OK : CMD_ERROR);
 }
 
 

Modified: head/stand/efi/loader/main.c
==============================================================================
--- head/stand/efi/loader/main.c	Mon Dec 11 16:17:53 2017	(r326771)
+++ head/stand/efi/loader/main.c	Mon Dec 11 16:18:05 2017	(r326772)
@@ -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	Mon Dec 11 16:17:53 2017	(r326771)
+++ head/stand/i386/loader/main.c	Mon Dec 11 16:18:05 2017	(r326772)
@@ -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	Mon Dec 11 16:17:53 2017	(r326771)
+++ head/stand/mips/beri/loader/main.c	Mon Dec 11 16:18:05 2017	(r326772)
@@ -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	Mon Dec 11 16:17:53 2017	(r326771)
+++ head/stand/ofw/common/main.c	Mon Dec 11 16:18:05 2017	(r326772)
@@ -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	Mon Dec 11 16:17:53 2017	(r326771)
+++ head/stand/powerpc/kboot/main.c	Mon Dec 11 16:18:05 2017	(r326772)
@@ -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	Mon Dec 11 16:17:53 2017	(r326771)
+++ head/stand/powerpc/ps3/main.c	Mon Dec 11 16:18:05 2017	(r326772)
@@ -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	Mon Dec 11 16:17:53 2017	(r326771)
+++ head/stand/sparc64/loader/main.c	Mon Dec 11 16:18:05 2017	(r326772)
@@ -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/userboot/userboot/main.c
==============================================================================
--- head/stand/userboot/userboot/main.c	Mon Dec 11 16:17:53 2017	(r326771)
+++ head/stand/userboot/userboot/main.c	Mon Dec 11 16:18:05 2017	(r326772)
@@ -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?201712111618.vBBGI5nD027945>