Date: Wed, 31 Aug 2016 03:55:50 +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: r305107 - head/sys/boot/forth Message-ID: <201608310355.u7V3tof3018157@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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? ;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608310355.u7V3tof3018157>