Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jul 2021 00:47:31 +0100
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        Warner Losh <imp@FreeBSD.org>
Cc:        "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: 07c4b78d0a1d - main - lua loader: Add disable-device to disable a device.
Message-ID:  <E2C7A85E-DF67-4B1E-B44B-D3B69E44EAFE@freebsd.org>
In-Reply-To: <202107282254.16SMs5UV090332@gitrepo.freebsd.org>
References:  <202107282254.16SMs5UV090332@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 28 Jul 2021, at 23:54, Warner Losh <imp@FreeBSD.org> wrote:
>=20
> The branch main has been updated by imp:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D07c4b78d0a1d26b6441cf3e52b917f20=
c932b9d0
>=20
> commit 07c4b78d0a1d26b6441cf3e52b917f20c932b9d0
> Author:     Warner Losh <imp@FreeBSD.org>
> AuthorDate: 2021-07-28 22:52:38 +0000
> Commit:     Warner Losh <imp@FreeBSD.org>
> CommitDate: 2021-07-28 22:53:00 +0000
>=20
>    lua loader: Add disable-device to disable a device.
>=20
>    disable-device fooX will set hint.foo.X.disabled=3D1 as a way to =
easily
>    disable a device attaching during boot.
>=20
>    Reviewed by:            tsoome
>    Sponsored by:           Netflix
>    Differential Revision:  https://reviews.freebsd.org/D31297
> ---
> stand/lua/cli.lua   | 15 +++++++++++++++
> stand/lua/cli.lua.8 | 10 ++++++++--
> 2 files changed, 23 insertions(+), 2 deletions(-)
>=20
> diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua
> index cfdc69a520a0..12f6b57642db 100644
> --- a/stand/lua/cli.lua
> +++ b/stand/lua/cli.lua
> @@ -240,6 +240,21 @@ cli["show-module-options"] =3D function()
> 	pager.close()
> end
>=20
> +cli["disable-device"] =3D function(...)
> +	local _, argv =3D cli.arguments(...)
> +	local d, u
> +
> +	if #argv =3D=3D 0 then
> +		print("usage error: disable-device device")
> +		return
> +	end
> +
> +	d, u =3D string.match(argv[1], "(%w*%a)(%d+)")
> +	if d ~=3D 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 =3D {...}
> 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

This is round the wrong way (and repeated below).

Jess

> .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 :




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E2C7A85E-DF67-4B1E-B44B-D3B69E44EAFE>