From owner-freebsd-arch@FreeBSD.ORG Tue Mar 5 08:37:41 2013 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6D5F972A for ; Tue, 5 Mar 2013 08:37:41 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 25B10957 for ; Tue, 5 Mar 2013 08:37:40 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 5C3597300A; Tue, 5 Mar 2013 09:38:17 +0100 (CET) Date: Tue, 5 Mar 2013 09:38:17 +0100 From: Luigi Rizzo To: arch@freebsd.org Subject: revising sys/conf/files* dependencies Message-ID: <20130305083817.GD13187@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 08:37:41 -0000 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