From nobody Mon Apr 13 04:01:54 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fvDHl0hF0z6YCc0 for ; Mon, 13 Apr 2026 04:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fvDHk4bRLz3wLc for ; Mon, 13 Apr 2026 04:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776052914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=e70k1Rn5Itoq12h/EUzJ/jZCYHxTUZihkR6QrE8SSOc=; b=V2bEJHBwm/m0D9Q0GWQDvWfXWHCcdHJ3gdNjXTX5sr3ojelkysfY0sXWUYdiu/ba5lorzh +tx3yJ8RiaaSzNkCEEKSO38pjQ6QGjaBgyeXeJzSlFdbB44YxjhZafvqnfv4qRy/qPocBN ZBg5l+/dk/32EhHQq4NbueIWqH2Jt432Md9tF8H9sprylevQoefOYy/1USPBcxNNjwlDxg p/OTzfAka7UKv+ypoqyL8Rqn+5QYZRBzbr/Qg1qln872gEdEiQGIFOwDXiao3OKYZLDn1H MpdAc3ZEjabpNHChVD6q6YX3rjM6UdUbgCmU2sFULNQTQ1AO7qpCzV0HmT4g1Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776052914; a=rsa-sha256; cv=none; b=NJs5+z92RquuOJQyMgcHDykfcAuehb1x8NUd721G/59cqqKqdWhwadJ2iU658nb6uFT7oN AiF8snpGa+4m7Ena4ufxtQqf6WZxa39UbAsstTsY5g1DhXSy4GWH2x2kuEtL3UT7J3iawF add6slDGXNdqdXIGSwXEBYvrgc12NsUlLaeImwpizMTuG0EsDHsoRtBoMSARtdZ8nmrZCN ZEg0BjDbbY/3bVXdldhTlkK26RY4MMGzyQhC8us/Ne+R7UlxgZ4p3Ij1lZwzAmvYJMWqYt TSNGXG5NF71S7WpUnLus4XQ5Gc5UzNXfBYXF1WW7ZkwrsRGwY1NYGJWDgwFODw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776052914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=e70k1Rn5Itoq12h/EUzJ/jZCYHxTUZihkR6QrE8SSOc=; b=uwaLpn9jVC4J7gxGDghXAcCE3QujkLMLoxGf2o5l+cGZweGkYsfWTMAnqtdaC0ENWbCL+Z qej1MbE0I12l0odNLGhvnXwVTblM3sxQXrBJk1uhDMlFHtJjsB0+3Fy32Awt7SqwenQ6x6 jRxX9JzBpN13/V+wqbE0KeZrYdwbL6FC12VHt8e+D382LkvIxRyBNCDei6yxEqYGLChrvo LAnNhOkw7qs+/n+zX8oCdvDnszc4B5jC3GR/iRryKDEEDprcw5ZSA0adhnZEbi5HsdhycT pOPJ4P+joodWLvwp1XxboQZrRG0YBZ8zR2Lvv2RXsva2SW1jmDqS/2N79mIDRg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fvDHk3CbVznwm for ; Mon, 13 Apr 2026 04:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1d2d9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 13 Apr 2026 04:01:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 842bee699fe2 - stable/15 - lualoader: allow the local module to filter out the BE list List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 842bee699fe21c46285ba0fe885519a6e3adbd44 Auto-Submitted: auto-generated Date: Mon, 13 Apr 2026 04:01:54 +0000 Message-Id: <69dc6ab2.1d2d9.2b344831@gitrepo.freebsd.org> The branch stable/15 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=842bee699fe21c46285ba0fe885519a6e3adbd44 commit 842bee699fe21c46285ba0fe885519a6e3adbd44 Author: Kyle Evans AuthorDate: 2026-04-08 12:49:18 +0000 Commit: Kyle Evans CommitDate: 2026-04-13 03:12:35 +0000 lualoader: allow the local module to filter out the BE list This allows something like the following local.lua to install a filter to implement its own notion of hidden BEs using a naming convention of a leading dot to hide them: -- file: /boot/lua/local.lua local core = require("core") local function be_hide(be) if core.isSingleUserBoot() then -- All BEs are accepted for single-user return true end local name = be:match("/([^/]+)$") if not name then -- Accept malformed BEs, for whatever reason return true end return name:match("^%.") == nil end if core.bootenvFilter then -- Just in case we need to be compatible with older versions of -- core.lua without the filtering functionality. core.bootenvFilter(be_hide) end -- EOF Requested by: Marek Zarychta Reviewed by: imp (cherry picked from commit bf0881060ecd75ce79683b82ebcd4809eadf7cf5) --- stand/lua/core.lua | 20 ++++++++++++++++++-- stand/lua/core.lua.8 | 13 ++++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/stand/lua/core.lua b/stand/lua/core.lua index d06f41511a47..c276f61e5904 100644 --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -305,6 +305,15 @@ function core.bootenvDefault() return loader.getenv("zfs_be_active") end +function core.bootenvFilter(func) + local oldf = core.bootenv_filter + + -- Filter contract: returns true if the BE should be kept, false if it + -- should be hidden. + core.bootenv_filter = func + return oldf +end + function core.bootenvList() local bootenv_count = tonumber(loader.getenv(bootenv_list .. "_count")) local bootenvs = {} @@ -332,11 +341,18 @@ function core.bootenvList() for curenv_idx = 0, bootenv_count - 1 do curenv = loader.getenv(bootenv_list .. "[" .. curenv_idx .. "]") if curenv ~= nil and unique[curenv] == nil then - envcount = envcount + 1 - bootenvs[envcount] = curenv unique[curenv] = true + + -- If we have a filter installed (by a local module), we + -- give it a chance to veto the BE. + if not core.bootenv_filter or + core.bootenv_filter(curenv) then + envcount = envcount + 1 + bootenvs[envcount] = curenv + end end end + return bootenvs end diff --git a/stand/lua/core.lua.8 b/stand/lua/core.lua.8 index de43d3e2b220..325320b2fce8 100644 --- a/stand/lua/core.lua.8 +++ b/stand/lua/core.lua.8 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 29, 2025 +.Dd April 8, 2026 .Dt CORE.LUA 8 .Os .Sh NAME @@ -164,6 +164,17 @@ is set in kernels will be autodetected from the current system. .It Fn core.bootenvDefault Returns the default boot environment, nil if unset. +.It Fn core.bootenvFilter func +Installs a filter +.Fa func +into +.Fn core.bootenvList . +If the +.Fa func +returns true, then the boot environment is retained in the list. +Otherwise, the boot environment is hidden. +The old filter, if any, is returned to allow the caller to compose a filter on +top of another filter. .It Fn core.bootenvList Returns a table of boot environments, or an empty table. These will be picked up using the