From owner-dev-commits-src-all@freebsd.org  Sun Sep 12 18:32:40 2021
Return-Path: <owner-dev-commits-src-all@freebsd.org>
Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B52B766B260;
 Sun, 12 Sep 2021 18:32:40 +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 "R3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4H6ys44jvLz4nkx;
 Sun, 12 Sep 2021 18:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:5])
 (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 did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8221018C8A;
 Sun, 12 Sep 2021 18:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
 by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CIWeEh033854;
 Sun, 12 Sep 2021 18:32:40 GMT (envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
 by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CIWext033853;
 Sun, 12 Sep 2021 18:32:40 GMT (envelope-from git)
Date: Sun, 12 Sep 2021 18:32:40 GMT
Message-Id: <202109121832.18CIWext033853@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
 dev-commits-src-branches@FreeBSD.org
From: Warner Losh <imp@FreeBSD.org>
Subject: git: 27eae8241527 - stable/12 - lua loader: Add disable-device to
 disable a device.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: imp
X-Git-Repository: src
X-Git-Refname: refs/heads/stable/12
X-Git-Reftype: branch
X-Git-Commit: 27eae824152767df7b581f488228fd584b1081a4
Auto-Submitted: auto-generated
X-BeenThere: dev-commits-src-all@freebsd.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: Commit messages for all branches of the src repository
 <dev-commits-src-all.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, 
 <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/>
List-Post: <mailto:dev-commits-src-all@freebsd.org>
List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, 
 <mailto:dev-commits-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 12 Sep 2021 18:32:40 -0000

The branch stable/12 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=27eae824152767df7b581f488228fd584b1081a4

commit 27eae824152767df7b581f488228fd584b1081a4
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-07-28 22:52:38 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-09-12 16:33:12 +0000

    lua loader: Add disable-device to disable a device.
    
    disable-device fooX will set hint.foo.X.disabled=1 as a way to easily
    disable a device attaching during boot.
    
    Reviewed by:            tsoome
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D31297
    
    (cherry picked from commit 07c4b78d0a1d26b6441cf3e52b917f20c932b9d0)
---
 stand/lua/cli.lua   | 15 +++++++++++++++
 stand/lua/cli.lua.8 | 10 ++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua
index b7581c985a75..26f1cde50e34 100644
--- a/stand/lua/cli.lua
+++ b/stand/lua/cli.lua
@@ -240,6 +240,21 @@ cli["show-module-options"] = function()
 	pager.close()
 end
 
+cli["disable-device"] = function(...)
+	local _, argv = cli.arguments(...)
+	local d, u
+
+	if #argv == 0 then
+		print("usage error: disable-device device")
+		return
+	end
+
+	d, u = string.match(argv[1], "(%w*%a)(%d+)")
+	if d ~= nil then
+		loader.setenv("hint." .. d .. "." .. u .. ".disabled", "1")
+	end
+end
+
 -- Used for splitting cli varargs into cmd_name and the rest of argv
 function cli.arguments(...)
 	local argv = {...}
diff --git a/stand/lua/cli.lua.8 b/stand/lua/cli.lua.8
index 390831d21452..fe1cd0450557 100644
--- a/stand/lua/cli.lua.8
+++ b/stand/lua/cli.lua.8
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 17, 2020
+.Dd July 24, 2021
 .Dt CLI.LUA 8
 .Os
 .Sh NAME
@@ -91,10 +91,12 @@ module provides the following default commands:
 .It
 .Ic reload-conf
 .It
-.Ic enable-module
+.Ic device-disable
 .It
 .Ic disable-module
 .It
+.Ic enable-module
+.It
 .Ic toggle-module
 .It
 .Ic show-module-options
@@ -131,6 +133,10 @@ The
 .Ic show-module-options
 command will dump the list of modules that loader has been made aware of and
 any applicable options using paged output.
+.Pp
+The
+.Ic device-disable
+command sets the environment variable that disables the device argument.
 .Ss Exported Functions
 The following functions are exported from
 .Nm :