From owner-svn-src-all@freebsd.org Wed Aug 31 03:55:51 2016 Return-Path: Delivered-To: svn-src-all@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 5AF7BBC77CD; Wed, 31 Aug 2016 03:55:51 +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 15823BDB; Wed, 31 Aug 2016 03:55:51 +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 u7V3toLu018158; Wed, 31 Aug 2016 03:55:50 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7V3tof3018157; Wed, 31 Aug 2016 03:55:50 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201608310355.u7V3tof3018157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 31 Aug 2016 03:55:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305107 - head/sys/boot/forth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2016 03:55:51 -0000 Author: imp Date: Wed Aug 31 03:55:50 2016 New Revision: 305107 URL: https://svnweb.freebsd.org/changeset/base/305107 Log: Create a hook 'post-initialize' for people that want to define something (perhaps in loader.rc.local) that can read in .conf files after all the other .conf files have been read and override settings in them. This is quite handy if the .conf file name is determined while the loader is running, but might be generically useful for other things. If this hook exists, call it, otherwise don't do anything. Doing it in these functions ensures that this file is reliably read. It also works around a defect in forth where s" isn't allowed outside a function (well, in a compile context) leading to gross workarounds if one were to hack loader.rc like: : maybe-some-func s" some-func" sfind if execute else drop then ; maybe-some-func which somehow seems worse. Though I'm sure there's some clever forthy way of doing that with a macro. Sponsored by: Netflix, Inc Modified: head/sys/boot/forth/loader.4th Modified: head/sys/boot/forth/loader.4th ============================================================================== --- head/sys/boot/forth/loader.4th Wed Aug 31 01:27:30 2016 (r305106) +++ head/sys/boot/forth/loader.4th Wed Aug 31 03:55:50 2016 (r305107) @@ -143,6 +143,8 @@ only forth definitions also support-func s" /boot/defaults/loader.conf" initialize include_conf_files include_nextboot_file + \ If the user defined a post-initialize hook, call it now + s" post-initialize" sfind if execute else drop then \ Will *NOT* try to load kernel and modules if no configuration file \ was successfully loaded! any_conf_read? if @@ -165,12 +167,15 @@ only forth definitions also support-func \ \ Overrides support.4th initialization word with one that does \ everything start one does, short of loading the kernel and -\ modules. Returns a flag +\ modules. Returns a flag. Unsure why we don't just have start +\ call this... : initialize ( -- flag ) s" /boot/defaults/loader.conf" initialize include_conf_files include_nextboot_file + \ If the user defined a post-initialize hook, call it now + s" post-initialize" sfind if execute else drop then any_conf_read? ;