Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Mar 2013 22:19:53 +0100
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        Warner Losh <imp@bsdimp.com>
Cc:        arch@freebsd.org
Subject:   Re: revising sys/conf/files* dependencies
Message-ID:  <20130305211953.GA51357@onelab2.iet.unipi.it>
In-Reply-To: <112844CF-69C3-49A3-8581-8EF2A7DA8E8A@bsdimp.com>
References:  <20130305083817.GD13187@onelab2.iet.unipi.it> <112844CF-69C3-49A3-8581-8EF2A7DA8E8A@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 05, 2013 at 08:15:30AM -0700, Warner Losh wrote:
> 
> On Mar 5, 2013, at 1:38 AM, Luigi Rizzo wrote:
> 
> > Short Summary:
> > 
> > I would like to revise sys/conf/files* and fix many erroneous usages of
> > 
> >    some/file.c		optional foo_dev bar_bus
> > 
> > changing them into one of the following
> > 
> >    some/file.c		optional foo_dev # link error if bar_bus is missing
> >    some/file.cxi	optional foo_dev | bar_bus # logical OR
> > 
> > ----------
> > Full description:
> > 
> > I always thought (wrongly) that a line of the form
> > 
> > 	some/file.c	optional foo bar baz		# 1
> > 
> > in sys/conf/files* meant that file.c is compiled in if _any_ of the
> > options is specified in the kernel config. But i was wrong, the
> > above means that _all_ options are require, and the correct syntax
> > for alternative options is
> > 
> > 	some/file.c	optional foo | bar |  baz	# 2
> > 
> > I believe that i am not alone in this misunderstanding, and that
> > most entries in sys/conf/files* use form #1 in a wrong way, e.g.:
> > 
> >    dev/hptiop/hptiop.c             optional hptiop scbus
> >    dev/iscsi/initiator/iscsi.c     optional iscsi_initiator scbus
> >    dev/mfi/mfi_cam.c               optional mfip scbus
> >    pci/viapm.c                     optional viapm pci
> >    pci/intpm.c                     optional intpm pci
> >    pci/if_rl.c                     optional rl pci
> >    (there are many many more)
> > 
> > In all these cases, if you forget the scbus or pci in the kernel
> > config, the driver is not compiled in but you only detect it at
> > compile time. I'd rather be notified of the error at kernel link time.
    ^^^^^^^^^^^^ i meant "run time", and this is the main problem:
if you forget the bus in the kernel config, the build will silently
discard the entry, but you will only realize it when you actually
run the kernel. Yet, having "rl" alone is surely an error, and it
should be flagged as such at build time.

> 
> I'd say those are correct: don't compile if_rl unless you have both rl and pci in the kernel....  There's no misunderstanding here: people know what it means.

> > So, as said in the summary, I'd like to modify these and similar
> > lines so that the error notification comes early; normally
> > this is achieved by removing the bus name.
> 
> That might be OK. The original intent for this form was to allow one to remove all pci drivers from the kernel by just removing the device pci line from the config file. This is at best a dubious feature, experience has shown. I'm worried that "fixing" it will produce a worse problem than the one you are fixing.

if that is the intent, at the very least we should explain it
in the file so it is clear why "pci" and "scbus" are handled
differently. But apart form the convenience for developers
(and given we have "include", this can be easily overcome),
the "fix" i propose should only point out broken config files.

cheers
luigi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130305211953.GA51357>