tech-kern archive

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

Re: [RFC 2] userconf(4): 2nd proposal



On Sat, Nov 04, 2023 at 07:41:19AM +0000, RVP wrote:
> On Sat, 4 Nov 2023, tlaronde%kergis.com@localhost wrote:
> 
> > - 1) No change to the general form of current syntax;
> > 
> > - 2) Selection can be as presently: by number (index in cfdata), by
> > name (driver name), but also (NEW) by pattern: a pattern is
> > between slashes, it is a fix substring, that can be optionnally
> > anchored at the beginning with `^' and at the end with `$';
> > 
> > - 3) (NEW) If the selector (will this word do?) in 2) is surrounded by
> > braces `{' `}', the selector is for a group of devices;
> > 
> > - 4) The STAR (existing) is still handled as a suffix.
> > 
> > Examples:
> > 
> > disable i915drmkms	# existing syntax
> > 
> > disable {drmkms}	# NEW: disable devices belonging to group "drmkms"
> > 
> > disable {/^drm/}*	# NEW: disable devices belonging to groups
> > 			# whose name begins with the substr "drm" if
> > 			# they are STARred ones.
> > 
> 
> I think you can simplify things a bit by:
> 
> 1) Allowing shell-like patterns (not hard to implement):
> 
> uc> disable drm*	# all starting with `drm'

No...: this is a break of existing. Trailing `*' selects STARred devices
(I'm not the inventor of this). So `*' can not be used as a joker ;-)

> uc> disable *drm* *usb$	# all with `drm' anywhere and those ending in `usb'
> uc> disable foo		# exact match `foo'
> uc> disable 1		# exact match 1 (index)
> 
> 2) Having an alias facility:
> 
> uc> alias drm_disable=disable i915*; disable *radeon*; ...
> uc> drm_disable		# executes: RHS text (no recursive expansion)
> uc> alias drm_disable=	# remove alias `drm_disable'

I have contemplated, too, adding for example "variables" to userconf and
rejected it because this would be only useful for arch supporting
boot.cfg, and useless in userconf per se.

It is useless in userconf per se, because it is not persistent: the
time one will spend defining the aliases would be longer than the time
to type directly the disabling of several devices at userconf prompt ;-)

The goal, for me, is to have something generic, available on all
archs (hence put it in kern/subr_userconf.c and config(1)), and not an
ad hoc trick for drmkms, so that there is not something we have to
remember to update when something changes (groups will be set for the
benefits of userconf by config(1) with a macro added for the purpose).
-- 
        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


Home | Main Index | Thread Index | Old Index