xref: /openbsd-src/share/man/man5/files.conf.5 (revision b6407f16266ed2548f0e4c285d46fad4a9282ba9)
1*b6407f16Smiod.\"	$OpenBSD: files.conf.5,v 1.2 2002/12/10 23:51:45 miod Exp $
29de8d1bdSmiod.\"
39de8d1bdSmiod.\" Copyright (c) 2002 Miodrag Vallat.
49de8d1bdSmiod.\" All rights reserved.
59de8d1bdSmiod.\"
69de8d1bdSmiod.\" Redistribution and use in source and binary forms, with or without
79de8d1bdSmiod.\" modification, are permitted provided that the following conditions
89de8d1bdSmiod.\" are met:
99de8d1bdSmiod.\" 1. Redistribution of source code must retain the above copyright
109de8d1bdSmiod.\"    notice, this list of conditions and the following disclaimer.
119de8d1bdSmiod.\" 2. Redistributions in binary form must reproduce the above copyright
129de8d1bdSmiod.\"    notice, this list of conditions and the following disclaimer in the
139de8d1bdSmiod.\"    documentation and/or other materials provided with the distribution.
149de8d1bdSmiod.\"
159de8d1bdSmiod.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
169de8d1bdSmiod.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
179de8d1bdSmiod.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
189de8d1bdSmiod.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
199de8d1bdSmiod.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
209de8d1bdSmiod.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
219de8d1bdSmiod.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
229de8d1bdSmiod.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
239de8d1bdSmiod.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
249de8d1bdSmiod.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
259de8d1bdSmiod.\"
269de8d1bdSmiod.\"
279de8d1bdSmiod.Dd October 8, 2002
289de8d1bdSmiod.Dt FILES.CONF 5
299de8d1bdSmiod.Os
309de8d1bdSmiod.Sh NAME
319de8d1bdSmiod.Nm files.conf
329de8d1bdSmiod.Nd rules base for the config utility
339de8d1bdSmiod.Sh DESCRIPTION
349de8d1bdSmiodThe various
359de8d1bdSmiod.Pa files.*
369de8d1bdSmiodfiles located in the kernel source tree
379de8d1bdSmiodcontain all the necessary information needed by
389de8d1bdSmiod.Xr config 8
399de8d1bdSmiodto parse a kernel configuration file and determine the list of files to
409de8d1bdSmiodcompile.
419de8d1bdSmiod.Sh SYNTAX
429de8d1bdSmiodThe
439de8d1bdSmiod.Pa files.*
449de8d1bdSmiodrules base are simple, human-readable, text files.
459de8d1bdSmiodEmpty lines, as well as text prefixed by the
469de8d1bdSmiod.Dq \&#
479de8d1bdSmiodcharacter, are ignored.
489de8d1bdSmiod.\"
499de8d1bdSmiod.Ss Device tree concept
509de8d1bdSmiod.\"
519de8d1bdSmiodThe
529de8d1bdSmiod.Ox
539de8d1bdSmiodkernel
549de8d1bdSmiod.Dq sees
559de8d1bdSmiodthe various devices as a hierarchical tree, where the various devices
569de8d1bdSmiod.Dq attach
579de8d1bdSmiodto parent entities, which can either be physical devices themselves
589de8d1bdSmiod.Pq such as a computer bus ,
599de8d1bdSmiodor logical entities, designed to make the driver code simpler.
609de8d1bdSmiodUsually, the top-most devices are attached to the pseudo-device
619de8d1bdSmiod.Dq mainbus ,
629de8d1bdSmiodwhich is itself reported as attached to a fictious
639de8d1bdSmiod.Dq root
649de8d1bdSmiodnode.
659de8d1bdSmiodThere is no restriction on the
669de8d1bdSmiod.Dq childrens
679de8d1bdSmioda device node may have ;
689de8d1bdSmiodsome device drivers can attach themselves to different kind of parent devices.
699de8d1bdSmiodFor example, the logical
709de8d1bdSmiod.Xr scsibus 4
719de8d1bdSmioddevice can either attach at an
729de8d1bdSmiod.Tn SCSI
739de8d1bdSmiodcontroller device, or at the logical
749de8d1bdSmiod.Xr atapiscsi 4
759de8d1bdSmiodbus.
769de8d1bdSmiod.\"
779de8d1bdSmiod.Ss Locators
789de8d1bdSmiod.\"
799de8d1bdSmiodSome device attachments need to provide attachment information.
809de8d1bdSmiodFor example, an
819de8d1bdSmiod.Xr isa 4
829de8d1bdSmioddevice will use a range of io ports, one or more DMA channels, and one
839de8d1bdSmiodinterrupt vector.
849de8d1bdSmiodThis attachment information is known as the
859de8d1bdSmiod.Dq locators
869de8d1bdSmiodfor the device.
879de8d1bdSmiodMost of the busses support default values for unspecified locators, for devices
889de8d1bdSmiodthat either do not require them
899de8d1bdSmiod.Po
909de8d1bdSmiodsuch as
919de8d1bdSmiod.Xr isa 4
929de8d1bdSmiodcards not using interrupts
939de8d1bdSmiod.Pc ,
949de8d1bdSmiodor which can autoconfigure themselves
95*b6407f16Smiod.Pq such as
96*b6407f16Smiod.Xr pci 4
97*b6407f16Smioddevices .
989de8d1bdSmiod.Pp
999de8d1bdSmiodAttachment lines in the kernel configuration file must match the locators of
1009de8d1bdSmiodthe device they are attaching to.
1019de8d1bdSmiodFor example, given
1029de8d1bdSmiod.Bl -item -offset indent -compact
1039de8d1bdSmiod.It
1049de8d1bdSmioddefine pci {[dev = -1], [function = -1]}
1059de8d1bdSmiod.El
1069de8d1bdSmiodin the rules files, the following kernel configuration lines are valid:
1079de8d1bdSmiod.Bl -item -offset indent -compact
1089de8d1bdSmiod.It
1099de8d1bdSmiodpciknob0 at pci? dev 2 function 42 # use fixed values
1109de8d1bdSmiod.It
1119de8d1bdSmiodpciknob* at pci? dev ? function ?  # use default values
1129de8d1bdSmiod.It
1139de8d1bdSmiodpciknob* at pci?                   # use default locators
1149de8d1bdSmiod.El
1159de8d1bdSmiodbut the following are not:
1169de8d1bdSmiod.Bl -item -offset indent -compact
1179de8d1bdSmiod.It
1189de8d1bdSmiodpciknob* at pci? trick ? treat ?               # unknown locators
1199de8d1bdSmiod.It
1209de8d1bdSmiodpciknob* at pci? dev ? function ? usefulness ? # unknown locators
1219de8d1bdSmiod.El
1229de8d1bdSmiod.\"
1239de8d1bdSmiod.Ss Attributes
1249de8d1bdSmiod.\"
1259de8d1bdSmiodThe syntax
1269de8d1bdSmiod.Bl -item -offset indent -compact
1279de8d1bdSmiod.It
1289de8d1bdSmioddefine attribute
1299de8d1bdSmiod.El
1309de8d1bdSmioddefines a simple attribute, which can be later used to factorize
1319de8d1bdSmiodcode dependencies.
1329de8d1bdSmiodAn attachment-like attribute will also require locators to be specified, as
1339de8d1bdSmiod.Bl -item -offset indent -compact
1349de8d1bdSmiod.It
1359de8d1bdSmioddefine attribute {}
1369de8d1bdSmiod.El
1379de8d1bdSmiodif no locators are necessary, or
1389de8d1bdSmiod.Bl -item -offset indent -compact
1399de8d1bdSmiod.It
1409de8d1bdSmioddefine attribute {[locator1 = default1], [locator2 = default2]}
1419de8d1bdSmiod.El
1429de8d1bdSmiodif locators are provided.
1439de8d1bdSmiod.\"
1449de8d1bdSmiod.Ss Devices
1459de8d1bdSmiod.\"
1469de8d1bdSmiodFor simple device attachment, the syntax
1479de8d1bdSmiod.Bl -item -offset indent -compact
1489de8d1bdSmiod.It
1499de8d1bdSmioddefine device {}
1509de8d1bdSmiod.El
1519de8d1bdSmioddefines a simple device, with no locators.
1529de8d1bdSmiodIf locators are necessary, they are specified as:
1539de8d1bdSmiod.Bl -item -offset indent -compact
1549de8d1bdSmiod.It
1559de8d1bdSmioddefine device {[locator1 = default1], [locator2 = default2]}
1569de8d1bdSmiod.El
1579de8d1bdSmiodA device can also reference an attribute with locators.
1589de8d1bdSmiodThis is in fact a dependency rule.
1599de8d1bdSmiodFor example,
1609de8d1bdSmiod.Pa sys/dev/conf/files
1619de8d1bdSmioddefines the following attribute for
1629de8d1bdSmiod.Tn SCSI
1639de8d1bdSmiodcontrollers:
1649de8d1bdSmiod.Bl -item -offset indent -compact
1659de8d1bdSmiod.It
1669de8d1bdSmioddefine scsi {}			# no locators
1679de8d1bdSmiod.El
1689de8d1bdSmiodand
1699de8d1bdSmiod.Tn SCSI
1709de8d1bdSmioddrivers can then be defined as
1719de8d1bdSmiod.Bl -item -offset indent -compact
1729de8d1bdSmiod.It
1739de8d1bdSmioddefine scsictrl: scsi
1749de8d1bdSmiod.El
1759de8d1bdSmiodA device may depend on as many attributes as necessary:
1769de8d1bdSmiod.Bl -item -offset indent -compact
1779de8d1bdSmiod.It
1789de8d1bdSmioddefine complexdev: simpledev, otherdev, specialattribute
1799de8d1bdSmiod.El
1809de8d1bdSmiod.\"
1819de8d1bdSmiod.Ss Pseudo devices
1829de8d1bdSmiod.\"
1839de8d1bdSmiodPseudo device are defined as regular devices, except that they do not need
1849de8d1bdSmiodlocators, and use a different keyword:
1859de8d1bdSmiod.Bl -item -offset indent -compact
1869de8d1bdSmiod.It
1879de8d1bdSmiodpseudo-device loop: inet
1889de8d1bdSmiod.It
1899de8d1bdSmiodpseudo-device ksyms
1909de8d1bdSmiod.El
1919de8d1bdSmioddefine respectively, the loopback network interface, and the kernel symbols
1929de8d1bdSmiodpseudo-device.
1939de8d1bdSmiod.\"
1949de8d1bdSmiod.Ss Device attachment rules
1959de8d1bdSmiod.\"
1969de8d1bdSmiodDue to the tree structure of the device nodes, every device but the pseudo
1979de8d1bdSmioddevices need to attach to some parent node.
1989de8d1bdSmiodA device driver has to specify to which parents it can attach, with the
1999de8d1bdSmiodfollowing syntax:
2009de8d1bdSmiod.Bl -item -offset indent -compact
2019de8d1bdSmiod.It
2029de8d1bdSmiodattach device at parent, parent2, parent3
2039de8d1bdSmiod.El
2049de8d1bdSmiodwhich lists all the parent attributes a device may attach to.
2059de8d1bdSmiodFor example, if a device is specified as:
2069de8d1bdSmiod.Bl -item -offset indent -compact
2079de8d1bdSmiod.It
2089de8d1bdSmioddevice smartknob: bells, whistles
2099de8d1bdSmiod.It
2109de8d1bdSmiodattach smartknob at brainbus
2119de8d1bdSmiod.El
2129de8d1bdSmiodthen a
2139de8d1bdSmiod.Bl -item -offset indent -compact
2149de8d1bdSmiod.It
2159de8d1bdSmiodsmartknob* at brainbus?
2169de8d1bdSmiod.El
2179de8d1bdSmiodconfiguration file line is valid, while a
2189de8d1bdSmiod.Bl -item -offset indent -compact
2199de8d1bdSmiod.It
2209de8d1bdSmiodsmartknob* at dumbbus?
2219de8d1bdSmiod.El
2229de8d1bdSmiodis not.
2239de8d1bdSmiod.Pp
2249de8d1bdSmiodIf a device supports attachments to multiple parents, using different
2259de8d1bdSmiod.Dq glue
2269de8d1bdSmiodroutines every time, the following syntax specifies the details:
2279de8d1bdSmiod.Bl -item -offset indent -compact
2289de8d1bdSmiod.It
2299de8d1bdSmiodattach device at parent with device_parent_glue
2309de8d1bdSmiod.It
2319de8d1bdSmiodattach device at parent2 with device_parent2_glue
2329de8d1bdSmiod.El
2339de8d1bdSmiodand will define more required attributes, depending on the kernel
2349de8d1bdSmiodconfiguration file's contents.
2359de8d1bdSmiod.\"
2369de8d1bdSmiod.Ss Rule file inclusion
2379de8d1bdSmiod.\"
2389de8d1bdSmiodIt is possible to include other rules files anywhere in a file, using the
2399de8d1bdSmiod.Dq include
2409de8d1bdSmiodkeyword:
2419de8d1bdSmiod.Bl -item -offset indent -compact
2429de8d1bdSmiod.It
2439de8d1bdSmiodinclude "dev/pci/files.pci"
2449de8d1bdSmiod.El
2459de8d1bdSmiodwill include the rules for machine-independant pci code.
2469de8d1bdSmiod.Pp
2479de8d1bdSmiodThe files
2489de8d1bdSmiod.Pa sys/arch/machine/conf/files.machine ,
2499de8d1bdSmiodfor every
2509de8d1bdSmiod.Dq machine
2519de8d1bdSmiodlisted in the machine line in the kernel configuration file, as well as
2529de8d1bdSmiod.Pa sys/conf/files ,
2539de8d1bdSmiodare always processed, and do not need to be included.
2549de8d1bdSmiod.\"
2559de8d1bdSmiod.Ss Attribute requirements
2569de8d1bdSmiod.\"
2579de8d1bdSmiodThe kernel configuration file description passed to
2589de8d1bdSmiod.Xr config 8
2599de8d1bdSmiodlists several compilation options, as well as several device definitions.
2609de8d1bdSmiodFrom this list,
2619de8d1bdSmiod.Xr config 8
2629de8d1bdSmiodwill build a list of required attributes, which are
2639de8d1bdSmiod.Bl -bullet -offset XXX -compact
2649de8d1bdSmiod.It
2659de8d1bdSmiodthe
2669de8d1bdSmiod.Dq option
2679de8d1bdSmiodlines, with the option name translated to lowercase (for example, an
2689de8d1bdSmiod.Dq option INET
2699de8d1bdSmiodline will produce the
2709de8d1bdSmiod.Dq inet
2719de8d1bdSmiodattribute).
2729de8d1bdSmiod.It
2739de8d1bdSmiodthe device and pseudo-device names, except for
2749de8d1bdSmiod.Dq root .
2759de8d1bdSmiod.El
2769de8d1bdSmiod.\"
2779de8d1bdSmiod.Ss Kernel file list
2789de8d1bdSmiod.\"
2799de8d1bdSmiodKernel source files are defined as:
2809de8d1bdSmiod.Bl -item -offset indent -compact
2819de8d1bdSmiod.It
2829de8d1bdSmiodfile somewhere/somefile.c	dependencies	need-rules
2839de8d1bdSmiod.El
2849de8d1bdSmiodIf the
2859de8d1bdSmiod.Dq dependencies
2869de8d1bdSmiodpart is empty, the file will always be compiled-in.
2879de8d1bdSmiodThis is the case for the core kernel files.
2889de8d1bdSmiodOtherwise, the file will only be added to the list if the dependencies are met.
2899de8d1bdSmiodDependencies are based upon attributes and device names.
2909de8d1bdSmiodMultiple dependencies can be written using the
2919de8d1bdSmiod.Dq \&|
2929de8d1bdSmiodand
2939de8d1bdSmiod.Dq \&&
2949de8d1bdSmiodoperators.
2959de8d1bdSmiodFor example, the line
2969de8d1bdSmiod.Bl -item -offset indent -compact
2979de8d1bdSmiod.It
2989de8d1bdSmiodfile netinet/ipsec_input.c	(inet | inet6) & ipsec
2999de8d1bdSmiod.El
3009de8d1bdSmiodteaches
3019de8d1bdSmiod.Xr config 8
3029de8d1bdSmiodto only add
3039de8d1bdSmiod.Pa sys/netinet/ipsec_input.c
3049de8d1bdSmiodto the filelist if the
3059de8d1bdSmiod.Dq ipsec
3069de8d1bdSmiodattribute, and at least one of the
3079de8d1bdSmiod.Dq inet
3089de8d1bdSmiodand
3099de8d1bdSmiod.Dq inet6
3109de8d1bdSmiodattributes are required.
3119de8d1bdSmiod.Pp
3129de8d1bdSmiodThe
3139de8d1bdSmiod.Dq need
3149de8d1bdSmiodrules can be empty, or one of the following keywords:
3159de8d1bdSmiod.Bl -tag -width "needs-count" -compact
3169de8d1bdSmiod.It needs-flag
3179de8d1bdSmiodCreate an attribute header file, defining whether or not this
3189de8d1bdSmiodattribute is compiled in.
3199de8d1bdSmiod.It needs-count
3209de8d1bdSmiodCreate an attribute header file, defining how many instances of this
3219de8d1bdSmiodattribute are to be compiled in.
3229de8d1bdSmiodThis rule is mostly used for pseudo-devices.
3239de8d1bdSmiod.El
3249de8d1bdSmiod.Pp
3259de8d1bdSmiodThe
3269de8d1bdSmiod.Dq attribute header files
3279de8d1bdSmiodare simple C header files created in the kernel compilation directory,
3289de8d1bdSmiodwith the name
3299de8d1bdSmiod.Pa attribute.h
3309de8d1bdSmiodand containing the following line:
3319de8d1bdSmiod.Bl -item -offset indent -compact
3329de8d1bdSmiod.It
3339de8d1bdSmiod#define NATTRIBUTE	0
3349de8d1bdSmiod.El
3359de8d1bdSmiodsubstituting the attribute name and its uppercase form, prefixed with
3369de8d1bdSmiodthe letter
3379de8d1bdSmiod.Dq N ,
3389de8d1bdSmiodto
3399de8d1bdSmiod.Dq attribute
3409de8d1bdSmiodand
3419de8d1bdSmiod.Dq NATTRIBUTE ,
3429de8d1bdSmiodrespectively.
3439de8d1bdSmiodFor a
3449de8d1bdSmiod.Dq needs-flag
3459de8d1bdSmiodrule, the value on the
3469de8d1bdSmiod.Dq #define
3479de8d1bdSmiodline is either 1 if the attribute is required, or 0 if it is not required.
3489de8d1bdSmiodFor a
3499de8d1bdSmiod.Dq needs-count
3509de8d1bdSmiodrule, the value is the number of device instances required, or 0
3519de8d1bdSmiodif the device is not required.
3529de8d1bdSmiod.Pp
3539de8d1bdSmiodAttribute files are created for every attribute listed with a
3549de8d1bdSmiod.Dq need
3559de8d1bdSmiodrule, even if it is never referenced from the kernel configuration file.
3569de8d1bdSmiod.\"
3579de8d1bdSmiod.Ss Miscellaneous items
3589de8d1bdSmiod.\"
3599de8d1bdSmiodThe
3609de8d1bdSmiod.Pa sys/arch/machine/conf/files.machine
3619de8d1bdSmiodmust also supply the following special commands:
3629de8d1bdSmiod.Bl -tag -width maxpartitions .\" -compact
3639de8d1bdSmiod.It maxpartitions
3649de8d1bdSmiodDefines how many partitions are available on disk block devices, usually 16.
3659de8d1bdSmiodThis value is used by
3669de8d1bdSmiod.Xr config 8
3679de8d1bdSmiodto setup various device information structures.
3689de8d1bdSmiod.It maxusers
3699de8d1bdSmiodDefines the bounds, and the default value, for the
3709de8d1bdSmiod.Dq maxusers
3719de8d1bdSmiodparameter in the kernel configuration file.
3729de8d1bdSmiodThe usual values are 2 8 64 ;
3739de8d1bdSmiod.Xr config 8
3749de8d1bdSmiodwill report an error if the
3759de8d1bdSmiod.Dq maxusers parameter
3769de8d1bdSmiodin the kernel configuration file does not fit in the specified range.
3779de8d1bdSmiod.El
3789de8d1bdSmiod.\"
3799de8d1bdSmiod.Sh FILES
3809de8d1bdSmiod.Bl -tag -width XXX -compact .\" deliberately small width
3819de8d1bdSmiod.It Pa sys/arch/machine/conf/files.machine
3829de8d1bdSmiodRules for architecture-dependent files, for the
3839de8d1bdSmiod.Dq machine
3849de8d1bdSmiodarchitecture.
3859de8d1bdSmiod.It Pa sys/compat/emul/files.emul
3869de8d1bdSmiodRules for the
3879de8d1bdSmiod.Dq emul
3889de8d1bdSmiodoperating system or subsystem emulation
3899de8d1bdSmiod.It Pa sys/dev/class/files.class
3909de8d1bdSmiodRules for the
3919de8d1bdSmiod.Dq class
3929de8d1bdSmiodclass of devices.
3939de8d1bdSmiod.It Pa sys/gnu/arch/i386/fpemul/files.fpemul
3949de8d1bdSmiodRules for the i386 GPL floating-point emulator.
3959de8d1bdSmiod.It Pa sys/scsi/files.scsi
3969de8d1bdSmiodRules for the common
3979de8d1bdSmiod.Tn SCSI
3989de8d1bdSmiodsubsystem.
3999de8d1bdSmiod.El
4009de8d1bdSmiod.Sh SEE ALSO
4019de8d1bdSmiod.Xr config 8
402