tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[RFC] userconf(4) modification



As stated in a message before, disabling, via userconf(4), all the
drmkms drivers can not rely on a pattern matching since, for historical
reasons (several versions of DRM), the namespace of the drivers is not
"ruled".

So I want to add a "group" member to the cfdata structure, with
modifications to config(1) to set it, in order to allow to disable
devices by a group name.

Additionnaly, because I had already implemented it, there is a pattern
matching feature too.

You will find attached the man page in order to be able to comment
about the proposed new syntax---supplementary syntax: it does not
replace the "legacy" one.
-- 
        Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C
.\"     $NetBSD: userconf.4,v 1.14 2019/05/27 21:19:55 wiz Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Gregory McGarry.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd November 1, 2023
.Dt USERCONF 4
.Os
.Sh NAME
.Nm userconf
.Nd in-kernel device configuration manager
.Sh SYNOPSIS
.Cd options USERCONF
.Sh DESCRIPTION
.Nm
is the in-kernel device configuration manager.
It is used to alter the kernel autoconfiguration framework at runtime.
.Nm
is activated from the boot loader by passing the
.Fl c
option to the kernel.
.Sh COMMAND SYNTAX
There is a subset of meta-commands described immediately below and
action commands, described after in separated sections, in two syntaxes: 
legacy and new, the new syntax extending the possibilities offered by
the legacy one.
.Pp
.Nm
has a
.Xr more 1 Ns -like
functionality; if a number of lines in a command's output exceeds the
number defined in the lines variable, then
.Nm
displays
.Dq "-- more --"
and waits for a response, which may be one of:
.Bl -tag -offset indent -width "<return>"
.It <return>
one more line.
.It <space>
one more page.
.It Ic q
abort the current command, and return to the command input mode.
.El
.Pp
The common meta-commands are the following:
.Bl -tag -width 5n
.It Ic lines Ar count
Specify the number of lines before more. A negative number suppresses
the paging.
.It Ic base Ar 8 | 10 | 16
Base for displaying large numbers.
.It Ic exit
A synonym for
.Ic quit .
.It Ic help
Display online help, including ranges of device number, list of
device names and groups.
.It Ic quit
Leave userconf.
.It Ic \&?
A synonym for
.Ic help .
.El
.Sh LEGACY SYNTAX AND COMMANDS
.Nm
supports the legacy syntax:
.Bd -ragged -offset indent
.Ic command Op Ar option
.Ed
.Pp
and offers the following commands:
.Bl -tag -width 5n
.It Ic change Ar devno | dev
Change devices.
.It Ic disable Ar devno | dev
Disable devices.
.It Ic enable Ar devno | dev
Enable devices.
.It Ic find Ar devno | dev
Find devices.
.It Ic list
List current configuration.
.El
.Sh NEW SYNTAX AND COMMANDS
.Nm
supports the new syntax:
.Bd -ragged -offset indent
.Ic command Ar property Li \&= Ar expression
.Ed
.Pp
The
.Li \&=
has to be interpreted as meaning: defines the collection of devices on
which to apply the command with devices whose stated property matches
the expression.
.Pp
The commands are the following (same as with legacy syntax):
.Bl -tag -width 7n
.It Ic change
Change devices.
.It Ic disable
Disable devices.
.It Ic enable
Enable devices.
.It Ic find
Find devices.
.It Ic list
List devices
.El
.Pp
A
.Ar property
is one of the literals
.Bl -tag -width 5n
.It Li devno
the index number of the device in the cfdata vector. The expression
shall be a positive or nul integer value, less than the cardinal of
devices in the cfdata vector.
.It Li name
the driver name. The expression shall be a string one (see below).
.It Li group
the group the device belongs to. The expression shall be a string one
(see below).
.El
.Ss STRING EXPRESSION
A string expression is whether a literal string enclosed between double
quotes
.Li \&"
or a pattern enclosed between slashes
.Li \&/ .
.Pp
With a pattern, the string is searched as a fixed substring (there is
neither a wildcard special character, nor ranges or counts etc.), that
can be anchored at the beginning of the string to match against with a
caret
.Li \&^
and/or at the end of the string to match against with a dollar
.Li \&$ .
.Pp
Hence the literal string:
.Li \&"foo\&"
will have the same effect as the anchored pattern:
.Li /^foo$/ .
.Pp
A string expression can be suffixed with a
.Li \&*
meaning to select devices matching the string only if they are STARred
ones. Examples:
.Li \&"foobar\&"*
or
.Li /^foo/*
(the pattern in this example will eventually match more than the
literal string).
.Sh EXAMPLES
Disabling all the devices belonging to the
.Li \&"drmkms\&"
group:
.Pp
.Dl disable group = \&"drmkms\&"
.Pp
Listing all the devices whose name matches
.Li usb
at the beginning of the name:
.Pp
.Dl list name = /^usb/
.Sh FILES
.Bl -item
.It
.Pa sys/sys/devices.h
.It
.Pa sys/sys/userconf.h
.It
.Pa sys/kern/subr_userconf.c
.El
.Sh HISTORY
The
.Nm
framework first appeared in
.Ox 2.0 ,
and was then integrated into
.Nx 1.6 .
.Sh AUTHORS
The
.Nm
framework was written by
.An Mats O Jansson
.Aq Mt moj%stacken.kth.se@localhost .
.Pp
The new syntax and the groups handling were added by
.An Thierry Laronde
.Aq tlaronde%kergis.com@localhost .


Home | Main Index | Thread Index | Old Index