From owner-svn-src-head@freebsd.org Tue Dec 19 04:05:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB5CEE827EA; Tue, 19 Dec 2017 04:05:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C326934C5; Tue, 19 Dec 2017 04:05:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBJ45u4b086918; Tue, 19 Dec 2017 04:05:56 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJ45tiR086905; Tue, 19 Dec 2017 04:05:55 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201712190405.vBJ45tiR086905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 19 Dec 2017 04:05:55 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: common efi/loader i386/loader mips/beri/loader ofw/common powerpc/kboot powerpc/ps3 sparc64/loader uboot/common userboot/userboot X-SVN-Commit-Revision: 326961 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Dec 2017 04:05:58 -0000 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); }