Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Mar 2013 09:38:17 +0100
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        arch@freebsd.org
Subject:   revising sys/conf/files* dependencies
Message-ID:  <20130305083817.GD13187@onelab2.iet.unipi.it>

next in thread | raw e-mail | index | archive | help
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.

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.

Probably the only case where the "AND" form makes sense is when two
"device ..." entries in the kernel config also need to bring in
some additional files. Examples (perhaps) are drivers which support
multiple buses, such as

    dev/an/if_an.c                  optional an
    dev/an/if_an_isa.c              optional an isa
    dev/an/if_an_pccard.c           optional an pccard
    dev/an/if_an_pci.c              optional an pci

but this does not seem the main usage.


It would be really good if we could force dependencies, e.g.

    "device da" implies "device scbus"

but there is no good way to specify this in sys/conf/files* without
horribly cluttering the entries for a bus with all the devices
that use it.

Probably one could extract this information from the MODULE_DEPEND() macros
within the source tree, but i am unclear on what is the most
efficient way to process the information without having to change
config(8) -- which being written in C is a bit error-prone.

comments ?

	cheers
	luigi



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