Date: Sat, 25 Jan 2020 03:52:17 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357104 - head/stand/lua Message-ID: <202001250352.00P3qHbs044031@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Sat Jan 25 03:52:16 2020 New Revision: 357104 URL: https://svnweb.freebsd.org/changeset/base/357104 Log: lua: add modules.loaded hook This may be used for the local module to hook in and load any additional modules that it wants, since it can't modify the modules table internal to config. We may consider adding API to do so at a later time, but I suspect it will be more complicated to use with little return. status is captured but ignored for the purpose of loading the hook. status will be false if *any* module failed to load, but we typically don't let that halt the boot so there's no reason to let it halt hooks. Some vendors or setups may have expected fails that would be actively thwarted by checking it. We may, at a later date, consider adding an API for letting non-config modules check which modules have successfully (or not) loaded in case an unexpected failure *should* halt whatever they are doing. MFC after: 3 days Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Jan 25 03:02:45 2020 (r357103) +++ head/stand/lua/config.lua Sat Jan 25 03:52:16 2020 (r357104) @@ -623,7 +623,7 @@ end function config.loadelf() local xen_kernel = loader.getenv('xen_kernel') local kernel = config.kernel_selected or config.kernel_loaded - local loaded + local loaded, status if xen_kernel ~= nil then print(MSG_XENKERNLOADING) @@ -640,9 +640,12 @@ function config.loadelf() end print(MSG_MODLOADING) - return loadModule(modules, not config.verbose) + status = loadModule(modules, not config.verbose) + hook.runAll("modules.loaded") + return status end hook.registerType("config.loaded") hook.registerType("config.reloaded") +hook.registerType("modules.loaded") return config
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001250352.00P3qHbs044031>